elasticsearch rolling upgrades

ES Rolling upgrades

  1. Disable shard allocation

    1
    2
    3
    4
    5
    6
    curl -XPUT 'localhost:9200/_cluster/settings?pretty' -d'
    {
    "transient": {
    "cluster.routing.allocation.enable": "none"
    }
    }'
  2. Stop non-essential indexing and perform a synced flush (Optional)

    1
    curl -XPOST 'localhost:9200/_flush/synced?pretty'
  3. Stop and upgrade a single node

    1
    2
    3
    4
    To 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.
  4. Upgrade any plugins

    1
    2
    Elasticsearch plugins must be upgraded when upgrading a node.
    Use the elasticsearch-plugin script to install the correct version of any plugins that you need.
  5. Start the upgraded node

    1
    2
    Start 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'
  6. Reenable shard allocation

    1
    2
    3
    4
    5
    6
    curl -XPUT 'localhost:9200/_cluster/settings?pretty' -d'
    {
    "transient": {
    "cluster.routing.allocation.enable": "all"
    }
    }'
  7. Wait for the node to recover

    1
    2
    3
    4
    5
    6
    7
    8
    You 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.
  8. Repeat

    1
    When the cluster is stable and the node has recovered, repeat the above steps for all remaining nodes.