Friday 20 October 2023

Elastic search create a new node in a cluster

To create a new node in an Elasticsearch cluster, you can follow these steps:

  1. Install Elasticsearch on the new node.
  2. Configure the new node to join the existing cluster.
  3. Start Elasticsearch on the new node.

1. Install Elasticsearch on the new node

To install Elasticsearch on the new node, you can download the latest version from the Elasticsearch website. Once you have downloaded the installation package, you can follow the instructions in the installation guide to install Elasticsearch.

2. Configure the new node to join the existing cluster

To configure the new node to join the existing cluster, you need to edit the elasticsearch.yml file on the new node. In the elasticsearch.yml file, set the following properties:

  • cluster.name: The name of the Elasticsearch cluster.
  • discovery.seed_hosts: A list of the IP addresses and ports of the existing nodes in the cluster.

For example, if the existing cluster has two nodes with the IP addresses 192.168.1.100 and 192.168.1.101, you would set the discovery.seed_hosts property to the following value:

discovery.seed_hosts: ["192.168.1.100:9200", "192.168.1.101:9200"]

3. Start Elasticsearch on the new node

Once you have configured the new node, you can start Elasticsearch by running the following command:

elasticsearch

This will start Elasticsearch on the new node and it will automatically join the existing cluster.

Once the new node has joined the cluster, you can verify that it is connected by running the following command:

curl -XGET 'http://localhost:9200/_cat/nodes'

This will return a list of all the nodes in the cluster, including the new node.

Additional tips

  • If you are using a cloud-based Elasticsearch service, such as Amazon Elasticsearch Service (AES) or Elasticsearch Service on Google Cloud Platform (GCP), you can usually add new nodes to your cluster using the management console for the service.
  • If you are adding a new node to a cluster that is running in production, it is a good practice to do so during a maintenance window. This will help to minimize any disruption to your users.
  • Once you have added a new node to your cluster, you should monitor the cluster to ensure that the new node is healthy and that it is performing well.

No comments:

Post a Comment