Elasticsearch multiple instances and head (plugin) familiarization

Phase 01 — Introduction to Elasticsearch — Blog 05

Arun Mohan
elasticsearch
3 min readDec 9, 2017

--

Introduction

This is a short, optional blog to the elasticsearch introduction series. This blog contains two parts

  1. Installation of multiple elasticsearch instances in your system
  2. video blog to various operations, using the plugin elasticsearch-head

1. Running Multiple instances

Elasticsearch comes in different versions, from the latest 6.0 to the oldest ones. So it is a common scenario that we use different versions for different porjects. It might be very handy to know how to use different versions of elasticsearch in a single system, so that we can try and test the queries and other for different versions simultaneously and thus save a lot of time.

Sample setup

In this blog we will set up two instances of Elasticsearch, the first one being version 5.4.0 and the second one being 2.4.0, and run them simultaneously. I will be assigning the default port 9540 to the 5.4.0 version and for the version 2.4.0 let us assign the port 9240.

Step 1 — download the zip file installations

So for these kind of developer friendly installation of mulitple instances, the better practice is two download the zip file installations of elasticsearch.

For 5.4.0 the zip file for installation can be downloaded from here

For 2.4.0 the zip file for installation can be downloaded from here

After downloading the zip files for both the versions, extract the zip files to corresponding folders.

Step 2 — Edit the config files

In the zip file installations the config file (elasticsearch.yml) is located inside the config folder like below:

For 2.4.0 /elasticsearch-2.4.0/config/elasticsearch.yml

Similarly, for 5.4.0 /elasticsearch-5.4.0/config/elasticsearch.yml

Now edit the config file for both like below:

In the above picture, you can see the port information is changed in the parameter “http.port” (boxes labelled 1).

The boxes labelled 2 are general settings which will prevent the CORS issue from occurring when we run the elasticsearch-head or point any other UI elements to this instance.

Step — 3 Running the separate instances

Now type in the following commands from each of the extracted folders as below:

Now this will start both elasticsearch versions on the respective ports mentioned in the config file. To verify once more, we can type in the sudo netstat -ntlp command in the terminal and see the process running in the ports. The result would be as shown in the figure below:

Step 4 — Accessing

In order to access these separate instances, we can just make calls to the respective calls as shown in the below image:

2. Basic Operations in Elasticsearch head

Embedded below is a short video blog on how to perform basic CRUD operations using Elasticsearch.

Conclusion

In this blog we have seen how to run multiple elasticsearch instances on the same machine and also the basic elasticsearch CRUD operations using the plugin elasticsearch-head.

--

--