azureelk

Upgrade ELK

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

Upgrade Elasticsearch

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 non-essential indexing and perform a synced flush (optional):

      $ curl -XPOST 'http://localhost:9200/_flush/synced'
    
  • Stop the node:

      $ curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown'
      $ sudo /opt/bitnami/ctlscript.sh stop elasticsearch
    
  • Download the latest version.

  • 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
    
  • Remove the replicas:

      $ curl -XPUT 127.0.0.1:9200/_settings -d{"number_of_replicas":0}
    
  • Confirm that the node joins the cluster:

      $ curl -XGET 'http://localhost:9200/_cat/nodes'
    
  • Re-enable shard reallocation:

      $ curl -XPUT localhost:9200/_cluster/settings -d '{
          "transient" : {
              "cluster.routing.allocation.enable" : "all"
          }
      }'
    
  • Wait for the node to recover:

      $ curl -XGET 'http://localhost:9200/_cat/health'
    

Repeat the process for all remaining nodes of your cluster.

Upgrade Logstash

To upgrade Logstash, follow the steps below:

  • Stop the service:

      $ sudo /opt/bitnami/ctlscript.sh stop logstash
    
  • Download the latest version.

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

  • Backup old files:

      $ cd /opt/bitnami
      $ sudo cp logstash old_logstash
    
  • Copy files from new installation directory:

      $ sudo cp -r /tmp/new_logstash/* logstash/
    
  • Test your configuration file:

      $ logstash -t -f /opt/bitnami/logstash/pipeline/logstash.conf
    
  • Start the service again:

      $ sudo /opt/bitnami/ctlscript.sh start logstash
    

Upgrade Kibana

To upgrade Kibana, follow these steps:

  • Create a snapshot of the existing .kibana index

  • Stop the service:

      $ sudo /opt/bitnami/ctlscript.sh stop kibana
    
  • Download the latest version.

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

  • Take note of the Kibana plugins that are already installed:

      $ kibana/bin/kibana-plugin list
    
  • Backup old files:

      $ cd /opt/bitnami
      $ sudo cp kibana old_kibana
    
  • Copy files from new installation directory:

      $ sudo cp -r /tmp/new_kibana/* kibana/
    
  • Recover the kibana.yml file:

      $ cp old_kibana/config/kibana.yml kibana/config/kibana.yml
    
  • Start the service again:

      $ sudo /opt/bitnami/ctlscript.sh start kibana
    
Last modification December 21, 2022