# Node doesn't join cluster

**URL:** <https://discuss.elastic.co/t/node-doesnt-join-cluster/232691>\
**Category:** Elasticsearch\
**Created:** [May 14, 2020, 5:38pm UTC](https://discuss.elastic.co/t/node-doesnt-join-cluster/232691 "2020-05-14T17:38:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [May 14, 2020, 5:38pm UTC](https://discuss.elastic.co/t/node-doesnt-join-cluster/232691/1 "2020-05-14T17:38:32Z")

</div>

Is there a guide on how to add new nodes to a cluster?  
Cause [this](https://www.elastic.co/guide/en/elasticsearch/reference/current/add-elasticsearch-nodes.html) ain't it.

The issue is both nodes are running, displaying no errors, but shards are not getting assigned.

Nodes in the cluster (`cluster.name: local`) have identical configurations except for `node.master: true` and `node.data: true` on the master node called `node.name: bcp.local0`.

Replica Node config:

```auto
http.port: 9202
network.host: ["0.0.0.0"]
node.name: bcp.local2
cluster.name: local
cluster.initial_master_nodes: ["bcp.local0"]

```

Cluster health:

```auto
{
    "cluster_name": "local",
    "status": "yellow",
    "timed_out": false,
    "number_of_nodes": 1,
    "number_of_data_nodes": 1,
    "active_primary_shards": 7,
    "active_shards": 7,
    "relocating_shards": 0,
    "initializing_shards": 0,
    "unassigned_shards": 1,
    "delayed_unassigned_shards": 0,
    "active_shards_percent_as_number": 87.5,
...
,
        "mydata": {
            "status": "yellow",
            "number_of_shards": 1,
            "number_of_replicas": 1,
            "active_primary_shards": 1,
            "active_shards": 1,
            "relocating_shards": 0,
            "initializing_shards": 0,
            "unassigned_shards": 1,
            "shards": {
                "0": {
                    "status": "yellow",
                    "primary_active": true,
                    "active_shards": 1,
                    "relocating_shards": 0,
                    "initializing_shards": 0,
                    "unassigned_shards": 1
                }
            }
        }
    }
}

```

What's a boy to do?

---

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [May 14, 2020, 6:12pm UTC](https://discuss.elastic.co/t/node-doesnt-join-cluster/232691/2 "2020-05-14T18:12:39Z")

</div>

Index `mydata` Settings:

```auto
                "number_of_shards": "1",
                "number_of_replicas": "1",

```

---

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [May 14, 2020, 6:40pm UTC](https://discuss.elastic.co/t/node-doesnt-join-cluster/232691/3 "2020-05-14T18:40:19Z")

</div>

I was expecting 1 shard with 1 replica to mean my primary/master node has the primary shard and the second node has the replica. Is this not the case?

I got things to green by setting number\_of\_replicas to 0 on each node but that sounds dodgy.

---

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [May 14, 2020, 6:59pm UTC](https://discuss.elastic.co/t/node-doesnt-join-cluster/232691/4 "2020-05-14T18:59:41Z")

</div>

GET /\_nodes on the "master" reveals only one node:

```auto
{
    "_nodes": {
        "total": 1,
        "successful": 1,
        "failed": 0
    },
...
            "settings": {
                "cluster": {
                    "initial_master_nodes": [
                        "bcp.local0"
                    ],
                    "name": "local",
                    "election": {
                        "strategy": "supports_voting_only"
                    }

```

---

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [May 14, 2020, 7:06pm UTC](https://discuss.elastic.co/t/node-doesnt-join-cluster/232691/5 "2020-05-14T19:06:17Z")

</div>

Trying to reroute the replicate to node2:

```auto
POST /_cluster/reroute
{
    "commands" : [
        {
          "allocate_replica" : {
                "index" : "mydata", "shard" : 1,
                "node" : "bcp.local2"
          }
        }
    ]
}

```

## Result

```auto
{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "failed to resolve [bcp.local2], no matching nodes"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "failed to resolve [bcp.local2], no matching nodes"
    },
    "status": 400
}

```

---

<div class="post-metadata">

**Author:** ![cawoodm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cawoodm/32/14083_2.png) [@cawoodm](https://discuss.elastic.co/u/cawoodm)\
**Post date:** [May 14, 2020, 7:13pm UTC](https://discuss.elastic.co/t/node-doesnt-join-cluster/232691/6 "2020-05-14T19:13:14Z")

</div>

OK, it seems to be working now.

My BIG MISTAKE was copying my `elasticsearch\` folder to create the 2nd node or - to be precise - not deleting the contents of the `data\` folder before starting the node.

So the solution was to empty the `data` directory on the new node and start it up again.

---

<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:** [June 11, 2020, 7:17pm UTC](https://discuss.elastic.co/t/node-doesnt-join-cluster/232691/7 "2020-06-11T19:17:06Z")

</div>

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