×
Community Blog A Pro Guide to Upgrading to Elasticsearch 8.X

A Pro Guide to Upgrading to Elasticsearch 8.X

Here's an in-depth guide to upgrading your Elasticsearch environment to version 8.X, complete with code samples and strategic insights.

Upgrading to the latest version of Elasticsearch can feel daunting. However, with Alibaba Cloud Elasticsearch, it's a smooth transition. Here's an in-depth guide to upgrading your Elasticsearch environment to version 8.X, complete with code samples and strategic insights.

Why Upgrade to Elasticsearch 8.X?

Speed: Users love Elasticsearch for its quick search capabilities, particularly when sifting through petabytes of data.
Frequent Updates: With monthly minor releases and a major release every two years, staying current with Elasticsearch versions can be quite the task.
Security: Elasticsearch 8.X offers enhanced security features, making compliance with security protocols less of an option and more of a necessity.

Preparing for the Upgrade

Before diving into the upgrade process, it's pivotal to assess certain critical aspects:

1)Decide whether the benefits of new features and the necessity for enhanced security outweigh the potential risks and the effort involved in upgrading.

2)Plan for the upgrade and take necessary precautions like snapshots to ensure you can restore your environment if something goes awry.

Upgrading from 7.X to 8.X: A Step-by-Step Guide

Let's take a previously certified single-node cluster running version 7.13 and upgrade it to version 8.1.3.

Step 1: Upgrade from 7.13 to 7.17.5

Firstly, you need to switch to the latest 7.X version before jumping to 8.X. This ensures a smoother transition and compatibility assurance.

PUT _cluster/settings
{
  "persistent": {
    "cluster.routing.allocation.enable": "primaries"
  }
}
POST _flush/synced

Shut down the node process, then proceed with the actual file-level upgrade:

tar -xzf elasticsearch-7.17.5.tar.gz
cp -r ./elasticsearch-7.13.0/config/ ./elasticsearch-7.17.5/
cp -r ./elasticsearch-7.13.0/config/jvm.options ./elasticsearch-7.17.5/config/jvm.options
cp -r ./elasticsearch-7.13.0/data ./elasticsearch-7.17.5/
chown -R elasticsearch:elasticsearch elasticsearch-7.17.5

After upgrading the binaries and configurations, address plugin updates:

./bin/elasticsearch-plugin remove analysis-ik
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.17.5/elasticsearch-analysis-ik-7.17.5.zip

Finally, boot up the upgraded node:

./bin/elasticsearch

Step 2: Migrate from 7.17.5 to 8.1.3

After securing the 7.17.5 version, it's time for the main event: advancing to 8.1.3.
Ensure Elasticsearch 8.1.3 and the accompanying Kibana version are installed, then prepare for a re-index, which facilitates data migration:

PUT _cluster/settings
{
  "persistent": {
    "reindex.remote.whitelist": "oldhost:port"
  }
}

Here’s a sample reindex operation:

POST _reindex
{
  "source": {
    "remote": {
      "host": "http://oldhost:19200",
      "username": "esuser",
      "password": "xxx"
    },
    "index": "index_1"
  },
  "dest": {
    "index": "new_index_1"
  }
}

For batch reindexing, a script could loop through indices and perform reindexing operations one by one.

Conclusion

The upgrade process may seem intricate, but by breaking it down step by step, it becomes manageable. Remember: every environment is unique, so referring to official documentation is crucial.

While Elasticsearch offers a conservative upgrade path leaving much to the user's discretion, the manual approach allows for customizing the process to fit one’s specific environment.
Explore Alibaba Cloud Elasticsearch to understand how their environment can streamline your Elasticsearch upgrade path.

Ready to start your journey with Elasticsearch on Alibaba Cloud? Explore our tailored Cloud solutions and services to take the first step towards transforming your data into a visual masterpiece. Click here, embark on your 30-Day Free Trial

0 1 0
Share on

Data Geek

99 posts | 4 followers

You may also like

Comments

Data Geek

99 posts | 4 followers

Related Products