# Elasticsearch slave and master node

**URL:** <https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990>\
**Category:** Elasticsearch\
**Created:** [March 17, 2017, 9:38am UTC](https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990 "2017-03-17T09:38:06Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greentea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greentea/32/15924_2.png) [@Greentea](https://discuss.elastic.co/u/Greentea)\
**Post date:** [March 17, 2017, 9:38am UTC](https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990/1 "2017-03-17T09:38:06Z")

</div>

Hi!  
I am try to apply a two server in elasticsearch one as master and data node, another as data node.  
Here is the yml file

For master (IP:10.96.195.250)

```
cluster.name: project
node.name: test0
node.master: true
node.data: true
node.ingest: true
network.host: 0.0.0.0

```

For date node (IP:10.96.195.249)

```
cluster.name: project
node.name: test1
node.master: false
node.data: true
node.ingest: false
network.host: 0.0.0.0

```

can some one tell me how to set the node so that it can provide the slave function?

---

<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:** [March 17, 2017, 10:01am UTC](https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990/2 "2017-03-17T10:01:41Z")

</div>

You should not do that.

Keep all default values and you will be fine.  
Add a 3rd node to avoid split brain issues.

---

<div class="post-metadata">

**Author:** ![Greentea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greentea/32/15924_2.png) [@Greentea](https://discuss.elastic.co/u/Greentea)\
**Post date:** [March 17, 2017, 10:12am UTC](https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990/3 "2017-03-17T10:12:36Z")

</div>

@dadoonet thank you for your reply  
what do you mean of "default values", if i use default value, how can i make the connection between master and slave?

---

<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:** [March 17, 2017, 10:26am UTC](https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990/4 "2017-03-17T10:26:02Z")

</div>

There is no such a master / slave thing in elasticsearch.

To make sure your nodes talk to each others, set `discovery.zen.ping.unicast.hosts`.

See [https://www.elastic.co/guide/en/elasticsearch/reference/5.2/modules-discovery-zen.html#modules-discovery-zen](https://www.elastic.co/guide/en/elasticsearch/reference/5.2/modules-discovery-zen.html#modules-discovery-zen)

---

<div class="post-metadata">

**Author:** ![Greentea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greentea/32/15924_2.png) [@Greentea](https://discuss.elastic.co/u/Greentea)\
**Post date:** [March 22, 2017, 1:56am UTC](https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990/5 "2017-03-22T01:56:41Z")

</div>

@dadoonet thank you for replying me  
I wrote

```
discovery.zen.ping.unicast.hosts: ["127.0.0.1","10.96.195.250:9300"] 

```

in data node yml file

and

```
discovery.zen.ping.unicast.hosts: ["127.0.0.1", "10.96.195.249:9300"]

```

in master node.

Do you know how can I make sure nodes is talking to each other? and the data node copy master index?

---

<div class="post-metadata">

**Author:** ![gabriel\_tessier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabriel_tessier/32/27911_2.png) [@gabriel\_tessier](https://discuss.elastic.co/u/gabriel_tessier)\
**Post date:** [March 22, 2017, 5:58am UTC](https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990/6 "2017-03-22T05:58:40Z")

</div>

Hi Greentea,

> [@Greentea](#):
>
> Do you know how can I make sure nodes is talking to each other? and the data node copy master index?

You can check in the logs vi /var/log/elasticsearch/name\_of\_your\_server.log  
Or setup admin tools like cerebro, you can find on github!

Cheers!

---

<div class="post-metadata">

**Author:** ![Greentea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greentea/32/15924_2.png) [@Greentea](https://discuss.elastic.co/u/Greentea)\
**Post date:** [March 23, 2017, 7:19am UTC](https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990/7 "2017-03-23T07:19:34Z")

</div>

@gabriel_tessier thank you for replying me  
I just successfully make two node talk to each other and it is fine to allow copying index to data node.  
Do you have any idea how can I back up index to data node and allow it reindex to master node.  
I just able to copy index from master node to master node

---

<div class="post-metadata">

**Author:** ![gabriel\_tessier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabriel_tessier/32/27911_2.png) [@gabriel\_tessier](https://discuss.elastic.co/u/gabriel_tessier)\
**Post date:** [March 23, 2017, 7:33am UTC](https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990/8 "2017-03-23T07:33:33Z")

</div>

As said here:

> [@dadoonet](#):
>
> There is no such a master / slave thing in elasticsearch.

As I understand you have 2 nodes that talk together, right?  
You want to add a third one?  
If so just do the same thing that you did for the second server on the third one and it will join!  
As said here:

> [@dadoonet](#):
>
> Add a 3rd node to avoid split brain issues.

Hope it help.

---

<div class="post-metadata">

**Author:** ![Greentea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greentea/32/15924_2.png) [@Greentea](https://discuss.elastic.co/u/Greentea)\
**Post date:** [March 23, 2017, 7:40am UTC](https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990/9 "2017-03-23T07:40:21Z")

</div>

@gabriel_tessier thank you for replying me so fast

> As I understand you have 2 nodes that talk together, right?  
> You want to add a third one?  
> If so just do the same thing that you did for the second server on the third one and it will join!

I am trying to provide a solution to prevent a situation like master node hardware damage.  
Once the master node hardware damage and the data is total lost, I want to reinstall elasticsearch and get the data from data node not from database.  
and I am trying to save the index in data node. But I only got two server

---

<div class="post-metadata">

**Author:** ![gabriel\_tessier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabriel_tessier/32/27911_2.png) [@gabriel\_tessier](https://discuss.elastic.co/u/gabriel_tessier)\
**Post date:** [March 23, 2017, 7:46am UTC](https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990/10 "2017-03-23T07:46:04Z")

</div>

If you have 3 servers (not 2 because of the split brain) and 1 server die you still have the two other one so elastic is still running!  
Then just start an empty server and it will join and replace the dead one!

I don't really get your problem but if you have only one server and you want to recover from backup instead of reindexing data from database so you can use snapshot with curator.  
[https://www.elastic.co/guide/en/elasticsearch/reference/5.2/modules-snapshots.html#\_snapshot](https://www.elastic.co/guide/en/elasticsearch/reference/5.2/modules-snapshots.html#_snapshot)  
[https://www.elastic.co/guide/en/elasticsearch/client/curator/4.2/cli.html](https://www.elastic.co/guide/en/elasticsearch/client/curator/4.2/cli.html)

---

<div class="post-metadata">

**Author:** ![Greentea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greentea/32/15924_2.png) [@Greentea](https://discuss.elastic.co/u/Greentea)\
**Post date:** [March 23, 2017, 8:32am UTC](https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990/11 "2017-03-23T08:32:43Z")

</div>

@gabriel_tessier thank you for your suggestion  
I tried to use the snapshot.  
But I am not able to set the path.repo  
I created a directory call backup in the path /root/backup  
and I tried to chmod and chown for elasticsearch.

But it is still can not access the path.repo like

```
path.repo: ["/root/backup"]
```

---

<div class="post-metadata">

**Author:** ![gabriel\_tessier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabriel_tessier/32/27911_2.png) [@gabriel\_tessier](https://discuss.elastic.co/u/gabriel_tessier)\
**Post date:** [March 23, 2017, 8:48am UTC](https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990/12 "2017-03-23T08:48:08Z")

</div>

Try in a directory where elastic can write like var/log/elastic\_snapsphot there's already logs here and elastic can access!  
I'm not sure that you can write in /root.  
🌲

---

<div class="post-metadata">

**Author:** ![Greentea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greentea/32/15924_2.png) [@Greentea](https://discuss.elastic.co/u/Greentea)\
**Post date:** [March 23, 2017, 8:56am UTC](https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990/13 "2017-03-23T08:56:31Z")

</div>

Thank you so much!  
It works!

---

<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:** [April 20, 2017, 8:56am UTC](https://discuss.elastic.co/t/elasticsearch-slave-and-master-node/78990/14 "2017-04-20T08:56:51Z")

</div>

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