# 2 nodes with the same cluster but in configured in different machines

**URL:** <https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004>\
**Category:** Elasticsearch\
**Created:** [February 17, 2016, 10:29am UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004 "2016-02-17T10:29:09Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![arianayay](https://avatars.discourse-cdn.com/v4/letter/a/f4b2a3/32.png) [@arianayay](https://discuss.elastic.co/u/arianayay)\
**Post date:** [February 17, 2016, 10:29am UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/1 "2016-02-17T10:29:09Z")

</div>

I'm about to make 2 nodes with the same cluster but each node is configured in separate elasticsearch.yml in different machines.

For the first node is in machine 1:  
[cluster.name](http://cluster.name): sql  
[node.name](http://node.name): engineering  
node.master: true  
node.data: true  
network.host: 127.0.0.3  
transport.tcp.port: 9300-9400  
http.port: 9200  
discovery.zen.ping.multicast.enabled: false  
discovery.zen.ping.unicast.hosts: ["127.0.0.3", "127.0.0.2:9200"]  
index.number\_of\_shards: 2  
index.number\_of\_replicas: 1  
network.bind\_host: 127.0.0.3  
network.publish\_host: 127.0.0.3

Second node is in second machine:  
[cluster.name](http://cluster.name): sql  
[node.name](http://node.name): team  
node.master: false  
node.data: true  
network.host: 127.0.0.2  
http.port: 9200  
transport.tcp.port: 9300-9400  
discovery.zen.ping.multicast.enabled: false  
discovery.zen.ping.unicast.hosts: [127.0.0.3","127.0.0.2:9200"]  
index.number\_of\_shards: 2  
index.number\_of\_replicas: 1  
network.bind\_host: 127.0.0.2  
network.publish\_host: 127.0.0.2

I cannot seem to connect the 2 nodes.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 17, 2016, 10:43am UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/2 "2016-02-17T10:43:23Z")

</div>

Change

```
 discovery.zen.ping.unicast.hosts: [127.0.0.3","127.0.0.2:9200"]

```

To:

```
 discovery.zen.ping.unicast.hosts: [127.0.0.3","127.0.0.2:9300"]

```

Or

```
  discovery.zen.ping.unicast.hosts: [127.0.0.3","127.0.0.2"]
```

---

<div class="post-metadata">

**Author:** ![arianayay](https://avatars.discourse-cdn.com/v4/letter/a/f4b2a3/32.png) [@arianayay](https://discuss.elastic.co/u/arianayay)\
**Post date:** [February 17, 2016, 10:56am UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/3 "2016-02-17T10:56:17Z")

</div>

![](https://us1.discourse-cdn.com/elastic/original/2X/6/697e702960dc52c9a639104f9e7e9f5fb40cfa64.PNG)

I tried running the nodes as a service in windows but I still cannot see other node although I can run my first node on its machine but node2 cannot be seen in my elasticsearch-head.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 17, 2016, 9:35pm UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/4 "2016-02-17T21:35:42Z")

</div>

You need to set it to a non-loopback address, 127.0.0.0/8 is entirely loopback.

See [Connectivity issues with a new/upgraded 2.X cluster? Read here first :)](https://discuss.elastic.co/t/connectivity-issues-with-a-new-upgraded-2-x-cluster-read-here-first/35699/7)

---

<div class="post-metadata">

**Author:** ![arianayay](https://avatars.discourse-cdn.com/v4/letter/a/f4b2a3/32.png) [@arianayay](https://discuss.elastic.co/u/arianayay)\
**Post date:** [February 18, 2016, 2:37am UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/5 "2016-02-18T02:37:24Z")

</div>

Hi Warkolm,

i need to set my master node to 127.0.0.0/8? and the other nodes I can set it to other IPs? as long as my Master node holds the nonloop back address?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 18, 2016, 2:45am UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/6 "2016-02-18T02:45:23Z")

</div>

No, they all need to be non-loopback IPs.

---

<div class="post-metadata">

**Author:** ![arianayay](https://avatars.discourse-cdn.com/v4/letter/a/f4b2a3/32.png) [@arianayay](https://discuss.elastic.co/u/arianayay)\
**Post date:** [February 18, 2016, 3:12am UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/8 "2016-02-18T03:12:07Z")

</div>

Hi Warkolm,

For the first node is in machine 1:  
[cluster.name](http://cluster.name): sql  
[node.name](http://node.name): engineering  
node.master: true  
node.data: true  
**network.host: 127.0.0.0**  
transport.tcp.port: 9300-9400  
http.port: 9200  
discovery.zen.ping.multicast.enabled: false  
**discovery.zen.ping.unicast.hosts: [?]**  
index.number\_of\_shards: 2  
index.number\_of\_replicas: 1  
**network.bind\_host: 127.0.0.0**  
**network.publish\_host: 127.0.0.0**

Second node is in second machine:  
[cluster.name](http://cluster.name): sql  
[node.name](http://node.name): team  
node.master: false  
node.data: true  
**network.host: 127.0.0.0**  
http.port: 9200  
transport.tcp.port: 9300-9400  
discovery.zen.ping.multicast.enabled: false  
**discovery.zen.ping.unicast.hosts: [?]**  
index.number\_of\_shards: 2  
index.number\_of\_replicas: 1  
**network.bind\_host: 127.0.0.0**  
**network.publish\_host: 127.0.0.0**

Are the changes correct for my nodes? what should I place for the discovery.zen.ping.unicast.host?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 18, 2016, 6:14am UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/9 "2016-02-18T06:14:24Z")

</div>

You cannot use `127.0.0.*`, at all.  
Take a read of [https://en.wikipedia.org/wiki/Localhost](https://en.wikipedia.org/wiki/Localhost)

---

<div class="post-metadata">

**Author:** ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)\
**Post date:** [February 18, 2016, 7:21am UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/10 "2016-02-18T07:21:28Z")

</div>

Please don't use 127.x.x.x as your node IP. Change both server IPs to something like 192.168.1.11 and 192.168.1.12

---

<div class="post-metadata">

**Author:** ![chalapathi](https://avatars.discourse-cdn.com/v4/letter/c/41988e/32.png) [@chalapathi](https://discuss.elastic.co/u/chalapathi)\
**Post date:** [February 19, 2016, 10:09am UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/11 "2016-02-19T10:09:43Z")

</div>

Arianayay,

Any luck on this? did you solve this issue, am on the same boat need some help.

Thanks,  
Chala.

---

<div class="post-metadata">

**Author:** ![chalapathi](https://avatars.discourse-cdn.com/v4/letter/c/41988e/32.png) [@chalapathi](https://discuss.elastic.co/u/chalapathi)\
**Post date:** [February 19, 2016, 12:03pm UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/12 "2016-02-19T12:03:01Z")

</div>

Arianayay,

Am able to fix this no known master issue, here is my .yml configuration settings

[cluster.name](http://cluster.name): hits  
[node.name](http://node.name): "node1"  
node.master: true  
node.data: true  
network.host: 127.11.11.1  
http.port : 9210  
transport.tcp.port : 9300-9400  
discovery.zen.ping.multicast.enabled: false  
discovery.zen.ping.unicast.hosts: ["127.11.11.1"]

[cluster.name](http://cluster.name): hits  
[node.name](http://node.name): "node2"  
node.master: false  
node.data: true  
network.host: 127.11.11.1  
http.port : 9211  
transport.tcp.port : 9300-9400  
discovery.zen.ping.multicast.enabled: false  
discovery.zen.ping.unicast.hosts: ["127.11.11.1"]

however am getting warnings when I index data, on master node am getting "received shard failed for [hits][0]" and on second node - "marking and sending shard failed due to [failed to create index]"

another issue when both are up and running am able to view data using [http://127.11.11.1:9210](http://127.11.11.1:9210) and [http://127.11.11.1:9211](http://127.11.11.1:9211), but when the master node is down the second node fails to displays data with reason "all shards failed".

How to create copy of data to second node?  
If I create replicas of shards how to map them to store it like - master node shard's replica on second node so that i will read data even the master fails

finally why the second node is not becoming as master on its own when master node is down? is 2.1.1 is not supporting this? Please help me.

Thanks,  
Chala

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 19, 2016, 11:09pm UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/13 "2016-02-19T23:09:18Z")

</div>

@chalapathi it'd be better if you started your own thread please.

---

<div class="post-metadata">

**Author:** ![chalapathi](https://avatars.discourse-cdn.com/v4/letter/c/41988e/32.png) [@chalapathi](https://discuss.elastic.co/u/chalapathi)\
**Post date:** [February 20, 2016, 5:24am UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/14 "2016-02-20T05:24:20Z")

</div>

Sure, Thanks Warkolm

---

<div class="post-metadata">

**Author:** ![Python\_Coder](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@Python\_Coder](https://discuss.elastic.co/u/Python_Coder)\
**Post date:** [February 20, 2016, 9:43am UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/15 "2016-02-20T09:43:57Z")

</div>

definetaly true

---

<div class="post-metadata">

**Author:** ![Python\_Coder](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@Python\_Coder](https://discuss.elastic.co/u/Python_Coder)\
**Post date:** [February 20, 2016, 9:49am UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/16 "2016-02-20T09:49:10Z")

</div>

Since both ES are on different machines, both must bind on an non-loopback valid IP address, and for the copy of data, you can either use curl and change settings to the following:

> PUT /my\_index/\_settings  
> {  
> "number\_of\_replicas": 2  
> }

or change the number\_of\_replicas directive on elasticsearch.yml config file:

> number\_of\_replicas: 2

---

<div class="post-metadata">

**Author:** ![arianayay](https://avatars.discourse-cdn.com/v4/letter/a/f4b2a3/32.png) [@arianayay](https://discuss.elastic.co/u/arianayay)\
**Post date:** [February 22, 2016, 6:49am UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/17 "2016-02-22T06:49:52Z")

</div>

Hi I already solved this issue. They're correct use the **IP of the server** do not initiate any IP but use the one in your own machine/server and it will work accordingly.

---

<div class="post-metadata">

**Author:** ![Santhosh\_Devadiga](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@Santhosh\_Devadiga](https://discuss.elastic.co/u/Santhosh_Devadiga)\
**Post date:** [May 4, 2017, 2:42pm UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/18 "2017-05-04T14:42:24Z")

</div>

Hi  
We have one code base to connect elastic search (localhost:9200). We deployed this code on two different boxes under load balancing server. In this case, how to configure ES in 2 different machines to connect ES and index should reflect both sides.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 4, 2017, 9:58pm UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/19 "2017-05-04T21:58:38Z")

</div>

Please start your own thread, this one is very old.

---

<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:** [July 5, 2017, 10:00pm UTC](https://discuss.elastic.co/t/2-nodes-with-the-same-cluster-but-in-configured-in-different-machines/42004/20 "2017-07-05T22:00:34Z")

</div>


