# Setup Elasticsearch cluster result in two clusers

**URL:** <https://discuss.elastic.co/t/setup-elasticsearch-cluster-result-in-two-clusers/281135>\
**Category:** Elasticsearch\
**Created:** [August 12, 2021, 1:50am UTC](https://discuss.elastic.co/t/setup-elasticsearch-cluster-result-in-two-clusers/281135 "2021-08-12T01:50:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benli/32/113306_2.png) [@Benli](https://discuss.elastic.co/u/Benli)\
**Post date:** [August 12, 2021, 1:50am UTC](https://discuss.elastic.co/t/setup-elasticsearch-cluster-result-in-two-clusers/281135/1 "2021-08-12T01:50:48Z")

</div>

Hi there, I'm setting up Elasticsearch cluster by using two separate Linux machines.

On the first Linux, elasticsearch.yml:

```auto
# ---------------------------------- Cluster -----------------------------------
cluster.name: my-elk
# ------------------------------------ Node ------------------------------------
node.name: lib9-CentOS-01
# ---------------------------------- Network -----------------------------------
network.host: 10.60.37.56
http.port: 9200
# --------------------------------- Discovery ----------------------------------
discovery.seed_hosts: ["10.60.37.56", "10.60.37.57"]
cluster.initial_master_nodes: ["lib9-CentOS-02"]

```

On the second Linux, elasticsearch.yml:

```auto
# ---------------------------------- Cluster -----------------------------------
cluster.name: my-elk
# ------------------------------------ Node ------------------------------------
node.name: lib9-CentOS-02
# ---------------------------------- Network -----------------------------------
network.host: 10.60.37.57
http.port: 9200
# --------------------------------- Discovery ----------------------------------
discovery.seed_hosts: ["10.60.37.56", "10.60.37.57"]
cluster.initial_master_nodes: ["lib9-CentOS-02"]

```

After start Elasticsearch service on both nodes, the cluser status show below.  
It looks each node form a separate cluster, as the cluster\_uuid is different.

I also try use below on the .yml on both machines, but same.

```auto
cluster.initial_master_nodes: ["lib9-CentOS-01", "lib9-CentOS-02"]

```

What's wrong with my setting?  
Any step I miss to form these two nodes into one same cluster?

- The first node:

```auto
[root@lib9-CentOS-01 elasticsearch]# curl -XGET 'http://10.60.37.56:9200/_cluster/state?pretty'|more
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
  0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0{
  "cluster_name" : "my-elk",
  "cluster_uuid" : "ZECF4nRVRfKcLkiOMKVgCQ",
  "version" : 61,
  "state_uuid" : "52o-KcqWT6ihRDQ7XylBAQ",
  "master_node" : "X26_cY-jQqO31MSw7sYV9Q",
  "blocks" : { },
  "nodes" : {
    "X26_cY-jQqO31MSw7sYV9Q" : {
      "name" : "lib9-CentOS-01",
      "ephemeral_id" : "8_ehu8qoRXSyarvNpfB3Og",
      "transport_address" : "10.60.37.56:9300",
      "attributes" : {
        "ml.machine_memory" : "8201666560",
        "xpack.installed" : "true",
        "transform.node" : "true",
        "ml.max_open_jobs" : "512",
        "ml.max_jvm_size" : "1073741824"
      },

```

- The second node:

```auto
[root@lib9-CentOS-02 elasticsearch]# curl -XGET 'http://10.60.37.57:9200/_cluster/state?pretty'|more
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
  0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0{
  "cluster_name" : "my-elk",
  "cluster_uuid" : "7jjgqZRSSveHbUzfgqhRPw",
  "version" : 61,
  "state_uuid" : "tQVTz9CLRlKPRn5CANQ_uA",
  "master_node" : "dMOj9zi4SMqx88olIJ8XBw",
  "blocks" : { },
  "nodes" : {
    "dMOj9zi4SMqx88olIJ8XBw" : {
      "name" : "lib9-CentOS-02",
      "ephemeral_id" : "3EWhBmfiQEOvAIpurpXMaw",
      "transport_address" : "10.60.37.57:9300",
      "attributes" : {
        "ml.machine_memory" : "8201666560",
        "xpack.installed" : "true",
        "transform.node" : "true",
        "ml.max_open_jobs" : "512",
        "ml.max_jvm_size" : "1073741824"
      },

```

---

<div class="post-metadata">

**Author:** ![Benli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benli/32/113306_2.png) [@Benli](https://discuss.elastic.co/u/Benli)\
**Post date:** [August 12, 2021, 1:57am UTC](https://discuss.elastic.co/t/setup-elasticsearch-cluster-result-in-two-clusers/281135/2 "2021-08-12T01:57:12Z")

</div>

I also have added both nodes name to IP address mapping to local /etc/hosts on both machines.

---

<div class="post-metadata">

**Author:** ![Benli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benli/32/113306_2.png) [@Benli](https://discuss.elastic.co/u/Benli)\
**Post date:** [August 12, 2021, 2:07am UTC](https://discuss.elastic.co/t/setup-elasticsearch-cluster-result-in-two-clusers/281135/3 "2021-08-12T02:07:31Z")

</div>

Just to mention, both nodes can communicate to each other on 9200 and 9300 port, so no firewall issue.

---

<div class="post-metadata">

**Author:** ![Benli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benli/32/113306_2.png) [@Benli](https://discuss.elastic.co/u/Benli)\
**Post date:** [August 12, 2021, 3:22am UTC](https://discuss.elastic.co/t/setup-elasticsearch-cluster-result-in-two-clusers/281135/4 "2021-08-12T03:22:35Z")

</div>

OK, I fixed this issue by myself, after some research and test.  
The issue is, I enabled the service before setup the cluster.  
If you need configure cluster, you shouldn't enable service before configure.  
In my case, I should delete the content from the elasticsearch data directory.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 9, 2021, 3:23am UTC](https://discuss.elastic.co/t/setup-elasticsearch-cluster-result-in-two-clusers/281135/5 "2021-09-09T03:23:33Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
