virtualMachineelasticsearch

Upgrade Elasticsearch

NOTE: It’s highly recommended to perform a backup before any upgrade.

Since version 0.90.7, Elasticsearch supports rolling upgrades. As a result, it’s not necessary to stop the entire cluster during the upgrade process. Instead, it is possible to upgrade one node at a time and keep the rest of the cluster operating normally.

To upgrade a node, follow the steps below:

  • Disable shard reallocation using the command below:

      $ curl -XPUT localhost:9200/_cluster/settings -d '{
          "transient" : {
              "cluster.routing.allocation.enable" : "none"
          }
      }'
    
  • Stop the node:

      $ sudo /opt/bitnami/ctlscript.sh stop elasticsearch
    
  • Download the latest version from [elastic.co] (https://www.elastic.co/)

  • Extract to a new directory (not overwriting the current installation) - for example, /tmp/new_elasticsearch.

  • Rename old files:

      $ cd /opt/bitnami
      $ sudo mv elasticsearch/bin elasticsearch/old_bin
      $ sudo mv elasticsearch/lib elasticsearch/old_lib
      $ sudo mv elasticsearch/modules elasticsearch/old_modules
    
  • Copy files from new installation directory:

      $ sudo cp -r /tmp/new_elasticsearch/bin elasticsearch/bin
      $ sudo cp -r /tmp/new_elasticsearch/lib elasticsearch/lib
      $ sudo cp -r /tmp/new_elasticsearch/modules elasticsearch/modules
    
  • Start the node again:

      $ sudo /opt/bitnami/ctlscript.sh start elasticsearch
    
  • Re-enable shard reallocation:

      $ curl -XPUT localhost:9200/_cluster/settings -d '{
          "transient" : {
              "cluster.routing.allocation.enable" : "all"
          }
      }'
    

Repeat the process for all remaining nodes of your cluster.

Last modification December 21, 2022