Elasticsearch slave and master node

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?

1 Like

You should not do that.

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

@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?

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

@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?

Hi Greentea,

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!

@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

As said here:

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:

Hope it help.

@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

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/client/curator/4.2/cli.html

@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"]

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.
:evergreen_tree:

Thank you so much!
It works!

1 Like

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