Simple configuration of a two host ElasticSearch Cluster


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.

Proposed Scenario

For the purposes of this article I am going to create a cluster named MyElasticCluster which will be made up of two hosts and 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.

vi /etc/elasticsearch/config/elasticsearch.yml

We want our files to look like this:

For host OurCluster "esa" false [""]

and for host OurCluster "esb" false [""]

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.

Comments are closed.