如何在 Jelastic 上设置 elasticsearch 集群?连接被拒绝

问题描述

我已经成功地在 jelastic 云上的单节点中安装了 elasticsearch,这里是我的单节点 elastichearch.yml

network.host: 0.0.0.0
discovery.type: single-node

但是当我尝试在集群模式下运行它时,无论我为集群模式编辑了 elastichearch.yml 什么,我在执行 curl my_ip:9200 时都会拒绝连接

我找不到任何关于如何让它在 jelastic 云平台上工作的教程。我在其他平台上为集群设置 elasticsearch.yml 的许多教程都出现了相同的错误“连接被拒绝”

这里是主节点的elasticsearch.yml示例

cluster.name: myCluster
node.name: ESNode1
node.master: true
node.data: true
#network.host: 10.103.1.121
#xpack.security.enabled: false
#http.host: 10.103.1.121
http.port: 9200
discovery.zen.ping.multicast.enabled: true
discovery.zen.ping.unicast.hosts: ["10.103.1.121:9300","10.103.2.62:9300"]
discover.zen.ping.timeout: 20s
transport.port: 9300
#cluster.initial_master_nodes: node-1
#discovery.seed_hosts: ["10.103.1.121"]

这里是slave节点的elasticsearch.yml示例

cluster.name: myCluster
node.name: ESNode2
node.master: false
node.data: true
#network.host: 10.103.1.121
#xpack.security.enabled: false
#http.host: 10.103.1.121
http.port: 9200
discovery.zen.ping.multicast.enabled: true
discovery.zen.ping.unicast.hosts: ["10.103.1.121:9300","10.103.2.62:9300"]
discover.zen.ping.timeout: 20s
transport.port: 9300
#cluster.initial_master_nodes: node-1
#discovery.seed_hosts: ["10.103.1.121"]

解决方法

感谢@AlexeyPrudnikov 关于查看日志的建议,我能够修复它,问题是discovery.zen。模块不存在,第二个问题是内存锁定,通过将其设置为 false 来修复。 我还将 network.host 设置为 0.0.0.0

这里是主节点的elasticsearch.yml:

cluster.name: myCluster
node.name: "ESNode1"
node.master: true
node.data: true
#network.host: 10.103.1.121
#xpack.security.enabled: false
#http.host: 10.103.1.121
network.host: 0.0.0.0
http.port: 9200
#discovery.zen.ping.multicast.enabled: false
#discovery.zen.ping.unicast.hosts: ["10.103.1.121:9300","10.103.2.62:9300"]
discovery.seed_hosts: ["10.103.1.121:9300","10.103.2.62:9300"]
cluster.initial_master_nodes: ["ESNode1"]
#discover.zen.ping.timeout: 20s
transport.tcp.port: 9300
transport.host: 10.103.1.121
bootstrap.memory_lock: false
#cluster.initial_master_nodes: node-1
#discovery.seed_hosts: ["10.103.1.121"]

为了奴隶

cluster.name: myCluster
node.name: "ESNode2"
node.master: false
node.data: true
#network.host: 10.103.1.121
#xpack.security.enabled: false
#http.host: 10.103.1.121
network.host: 0.0.0.0
http.port: 9200
#discovery.zen.ping.multicast.enabled: false
#discovery.zen.ping.unicast.hosts: ["10.103.1.121:9300","10.103.2.62:9300"]
#discover.zen.ping.timeout: 20s
transport.tcp.port: 9300
transport.host: 10.103.2.62
cluster.initial_master_nodes: ["ESNode1"]
bootstrap.memory_lock: false
#cluster.initial_master_nodes: node-1
#discovery.seed_hosts: ["10.103.1.121"]

感谢@AlexeyPrudnikov 的建议