Elasticsearch cluster

Good day!
I am having difficulty to create 2 nodes cluster, each nodes has different "cluster.uuid".
Why? How add node to cluster?

Node A

cluster.name: "elk-cluster"
network.host: 0.0.0.0
node.name: primary


cluster.initial_master_nodes:
  - primary
  - secondary


discovery.seed_hosts:
  - primary.local
  - secondary.local

Node B

cluster.name: "elk-cluster"
network.host: 0.0.0.0
node.name: secondary


discovery.seed_hosts:
  - primary.local
  - secondary.local

cluster.initial_master_nodes:
  - primary
  - secondary

Which version of Elasticsearch are you using?

1 Like

Node A logs:

elasticsearch_1      | {"type": "server", "timestamp": "2020-10-16T17:57:24,154+0000", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "elk-cluster", "node.name": "primary",  "message": "initialized"  }
elasticsearch_1      | {"type": "server", "timestamp": "2020-10-16T17:57:24,155+0000", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "elk-cluster", "node.name": "primary",  "message": "starting ..."  }
elasticsearch_1      | {"type": "server", "timestamp": "2020-10-16T17:57:24,320+0000", "level": "INFO", "component": "o.e.t.TransportService", "cluster.name": "elk-cluster", "node.name": "primary",  "message": "publish_address {172.19.0.2:9300}, bound_addresses {0.0.0.0:9300}"  }
elasticsearch_1      | {"type": "server", "timestamp": "2020-10-16T17:57:24,329+0000", "level": "INFO", "component": "o.e.b.BootstrapChecks", "cluster.name": "elk-cluster", "node.name": "primary",  "message": "bound or publishing to a non-loopback address, enforcing bootstrap checks"  }
elasticsearch_1      | {"type": "server", "timestamp": "2020-10-16T17:57:24,343+0000", "level": "INFO", "component": "o.e.c.c.Coordinator", "cluster.name": "elk-cluster", "node.name": "primary",  "message": "cluster UUID [T7OI4j3uQGexfTvKnDV7Gg]"  }
elasticsearch_1      | {"type": "server", "timestamp": "2020-10-16T17:57:25,109+0000", "level": "INFO", "component": "o.e.c.s.MasterService", "cluster.name": "elk-cluster", "node.name": "primary",  "message": "elected-as-master ([1] nodes joined)[{primary}{RqQaxTmnSre0YJbou0RPLA}{1HE7-VlvRlyzgSqhh-eElg}{172.19.0.2}{172.19.0.2:9300}{ml.machine_memory=33811034112, xpack.installed=true, ml.max_open_jobs=20} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 33, version: 12709, reason: master node changed {previous [], current [{primary}{RqQaxTmnSre0YJbou0RPLA}{1HE7-VlvRlyzgSqhh-eElg}{172.19.0.2}{172.19.0.2:9300}{ml.machine_memory=33811034112, xpack.installed=true, ml.max_open_jobs=20}]}"  }
elasticsearch_1      | {"type": "server", "timestamp": "2020-10-16T17:57:25,192+0000", "level": "WARN", "component": "o.e.m.j.JvmGcMonitorService", "cluster.name": "elk-cluster", "node.name": "primary",  "message": "[gc][1] overhead, spent [529ms] collecting in the last [1s]"  }
elasticsearch_1      | {"type": "server", "timestamp": "2020-10-16T17:57:32,948+0000", "level": "INFO", "component": "o.e.c.s.ClusterApplierService", "cluster.name": "elk-cluster", "node.name": "primary",  "message": "master node changed {previous [], current [{primary}{RqQaxTmnSre0YJbou0RPLA}{1HE7-VlvRlyzgSqhh-eElg}{172.19.0.2}{172.19.0.2:9300}{ml.machine_memory=33811034112, xpack.installed=true, ml.max_open_jobs=20}]}, term: 33, version: 12709, reason: Publication{term=33, version=12709}"  }

Node B logs

elasticsearch_1  | {"type": "server", "timestamp": "2020-10-16T17:58:28,225+0000", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "elk-cluster", "node.name": "secondary",  "message": "initialized"  }
elasticsearch_1  | {"type": "server", "timestamp": "2020-10-16T17:58:28,226+0000", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "elk-cluster", "node.name": "secondary",  "message": "starting ..."  }
elasticsearch_1  | {"type": "server", "timestamp": "2020-10-16T17:58:28,386+0000", "level": "INFO", "component": "o.e.t.TransportService", "cluster.name": "elk-cluster", "node.name": "secondary",  "message": "publish_address {172.18.0.2:9300}, bound_addresses {0.0.0.0:9300}"  }
elasticsearch_1  | {"type": "server", "timestamp": "2020-10-16T17:58:28,396+0000", "level": "INFO", "component": "o.e.b.BootstrapChecks", "cluster.name": "elk-cluster", "node.name": "secondary",  "message": "bound or publishing to a non-loopback address, enforcing bootstrap checks"  }
elasticsearch_1  | {"type": "server", "timestamp": "2020-10-16T17:58:28,405+0000", "level": "INFO", "component": "o.e.c.c.Coordinator", "cluster.name": "elk-cluster", "node.name": "secondary",  "message": "cluster UUID [9b393qw_SiaF_YqlP8QY_g]"  }
elasticsearch_1  | {"type": "server", "timestamp": "2020-10-16T17:58:28,596+0000", "level": "INFO", "component": "o.e.c.s.MasterService", "cluster.name": "elk-cluster", "node.name": "secondary",  "message": "elected-as-master ([1] nodes joined)[{secondary}{_CQL6DToQoWlSnaKkr3eNg}{g6g5jXjdSBa3aRpfBe9Tsg}{172.18.0.2}{172.18.0.2:9300}{ml.machine_memory=63326285824, xpack.installed=true, ml.max_open_jobs=20} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 17, version: 143, reason: master node changed {previous [], current [{secondary}{_CQL6DToQoWlSnaKkr3eNg}{g6g5jXjdSBa3aRpfBe9Tsg}{172.18.0.2}{172.18.0.2:9300}{ml.machine_memory=63326285824, xpack.installed=true, ml.max_open_jobs=20}]}"  }
elasticsearch_1  | {"type": "server", "timestamp": "2020-10-16T17:58:28,758+0000", "level": "INFO", "component": "o.e.c.s.ClusterApplierService", "cluster.name": "elk-cluster", "node.name": "secondary",  "message": "master node changed {previous [], current [{secondary}{_CQL6DToQoWlSnaKkr3eNg}{g6g5jXjdSBa3aRpfBe9Tsg}{172.18.0.2}{172.18.0.2:9300}{ml.machine_memory=63326285824, xpack.installed=true, ml.max_open_jobs=20}]}, term: 17, version: 143, reason: Publication{term=17, version=143}"  }

Elasticsearch 7.2 version

I wonder if you have started them up previously with different configuration which is still active. Could you please delete the two data directories completely and start the nodes again?