Swikrit
Swikrit

Reputation: 351

Cannot get second node started on elasticsearch

My first config is like:

 cluster.name: cluster
 node.name: "node-1"
 node.master: true
 node.data: true
 network.host: localhost 
 transport.tcp.port: 9302
 discovery.zen.ping.multicast.enabled: false
 discovery.zen.ping.unicast.hosts: ["localhost"]

And my second node's config is:

 cluster.name: cluster
 node.name: "node-2"
 node.master: false
 node.data: true
 network.host: 172.28.29.49 (IP OF THE MASTER NODE)
 discovery.zen.ping.multicast.enabled: false
 discovery.zen.ping.unicast.hosts: ["172.28.29.49:9302"]

I'm running this off two VM's. The question is pretty basic, why aren't my two nodes connecting to each other.

IGNORE EVERYTHING BELLOW THIS IF YOU WANT. IT'S JUST SOME HISTORY:

The reason why I want to setup two nodes is because I lost heaps of data (https://stackoverflow.com/questions/35191543/elasticsearch-lost-data-after-power-cut). My plan was to copy the already indexed indices into a new node, but that didn't work and just left me with a whole bunch of unassigned_shards. So I made a script to automatically relocate them, but I can't relocate them to the same node, which is why I need a new node. If someone knows how to relocate shards to the same node or know of another fix for my problem in my old question then that would be great

Upvotes: 0

Views: 253

Answers (1)

Val
Val

Reputation: 217444

If you are running ES 2.x, then each node binds to localhost by default, unless specified otherwise.

In your case, the network configuration is not correct (both the bind host and the unicast hosts list). Your first node needs to bind to an IP address that your second host can see and you second host needs to bind to an IP address that your first host can see, otherwise both will be blind and not form any cluster.

So node-1 needs to be configured like this:

network.host: 172.28.29.49
discovery.zen.ping.unicast.hosts: ["IP.OF.NODE.2"]

And node-2 needs to be configured like this:

network.host: IP.OF.NODE.2
discovery.zen.ping.unicast.hosts: ["172.28.29.49:9302"]  #Need port number here

Upvotes: 1

Related Questions