Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
165 views
in Technique[技术] by (71.8m points)

How to setup elasticsearch cluster on Jelastic ? got Connection refused

I've succesfully installed elasticsearch in single-node on Jelastic cloud here is my elastichearch.yml for single-node

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

But When I try to run it in cluster mode, whatever I edited elastichearch.yml for cluster mode I get Connection refused when doing curl my_ip:9200

I can't find any totorial on how to get it to work on Jelastic cloud platform. I followed many totorials for setting up elasticsearch.yml for cluster in other platforms with the same error "Connection refused"

here is a sample of elasticsearch.yml of master node

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"]

here is a sample of elasticsearch.yml of slave node

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"]
question from:https://stackoverflow.com/questions/65645318/how-to-setup-elasticsearch-cluster-on-jelastic-got-connection-refused

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Thanks to the advice of @AlexeyPrudnikov about watching logs I was able to fix it, the problem was discovery.zen. modules not present, second problem was memory lock which was fixed by setting it to false. I also set network.host to 0.0.0.0

So here is the elasticsearch.yml for master node:

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"]

And for the slave

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"]

Thank you @AlexeyPrudnikov for your advice


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...