How to add new node in elasticsearch cluster?

Here is step by step guideline to add new node in existing elasticsearch cluster.

1) Elasticsearch Installation:

Install elasticsearch in new node. Elasticsearch version should be same as existing cluster nodes. If you are not aware then you may refer my these guideline

Install Elasticsearch 5.0 on RHEL / CentOS

2) Config changes:

update your elasticsearch.yml in these section.

– Change Cluster Name

# Must be existing cluster name
cluster.name: techieroop

– Configure node name and type of the node

node.name: newnode
# If add node only as a data node. If you want to add node as master then keep this value "true"
node.master: false
node.data: true

– Configure number of shard and replicas

# Shard and replica value should be same as existing node configuration.
index.number_of_shards: 5
index.number_of_replicas: 1

– Discovery settings

This is the most important configuration. Write your master node ip or host name(in my example it is 127.0.0.2) . So that your new node can join to your master node.

# 2. Configure an initial list of master nodes in the cluster
# to perform discovery when new nodes (master or data) are started:
#
#discovery.zen.ping.unicast.hosts: ["host1", "host2:port"]
discovery.zen.ping.unicast.hosts: ['127.0.0.2']

3) Restart the Elasticsearch node.

These are the important config changes we should do while installation Elasticsearch. After the successfully installation you can check new node through Cluster API.

curl -XGET 'http://localhost:9200/_nodes'

That’s it.

(Visited 914 times, 15 visits today)