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

How to setup elasticsearch cluster on Jelastic ? got Connection refused

我已经在 J​​elastic 云上的单节点中成功安装了 elasticsearch,这是我的 elastichearch.yml 单节点

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

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

时都会拒绝连接

我找不到任何关于如何让它在 Jelastic 云平台上运行的教程。我遵循了许多关于在其他平台上为集群设置 elasticsearch.yml 的教程,但出现相同的错误“Connection refused”

这里是主节点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"]

这里是从节点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"]
discovery.seed_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 的建议