How to add another node to existingt cluster

HI,

I have already one under cluster.Now i would like to add one more to the same cluster.I have made few changes in .yml file.but still new node is not added.Please find .yml file below;

NOTE: Elasticsearch comes with reasonable defaults for most settings.

Before you set out to tweak and tune the configuration, make sure you

understand what are you trying to accomplish and the consequences.

The primary way of configuring a node is via this file. This template lists

the most important settings you may want to configure for a production cluster.

Please consult the documentation for further information on configuration options:

https://www.elastic.co/guide/en/elasticsearch/reference/index.html

---------------------------------- Cluster -----------------------------------

Use a descriptive name for your cluster:

cluster.name: Elasticsearch

------------------------------------ Node ------------------------------------

Use a descriptive name for the node:

node.name: shyamala ponnada
node.master: true
node.data: true

Add custom attributes to the node:

#node.attr.rack: r1

Use a descriptive name for the node:

node.name: Production
node.master: true
node.data: false

Add custom attributes to the node:

#node.attr.rack: r2

----------------------------------- Paths ------------------------------------

Path to directory where to store the data (separate multiple locations by comma):

#path.data: /path/to/data

Path to log files:

#path.logs: /path/to/logs

----------------------------------- Memory -----------------------------------

Lock the memory on startup:

bootstrap.memory_lock: true

Make sure that the heap size is set to about half the memory available

on the system and that the owner of the process is allowed to use this

limit.

Elasticsearch performs poorly when the system is swapping the memory.

---------------------------------- Network -----------------------------------

Set the bind address to a specific IP (IPv4 or IPv6):

network.host: 10.225.34.36

Set a custom port for HTTP:

http.port: 9200

For more information, consult the network module documentation.

--------------------------------- Discovery ----------------------------------

Pass an initial list of hosts to perform discovery when new node is started:

The default list of hosts is ["127.0.0.1", "[::1]"]

#discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["shyamala ponnada","Production"]

Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):

#discovery.zen.minimum_master_nodes: 3

For more information, consult the zen discovery module documentation.

---------------------------------- Gateway -----------------------------------

Block initial recovery after a full cluster restart until N nodes are started:

#gateway.recover_after_nodes: 3

For more information, consult the gateway module documentation.

---------------------------------- Various -----------------------------------

Require explicit names when deleting indices:

#action.destructive_requires_name: true

----------------------------COR request--------------------------

http.cors.enabled : true
http.cors.allow-origin : "*"
http.cors.allow-methods : OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers : X-Requested-With,X-Auth-Token,Content-Type, Content-Length

Please let me i have configured correctly or not.

Thanks
Shyamala

Please format your code using </> icon as explained in this guide. It will make your post more readable.

Or use markdown style like:

```
CODE
```

HI David,

Sorry for the inconvenience

Please find the code for config.yml file..i am not sure how to mention two nodes details in one config file
shall i maintain two config files for two nodes?

======================== Elasticsearch Configuration =========================

</> ---------------------------------- Cluster -----------------------------------
</>
</> Use a descriptive name for your cluster:
</>
cluster.name: Elasticsearch
</>
</> ------------------------------------ Node1 ------------------------------------
</>
</> Use a descriptive name for the node:
</>
node.name: shyamala ponnada
node.master: true
node.data: true
</>
</> Add custom attributes to the node:
</>
</>node.attr.rack: r1
</>
</> ------------------------------------ Node2 ------------------------------------
</>
node.name: Production
node.master: true
node.data: false
</>
</> Add custom attributes to the node:
</>
</>node.attr.rack: r2
</>
</> ----------------------------------- Paths ------------------------------------
</>
</> Path to directory where to store the data (separate multiple locations by comma):
</>
</>path.data: /path/to/data
</>
</> Path to log files:
</>
</>path.logs: /path/to/logs
</>
</> ----------------------------------- Memory -----------------------------------
</>
</> Lock the memory on startup:
</>
</> bootstrap.memory_lock: true
</>
</> Make sure that the heap size is set to about half the memory available
</> on the system and that the owner of the process is allowed to use this
</> limit.
</>
</> Elasticsearch performs poorly when the system is swapping the memory.
</>
</> ---------------------------------- Network -----------------------------------
</>
</> Set the bind address to a specific IP (IPv4 or IPv6):
</>
network.host: 10.225.34.36
</>
</> Set a custom port for HTTP:
</>
http.port: 9200
</>
</> For more information, consult the network module documentation.
</>
</> --------------------------------- Discovery ----------------------------------
</>
</> Pass an initial list of hosts to perform discovery when new node is started:
</> The default list of hosts is ["127.0.0.1", "[::1]"]
</>
</>discovery.zen.ping.multicast.enabled: false

discovery.zen.ping.unicast.hosts: ["shyamala ponnada","Production"]

</>
</> Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
</>
</>discovery.zen.minimum_master_nodes: 3
</>
</> For more information, consult the zen discovery module documentation.
</>
</> ---------------------------------- Gateway -----------------------------------
</>
</> Block initial recovery after a full cluster restart until N nodes are started:
</>
</>gateway.recover_after_nodes: 3
</>
</> For more information, consult the gateway module documentation.
</>
</> ---------------------------------- Various -----------------------------------
</>
</> Require explicit names when deleting indices:
</>
</>action.destructive_requires_name: true

</> ----------------------------COR request--------------------------
http.cors.enabled : true
http.cors.allow-origin : "*"
http.cors.allow-methods : OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers : X-Requested-With,X-Auth-Token,Content-Type, Content-Length

Thanks
shyamala

Please format your code.

# Use a descriptive na# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your `cluster`:
#
cluster.name: Elasticsearch
#
# ------------------------------------ Node ------------------------------------
#me for the node:
#
node.name: shyamala ponnada
node.master: true
node.data: true
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# Use a descriptive name for the node:
#
node.name: Production
node.master: true
node.data: false
#
# Add custom attributes to the node:
#
#node.attr.rack: r2
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
# bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 10.225.34.36
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["shyamala ponnada","Production"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes: 3
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

# ----------------------------COR request--------------------------
http.cors.enabled : true
http.cors.allow-origin : "*"
http.cors.allow-methods : OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers : X-Requested-With,X-Auth-Token,Content-Type, Content-Length

Please suggest me whether i am following correct path to add another node under same cluster

Lot of things are wrong in your settings;

  • Multiple definitions of node.xxx attributes
  • unicast list of nodes does not refer to IP or hostnames

Please remove all the commented lines as they are useless here. It will make your posts more clear.

I have given the node names for **discovery.zen.ping.unicast.hosts** and i have mentioned multiple definitions for nodes as we are having two nodes 

-------------------------------------Cluster-------------------

cluster.name: Elasticsearch

------------------------------------ Node 1------------------------------------

node.name: shyamala ponnada
node.master: true
node.data: true

------------------------------------ Node 2------------------------------------


node.name: Production
node.master: true
node.data: false

---------------------------------- Network -----------------------------------

network.host: 10.225.34.36
http.port: 9200

--------------------------------- Discovery ----------------------------------

discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["shyamala ponnada","Production"]

As I said, this is wrong.

Please read the guide and just modify settings you know you need to modify.

Don't add duplicate settings.

Each node has its own config file.

To create another node under the same cluster, start another instance of elasticsearch just like you did for first node and give the same cluster name. When you check the health status you can see number of nodes 2.

Another instance means shall i add another config file or again i need to install elasticsearch ?

In production, you don't want to run 2 nodes on the same physical machine. So that speaks for itself.

In dev, then you can just start a new instance (assuming you did not touch any default settings) by just running locally:

bin/elasticsearch

You can run OOTB up to 5 nodes locally IIRC.

Thanks for reply David!!!!

I having one doubt.
I have only one linux server, in that i have installed Elasticsearch and created one node1 and successfully able to send data of QA.Now i want to create node2 in the same linux server and under same cluster and would like send PROD data to second node.So how can i approach?

Please help me out?

Then you need to create 2 different clusters.

bin/elasticsearch -Ecluster.name=qa

and

bin/elasticsearch -Ecluster.name=prod

Both nodes won't see each others.
You can always use reindex from remote or snapshot/restore if you want to move data between them.

Thanks for reply David!!!!!

I have installed Elastic search through RPM.As of now i have created two instances of ES is running but when i check for count of nodes its showing only one node.I have given different port number in 2nd instance of ES.when i look for the status of Elasticsearch2(second instance of ES)i am getting below message.

[root@LOUSSPLQS10 share]# service elasticsearch2 status
â elasticsearch2.service - LSB: This service manages the elasticsearch daemon
   Loaded: loaded (/etc/rc.d/init.d/elasticsearch2; bad; vendor preset: disabled)
   Active: active (exited) since Thu 2017-08-03 14:16:16 EDT; 25min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1789 ExecStop=/etc/rc.d/init.d/elasticsearch2 stop (code=exited, status=0/SUCCESS)
  Process: 1793 ExecStart=/etc/rc.d/init.d/elasticsearch2 start (code=exited, status=0/SUCCESS)

Aug 03 14:16:10 LOUSSPLQS10.rsc.humad.com systemd[1]: Starting LSB: This service manages the elasticsearch daemon...
Aug 03 14:16:11 LOUSSPLQS10.rsc.humad.com runuser[1797]: pam_limits(runuser:session): invalid line 'elasticsearch nofile 65536' - skipped
Aug 03 14:16:11 LOUSSPLQS10.rsc.humad.com runuser[1797]: pam_unix(runuser:session): session opened for user elasticsearch by (uid=0)
Aug 03 14:16:16 LOUSSPLQS10.rsc.humad.com elasticsearch2[1793]: Starting elasticsearch:(node 2)[  OK  ]
Aug 03 14:16:16 LOUSSPLQS10.rsc.humad.com elasticsearch2[1793]: touch: cannot touch â/var/lock/subsys/elasticsearch/2â: No such file or directory
Aug 03 14:16:16 LOUSSPLQS10.rsc.humad.com systemd[1]: Started LSB: This service manages the elasticsearch daemon.

Please help me!!!!!

Thanks
Shyamala

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.