ES Rolling upgrades
Disable shard allocation
1
2
3
4
5
6curl -XPUT 'localhost:9200/_cluster/settings?pretty' -d'
{
"transient": {
"cluster.routing.allocation.enable": "none"
}
}'Stop non-essential indexing and perform a synced flush (Optional)
1
curl -XPOST 'localhost:9200/_flush/synced?pretty'
Stop and upgrade a single node
1
2
3
4To upgrade using a zip or compressed tarball:
Extract the zip or tarball to a new directory, to be sure that you don’t overwrite the config or data directories.
Either copy the files in the config directory from your old installation to your new installation, or use the -E path.conf= option on the command line to point to an external config directory.
Either copy the files in the data directory from your old installation to your new installation, or configure the location of the data directory in the config/elasticsearch.yml file, with the path.data setting.Upgrade any plugins
1
2Elasticsearch plugins must be upgraded when upgrading a node.
Use the elasticsearch-plugin script to install the correct version of any plugins that you need.Start the upgraded node
1
2Start the now upgraded node and confirm that it joins the cluster by checking the log file or by checking the output of this request:
curl -XGET 'localhost:9200/_cat/nodes?pretty'Reenable shard allocation
1
2
3
4
5
6curl -XPUT 'localhost:9200/_cluster/settings?pretty' -d'
{
"transient": {
"cluster.routing.allocation.enable": "all"
}
}'Wait for the node to recover
1
2
3
4
5
6
7
8You should wait for the cluster to finish shard allocation before upgrading the next node.
curl -XGET 'localhost:9200/_cat/health?pretty'
Wait for the status column to move from yellow to green.
Shards that have not been sync-flushed may take some time to recover.
The recovery status of individual shards can be monitored with the _cat/recovery request:
curl -XGET 'localhost:9200/_cat/recovery?pretty'
If you stopped indexing, then it is safe to resume indexing as soon as recovery has completed.Repeat
1
When the cluster is stable and the node has recovered, repeat the above steps for all remaining nodes.