How to configure two nodes to connect to same cluster in elasticsearch? How to configure two nodes to connect to same cluster in elasticsearch? elasticsearch elasticsearch

How to configure two nodes to connect to same cluster in elasticsearch?


In machine 1:

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

In machine 2:

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


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