Elasticsearch – Add a node to cluster

If you have installed elastic cluster by RPM, chances are when the installation completed, the preconfiguration of Elasticsearch is completed, and you are in the single cluster node.

So when you install the second node, you need to remove/delete some files/directories, then join the node to the ES cluster you already had during your first node installation.

The following list you need to delete or comment before you can add the second node to cluster

  1. Remove all keystores
    • bin/elasticsearch-keystore remove xpack.security.http.ssl.keystore.secure_password
    • bin/elasticsearch-keystore remove xpack.security.transport.ssl.keystore.secure_password
    • bin/elasticsearch-keystore remove xpack.security.transport.ssl.truststore.secure_password
  2. Remove the directory: rm -rf /var/lib/elasticsearch/*
  3. Make sure the following direcotory ownership
    • chown -R elasticsearch /var/lib/elasticsearch
    • chown -R elasticsearch /etc/elasticsearch
    • chown -R elasticsearch /var/log/elasticsearch
  4. Comment all xpack line in elasticsearch.yml

Now you can use elasticsearch-reconfigure-node –enrollment-token to join the cluster.

This entry was posted in shell. Bookmark the permalink.

Leave a comment