2
votes

I have 2 separate machines. Port 9200 is already taken by a separate elasticsearch running, so I specify 9201 as the http.port in the yml file. i set cluster.name: MyCluster.

When I start ./elasticsearch on machine 1 and machine 2, they are not connected, but each are single node master's.

What do I need to do so that they can connect to each other and be part of the same cluster?

I also set network.host: 0.0.0.0 so I know they can see each other. I am using 2.4.0 of Elastcisearch.

2

2 Answers

2
votes

In machine 1:

cluster.name: hello_world
network.host: "hostname_or_ip_1"
network.port: 9201
discovery.zen.ping.unicast.hosts: ["hostname_or_ip_2:9201"]

In machine 2:

cluster.name: hello_world
network.host: "hostname_or_ip_2"
network.port: 9201
discovery.zen.ping.unicast.hosts: ["hostname_or_ip_1:9201"]
  • Both cluster name should be same
  • discovery.zen.ping.unicast.hosts should point to correct machine address with port
  • Make sure to restart elasticsearch node after editing config file
0
votes

Look at unicast discovery with host:port. https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery-zen.html

You might also need to be explicit about the transport.tcp.port in your elasticsearch.yml: transport.tcp.port: 9301