elasticsearch cluster not binding each other

I'm trying to create an elastic search cluster, but the two computers don't see each other as clusters, I've tried a lot but it didn't

machine-1(x.x.45.131) elasticsearch.yml



cluster.name: my-application

node.name: node-1
node.master: true
node.data: true
node.ingest: true
network.host: ["x.x.45.131"]

discovery.zen.ping.unicast.hosts: ["x.x.45.131", "x.x.45.1"]
discovery.zen.minimum_master_nodes: 2

machine-2(x.x.45.1) elasticsearch.yml

cluster.name: my-application

node.name: node-2
node.master: false
node.data: true
node.ingest: true


network.host: ["x.x.45.1"]

discovery.zen.ping.unicast.hosts: ["x.x.45.131", "x.x.45.1"]
discovery.zen.minimum_master_nodes: 2

path.data: /var/lib/elasticsearch

path.logs: /var/log/elasticsearch

EDIT

ı solved 😁

with config below

node-1 (172.16.45.131)
node-2 (172.16.45.63)

elasticsearch.yml
------------------------------------------

cluster.name: my-application

node.name: node-1
node.master: true
node.data: true
node.ingest: true

network.host: 172.16.45.131
transport.port: 9300

cluster.initial_master_nodes: 
 - node-1
 - node-2



discovery.seed_hosts: 
 - 172.16.45.131
 - 172.16.45.63


path.data: /var/lib/elasticsearch

path.logs: /var/log/elasticsearch
----------------------------------------

node-2 elasticsearch.yml

-----------------------------------------------------

cluster.name: my-application
node.name: node-2
node.master: false
node.data: true
node.ingest: true

network.host: 172.16.45.63
transport.port: 9300


discovery.seed_hosts:
  - 172.16.45.131:9300

path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch 

Upvotes: 1

Views: 986

Answers (1)

Nishant
Nishant

Reputation: 7854

Check the tcp port on which the nodes are running. By default elastic try to pick an available port which could be 9300 or any other free port (9300 - 9400). I would suggest you to add the following to the yml of each node so that node starts on fixed port.

transport.port: 9300

Other part would be to add bootstraping properties to yml. Since node 1 is master eligible and will be used to start the cluster for the very first time add the following as well in yml of machine-1:

cluster.initial_master_nodes:
  - node-1

Add another property which is list of master eligible nodes who will take part in master election process. Any new master eligible node in future will also go under this property. Update this in yml of both nodes:

discovery.seed_hosts:
  - x.x.45.131:9300

Following are no longer required in es-7:

discovery.zen.ping.unicast.hosts: ["x.x.45.131", "x.x.45.1"]
discovery.zen.minimum_master_nodes: 2

Upvotes: 2

Related Questions