Monday, July 12, 2021

Install Elastic Search Cluster

Elastic search is open-source distributed search and analytics engine based on Lucene search engine. It’s completely Restful implementation and easy to use.


Elastic search is core of Elastic stack and there are many products from elastic stack.


Example demonstrating 3 nodes elastic search cluster.

 



 

Software’s and Tools



 

Windows 10

Java 1.8 or higher

Elasticsearch-7.13.3

 

 

Download and Extract



Go to elastic search download page and click on below links to download “elasticsearch-7.13.3” to your local machine.


https://www.elastic.co/downloads/elasticsearch

 

Direct download link


https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.13.3-windows-x86_64.zip


Extract downloaded elastic search zip file to local drive.




 

Elastic Search Cluster



Elastic Search Node1



Open command prompt and locate elastic search bin directory and use below start command to start elastic search Node1 in the cluster.

 

Need to provide Cluster Name, Node Name, Data and Logs path as parameters.

 

 

elasticsearch.bat -Ecluster.name=elastic-search-cluster -Enode.name=node1  -Epath.data=data1 -Epath.logs=log1

 


 



 




We can see logs in the console which confirms the elastic search startup and its ports numbers.

 




We just started first node it elected as Master Node and It uses the 9300 port for discovery in the cluster. Rest services can be accessed on 9200 port.



Elastic Search Node2



Open second command prompt and locate to elastic search bin directory and use above start command.

 

 

elasticsearch.bat -Ecluster.name=elastic-search-cluster -Enode.name=node2  -Epath.data=data2 -Epath.logs=log2

 


 



We can see logs in the console which confirms the elastic search startup and its ports numbers.

 




Node2 uses the 9301 port for discovery port in the cluster. Master node will identify the node2 and it will join in the cluster. Rest services can be accessed on 9201 port.

 

 

Node 1 Master node we can see the information that Node2 joined in the cluster.

 



 

Elastic Search Node2



Open 3rd command prompt and use below start command to stat elastic search Node3

 

 

elasticsearch.bat -Ecluster.name=elastic-search-cluster -Enode.name=node3  -Epath.data=data3 -Epath.logs=log3

 

 



Startup logs confirms the Node3 startup.




Node3 uses the 9302 port for discovery port in the cluster. Master node will identify the node3 and it will join in the cluster. Rest services can be accessed on 9202 port.


Node 1 Master node we can see the information that Node3 joined in the cluster.




 

Cluster Information



Nodes

Discovery Port

Rest Access

Node1(Master)

127.0.0.1:9300

127.0.0.1:9200

Node2

127.0.0.1:9301

127.0.0.1:9201

Node3

127.0.0.1:9302

127.0.0.1:9202

 


Node1 Rest Access


 

 

http://localhost:9200/

 

 

Access above URL and it will return JSON data which contains the node details

 



Node2 Rest Access




http://localhost:9201/


 

Access above URL and it will return JSON data which contains the node details





Node2 Rest Access




http://localhost:9202/




Access above URL and it will return JSON data which contains the node details

 




Check Cluster Health


We can use any one of below URL to check elastic cluster health.


 

http://localhost:9200/_cat/health?v

 

http://localhost:9201/_cat/health?v

 

http://localhost:9202/_cat/health?v

 

 



Now we have successfully completed setup elastic cluster. We can see node specific Data and Logs directories in the rood directory of Elastic search.

 



 

Note


We can use any node Rest access to do elastic operations like create document and search. Follow elastic search quick start guide to know more about operations.

 

References

 

https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started.html

 


Author

 

1 comment :

Recent Posts

Recent Posts Widget

Popular Posts