Adding New Nodes to an Elasticsearch Cluster

This section explains how to add a new node to an Elasticsearch cluster. You can add nodes to a cluster by configuring new nodes to find an existing cluster and start them up.

For example, consider that a new node, node 4, is added to a cluster that already has three nodes in it namely, node1, node2, and node3.

To add new node to a cluster

  1. Open elasticsearch.yml located at InstallDir//config, where the new node is being added.
    The following configuration is a sample of how the configuration appears initially.
    cluster.name:"SAG_EventDataStore"
    node.name: node4
    path.logs: InstallDir/logs
    network.host:0.0.0.0
    http.port:9240
    discovery.seed_hosts: ["node4:9340"]
    transport.port:9340
    path.repo:['InstallDir/archives']
    cluster.initial_master_nodes:["node4"]
    xpack.ml.enabled: false
    xpack.security.enabled: false
    xpack.security.transport.ssl.enabled: false
    xpack.security.http.ssl.enabled: false
    action.destructive_requires_name: false
  2. Provide the name of the node, as seen in the node.name property, and port number used by the node, as seen in the http.port property, in the discovery.seed_hosts property in the following format:
    host_name:port_name
    For example
    node4:9340
    Sample configuration after providing the new node details:
    cluster.name:"SAG_EventDataStore"
    cluster.initial_master_nodes:["node1","node2","node3"]
    node.name: node4
    path.logs: InstallDir/logs
    network.host:0.0.0.0
    http.port:9240
    discovery.seed_hosts: ["node1:9340","node2:9340","node3":"9340","node4:9340"]
    transport.port:9340
    path.repo:['InstallDir/archives']
    xpack.ml.enabled: false
    xpack.security.enabled: false
    xpack.security.transport.ssl.enabled: false
    xpack.security.http.ssl.enabled: false
    action.destructive_requires_name: false
  3. Save the configuration. The new node is added to the cluster.
    Note: When you restart an Elasticsearch cluster, you must restart the master node first.

If you want to remove a node from a cluster do the following:

  1. Open the elasticsearch.yml file located at Install_Dir/config/.
  2. Remove the node listed in the format host_name:port_name in the discovery.seed_hosts property.
  3. Save the elasticsearch.yml file and restart the Elasticsearch cluster. The specified node is now removed from the cluster.