Elasticsearch Rolling Restart: A Step-by-Step Guide

Author

Reads 1.2K

A modern data center featuring a computer setup with monitor and keyboard, emphasizing technology infrastructure.
Credit: pexels.com, A modern data center featuring a computer setup with monitor and keyboard, emphasizing technology infrastructure.

A rolling restart is a way to update Elasticsearch nodes without disrupting the cluster. This process involves shutting down a node, updating it, and then bringing it back online.

This method is useful for maintaining high availability and minimizing downtime. By updating one node at a time, you can ensure that the cluster remains operational.

To initiate a rolling restart, you need to have the Elasticsearch cluster running in a distributed environment. The cluster should be in a state where all nodes are functioning properly.

The rolling restart process can be initiated from the Elasticsearch console or using the Elasticsearch API.

For another approach, see: Elasticsearch Cluster Health

Configuring and Managing Nodes

Configuring and managing nodes is a crucial step in the Elasticsearch rolling restart process. It's essential to make changes to configuration and prepare your cluster for a restart.

You can adjust the node_left timeout, which is set to 1 minute by default, to give yourself more time to restart your node. This setting determines how long the cluster will wait for a node to rejoin after it has left the cluster.

Credit: youtube.com, Rolling Restart of an Elasticsearch Cluster

To adjust the node_left timeout, simply change the setting from 1 minute to 5 minutes. This will give you ample time to restart your node without the cluster considering it lost and starting the data recovery process.

Disabling shard allocation is another important step in preparing your cluster for a restart. This will prevent the cluster from rebalancing data while you're restarting nodes.

Here are the steps to restart nodes without issues:

  1. Adjust “node_left” timeout
  2. Disable shard allocation
  3. Change the configuration as needed
  4. Restart the Elasticsearch node
  5. Reset the settings to default
  6. Repeat the steps

Remember to check the Elasticsearch log every time you restart the service to ensure everything is sound after configuration changes.

Resetting and Reconfiguring

Resetting and Reconfiguring is a crucial step in the Elasticsearch rolling restart process.

You should always reset the settings to default after changing configuration on the cluster level.

This ensures the Elasticsearch cluster remains highly available.

Resetting the configurations back to default is a simple process.

After restarting the Elasticsearch node successfully, you can reset all configurations.

To reset the configurations, follow the instructions provided.

The Node

Credit: youtube.com, Best Practices for Restarting an Elasticsearch Node

You can avoid issues by changing the node_left setting at the cluster level. Changing the node_left configuration setting from 1 minute to 5 minutes will usually give you ample time to restart your node.

This setting is set to 1 minute by default, which means if any Elasticsearch node leaves the cluster for over 1 minute, the cluster will consider the node lost and begin the data recovery process.

You can use any time unit you need, and don't forget to change the node_left option using the command provided. After configuration changes have been applied and nodes have been restarted, don't forget to change all settings back to their original state.

To reload your new configuration, you can restart the Elasticsearch node.

For your interest: Elasticsearch Change Mapping

Process and Procedure

To perform a rolling restart in Elasticsearch, you'll want to follow a specific process and procedure.

First, consider increasing concurrent recoveries and index recovery speed. This will help your cluster recover more efficiently.

Credit: youtube.com, EP.146-Fix service elasticsearch Not start

Next, upgrade or restart non-master eligible nodes first. This ensures that your master nodes remain available to manage the cluster.

Before restarting any nodes, disable shard allocation to prevent new shards from being allocated during the restart process.

You'll also want to stop indexing and perform a synced flush to ensure data consistency. This step is crucial to prevent data loss or corruption.

Active machine learning jobs and datafeeds should also be stopped to prevent any issues during the restart process.

If you're upgrading, shut down the node and perform the upgrade. This will ensure that the node is running with the latest version of Elasticsearch.

Once the upgrade is complete, reenable shard allocation to allow new shards to be allocated to the node.

Finally, wait for the node to recover and the cluster to go green before repeating the process for the next node.

Consider reading: Elasticsearch Shards

Cora Stoltenberg

Junior Writer

Cora Stoltenberg is a skilled writer with a passion for crafting engaging content on a wide range of topics. Her expertise spans various categories, including Search Engine Optimization (SEO) Strategies, where she provides actionable tips and insights to help businesses improve their online presence. With a keen eye for detail and a knack for simplifying complex concepts, Cora's writing is both informative and accessible to readers of all levels.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.