Want to setup a two-node elastic search cluster on same machine

Viewed 363

I am on elastic search [7.10.1. For learning purposes want to setup a clutser of two nodes on the same host. Unable to find a configuration which works for me. I have done same elastic serach installation in two different folders node1 and node2. node1 elasticsearch.yml file:

...
cluster.name: tktest_esclutser
node.name: tkesnode-1
http.port: 19200
transport.port: 19201
discovery.seed_hosts: ["localhost:29200"]
...

node2 elasticsearch.yml file:

...
cluster.name: tktest_esclutser
node.name: tkesnode-2
http.port: 29200
transport.port: 29201
discovery.seed_hosts: ["localhost:19200"]
...

For some reason cluster is not being formed. log file shows master-node could not be discovered.

1 Answers

Below configuration works perfectly fine for me, initially you may have to delete the folders inside the data folder of both nodes to start with clean state.

Node 1 elasticsearch.yml

cluster.name: es_710
node.name: opster
http.port: 9900
cluster.initial_master_nodes: ["opster"]

Node 2 elasticsearch.yml

http.port: 9910
xpack.ml.enabled: false
cluster.name: es_710
cluster.initial_master_nodes: ["opster"]
Related