Upgrading and Moving Elasticsearch from one machine to another

  • KM03241447
  • 06-Sep-2018
  • 09-Oct-2019

Summary

Elasticsearch is a required component of ALM Octane. This document provided as a service and gives instructions on moving Elasticsearch assets from one machine to another when upgrade not performed “in place” but rather new version installed on the new machine.

Question

This article provides the steps for moving Elasticsearch data from the existing Elasticsearch environment on version 2.4.x on one machine to the newly installed Elasticsearch 5.6.x on another machine.

Elasticsearch is a required database component for ALM Octane. Elasticsearch version 5.6.x is required for ALM Octane 12.55.25 and later.

 

This article is relevant for ALM Octane 12.60.4 and above.

 

Answer

Please perform backup (take snapshot) of the current Elasticsearch data prior to moving any assets from one machine to another.

Prerequisites

Install Elasticsearch on a new machine according to the KM02494295

Both old and new Elasticsearch environments should be up and running before the migration.

Migration Steps

  1. On the new Elasticsearch machine, add new parameter to the elasticsearch.yml

(Linux: /etc/elasticsearch/elasticsearch.yml, Windows: %ES_HOME% \config/elasticsearch.yml)

reindex.remote.whitelist: 'MyOldElasticMachine:9200'

  1. Restart Elasticsearch
     
  2. Stop Octane service if it is still running
     
  3. Change the Elasticsearch configuration in the setup.xml file:

<Octane Installation folder>/conf/setup.xml

Update the elastic host parameter to new one: <elasticHost>NewElasticHost</elasticHost>

if cluster name changed, please update as follows: <elasticClusterName>NewClusterName</elasticClusterName>

Elasticsearch port stays the same - 9300

  1. Get the logical name of the space from the database by executing this SQL query:

select sp_logical_name from <octane_site_admin schema>.shared_space

NOTE: if you have many spaces in your Octane environment, you can get multiple lines in response

  1. Octane indexes in Elasticsearch are kept in the form of mqm_<logical name>_index
  2. Run these command FOR EACH logical space name from the existing Elasticsearch to copy the index to the new Elasticsearch environment:

curl –XPOST "MyNewElasticMachine:9200/_reindex?pretty" -H 'Content-Type: application/json' -d'

{

  "source": {

    "remote": {

      "host": "http://MyOldElasticMachine:9200"

    },

    "index": "mqm_<Logical name from DB>_index"

  },

  "dest": {

    "index": "mqm_<Logical name from DB>_index"

  }

}

'

  1. Afterwards, need to configure the alias in the new Elasticsearch FOR EACH logical space name:

curl -XPOST "MyNewElasticMachine:9200/_aliases?pretty" -H 'Content-Type: application/json' -d'

{

    "actions" : [

        { "add" : { "index" : "mqm_<Logical name from DB>_index", "alias" : "mqm_<Logical name from DB>" } }

    ]

}

'

  1. Restart Octane