0
0
Elasticsearchquery~10 mins

Rolling upgrades in Elasticsearch - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Rolling upgrades
Start: Current Cluster Version
Select Node for Upgrade
Take Node Out of Cluster
Upgrade Node Software
Restart Node with New Version
Node Rejoins Cluster
Verify Cluster Health
Repeat for Next Node
All Nodes Upgraded
Upgrade Complete
Rolling upgrades upgrade one node at a time to keep the cluster running without downtime.
Execution Sample
Elasticsearch
PUT /_cluster/settings
{
  "transient": {
    "cluster.routing.allocation.enable": "none"
  }
}
Disables shard allocation temporarily to safely upgrade a node.
Execution Table
StepActionNode StateCluster StateResult
1Select node1 for upgradenode1 activeAll nodes activeReady to upgrade node1
2Disable shard allocationnode1 activeAllocation disabledPrevents shard movement
3Stop node1node1 stoppedCluster yellowNode1 offline, cluster still running
4Upgrade node1 softwarenode1 stoppedCluster yellowNode1 upgraded
5Start node1 with new versionnode1 active (new version)Cluster recoveringNode1 rejoins cluster
6Enable shard allocationnode1 activeAllocation enabledCluster rebalances shards
7Verify cluster healthAll nodes activeCluster greenNode1 upgrade successful
8Repeat steps 1-7 for node2node2 activeCluster greenNode2 upgraded
9Repeat steps 1-7 for node3node3 activeCluster greenNode3 upgraded
10All nodes upgradedAll nodes active (new version)Cluster greenRolling upgrade complete
💡 All nodes upgraded one by one, cluster remains available throughout
Variable Tracker
VariableStartAfter Step 3After Step 5After Step 7After Step 10
node1 stateactivestoppedactive (new version)active (new version)active (new version)
cluster allocationenableddisableddisabledenabledenabled
cluster healthgreenyellowyellowgreengreen
Key Moments - 3 Insights
Why do we disable shard allocation before stopping a node?
Disabling shard allocation (see step 2 in execution_table) prevents shards from moving around during the node upgrade, avoiding extra load and instability.
What happens to cluster health when a node is stopped?
Cluster health changes from green to yellow (step 3) because one node is offline, but the cluster remains available.
Why upgrade nodes one at a time instead of all at once?
Upgrading one node at a time (steps 1-9) keeps the cluster running and avoids downtime, ensuring continuous availability.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the cluster health after stopping node1 (step 3)?
Agreen
Byellow
Cred
Dunknown
💡 Hint
Check the 'Cluster State' column at step 3 in the execution_table.
At which step is shard allocation re-enabled during the upgrade of node1?
AStep 2
BStep 4
CStep 6
DStep 8
💡 Hint
Look for 'Enable shard allocation' action in the execution_table.
If shard allocation was not disabled before stopping a node, what would likely happen?
AShards would move causing extra load and instability
BCluster health would remain green
CNode would upgrade faster
DNothing changes
💡 Hint
Refer to the key_moments explanation about disabling shard allocation.
Concept Snapshot
Rolling upgrades upgrade one node at a time.
Disable shard allocation before stopping a node.
Stop, upgrade, restart node with new version.
Re-enable allocation and verify cluster health.
Repeat for each node until all upgraded.
Cluster stays available during the process.
Full Transcript
Rolling upgrades in Elasticsearch mean upgrading nodes one by one to keep the cluster running without downtime. The process starts by disabling shard allocation to prevent shards from moving during the upgrade. Then, a node is stopped, upgraded, and restarted with the new version. After the node rejoins the cluster, shard allocation is re-enabled and cluster health is checked. This process repeats for each node until all nodes are upgraded. Cluster health may temporarily degrade but remains available throughout. This method avoids downtime and keeps data safe.