The following article describes the process of setting up a simple two host elastic search cluster using the unicast discovery method.
This assumes you have installed two Elastic Search hosts built and you would like to configure them to work together in a simple elastic cluster.
For the purposes of this article I am going to create a cluster named MyElasticCluster which will be made up of two hosts esa.kitswebkitchen.com and esb.kitswebkitchen.com. Both hosts are able to hold data and both can be elected as masters. I am not going to use the multicast discover method.
The configuration of the cluster is very simple.
You need to edit the elasticsearch yml configuration file on each of the hosts (esa and esb)
Firstly let’s make a copy of the file to a file called elasticsearch.yml.bak for safe keeping
mv /etc/elasticsearch/config/elasticsearch.yml /etc/elasticsearch/config/elasticsearch.yml.bak
Once we have backed up we can begin editing the file so on each of the two cluster hosts lets fire up the file in vi.
We want our files to look like this:
For host esa.kitswebkitchen.com
and for host esb.kitswebkitchen.com
This should enable both hosts to function in the cluster when started. Below is an overview of the cluster with the elasticsearch head gui which we can see the two hosts appearing in the cluster.
I hope this is useful for those of you testing their first simple cluster.