elasticsearch full cluster restart upgrade

Full cluster restart upgrade

  1. Disable shard allocation

    1
    2
    3
    4
    5
    6
    curl -XPUT 'localhost:9200/_cluster/settings?pretty' -d'
    {
    "persistent": {
    "cluster.routing.allocation.enable": "none"
    }
    }'
  2. Perform a synced flush

    1
    curl -XPOST 'localhost:9200/_flush/synced?pretty'
  3. Shutdown and upgrade all nodes

    1
    Stop all Elasticsearch services on all nodes in the cluster
  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 cluster

    1
    2
    3
    If you have dedicated master nodes — nodes with node.master set to true(the default) and node.data set to false —  then it is a good idea to start them first.
    curl -XGET 'localhost:9200/_cat/health?pretty'
    curl -XGET 'localhost:9200/_cat/nodes?pretty'
  6. Wait for yellow

    1
    As soon as each node has joined the cluster, it will start to recover any primary shards that are stored locally.
  7. Reenable allocation

    1
    2
    3
    4
    5
    6
    7
    8
    9
    curl -XPUT 'localhost:9200/_cluster/settings?pretty' -d'
    {
    "persistent": {
    "cluster.routing.allocation.enable": "all"
    }
    }'

    curl -XGET 'localhost:9200/_cat/health?pretty'
    curl -XGET 'localhost:9200/_cat/recovery?pretty'