Would you like to learn how to do an ElasticSearch cluster installation on Ubuntu Linux? In this tutorial, we are going to show you how to install an ElasticSearch cluster on a computer running Ubuntu Linux.

• Ubuntu 20
• Ubuntu 19
• Ubuntu 18
• ElasticSearch 7.7.0

In our example, The ElastiSearch node 01 IP address is 192.168.100.9.

In our example, The ElastiSearch node 02 IP address is 192.168.100.10.

Tutorial ElasticSearch – Cluster installation

Use apt-get to install the required packages.

Copy to Clipboard

Download and install the ElasticSearch repository key.

Copy to Clipboard

Add the official ElasticSearch repository to your APT database

Copy to Clipboard

Update the APT-GET database and install the ElasticSearch package.

Copy to Clipboard

Repeat these steps on all nodes of the ElasticSearch cluster.

Tutorial ElasticSearch – Cluster Configuration on Node 01

Set a hostname using the hostnamectl command.

Copy to Clipboard

Stop the ElasticSearch service.

Copy to Clipboard

Edit the ElasticSearch configuration file named: elasticsearch.yml

Copy to Clipboard

Add the following lines at the end of the file.

Copy to Clipboard

Here is the file with our configuration.

Copy to Clipboard

In our example, we created and ElasticSearch cluster named: POWER-CLUSTER-01.

In our example, we set this node to be named as ElasticSearch-01.

In our example, we set the following master-eligible nodes: 192.168.100.9 and 192.168.100.10

Start the ElasticSearch service.

Copy to Clipboard

Verify the ElasticSearch cluster health status.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Congratulations! You have finished the configuration of the ElasticSearch cluster first node.

Tutorial ElasticSearch – Cluster Configuration on Node 02

Set a hostname using the hostnamectl command.

Copy to Clipboard

Stop the ElasticSearch service.

Copy to Clipboard

Edit the ElasticSearch configuration file named: elasticsearch.yml

Copy to Clipboard

Add the following lines at the end of the file.

Copy to Clipboard

Here is the file with our configuration.

Copy to Clipboard

In our example, we created and ElasticSearch cluster named: POWER-CLUSTER-01.

In our example, we set this node to be named as ElasticSearch-02.

In our example, we set the following master-eligible nodes: 192.168.100.9 and 192.168.100.10

Start the ElasticSearch service.

Copy to Clipboard

Verify the ElasticSearch cluster health status.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

In our example, the ElasticSearch cluster status is green.

In our example, the ElasticSearch cluster number of nodes is 2.

Congratulations! You have finished the configuration of the ElasticSearch cluster.

Tutorial ElasticSearch – Testing the Cluster

Create an ElasticSearch index on the first node of the cluster.

Copy to Clipboard

Add some information to this ElasticSearch index.

Copy to Clipboard

List the information inside this ElasticSearch index.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Request the same information from the second ElasticSearch node.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Both ElasticSearch nodes have the same information.