Elasticsearch 简明教程
Elasticsearch - Migration between Versions
在任何系统或软件中,当我们升级到较新的版本时,我们需要遵循一些步骤来维护应用程序设置、配置、数据和其他内容。需要这些步骤才能在新系统中使应用程序保持稳定或保持数据的完整性(防止数据损坏)。
In any system or software, when we are upgrading to newer version, we need to follow a few steps to maintain the application settings, configurations, data and other things. These steps are required to make the application stable in new system or to maintain the integrity of data (prevent data from getting corrupt).
你需要按照以下步骤来升级 Elasticsearch −
You need to follow the following steps to upgrade Elasticsearch −
-
Read Upgrade docs from https://www.elastic.co/
-
Test the upgraded version in your non production environments like in UAT, E2E, SIT or DEV environment.
-
Note that rollback to previous Elasticsearch version is not possible without data backup. Hence, a data backup is recommended before upgrading to a higher version.
-
We can upgrade using full cluster restart or rolling upgrade. Rolling upgrade is for new versions. Note that there is no service outage, when you are using rolling upgrade method for migration.
Steps for Upgrade
-
Test the upgrade in a dev environment before upgrading your production cluster.
-
Back up your data. You cannot roll back to an earlier version unless you have a snapshot of your data.
-
Consider closing machine learning jobs before you start the upgrade process. While machine learning jobs can continue to run during a rolling upgrade, it increases the overhead on the cluster during the upgrade process.
-
Upgrade the components of your Elastic Stack in the following order − ElasticsearchKibanaLogstashBeatsAPM Server
Upgrading from 6.6 or Earlier
要从版本 6.0-6.6 直接升级到 Elasticsearch 7.1.0,你必须手动重新编制任何需要继续使用的 5.x 索引,并执行完整集群重启。
To upgrade directly to Elasticsearch 7.1.0 from versions 6.0-6.6, you must manually reindex any 5.x indices you need to carry forward, and perform a full cluster restart.
Full Cluster Restart
完整集群重启的过程涉及关闭集群中的每个节点,将每个节点升级到 7x,然后重新启动集群。
The process of full cluster restart involves shutting down each node in the cluster, upgrading each node to 7x and then restarting the cluster.
以下是执行完整集群重启所需的高级步骤:
Following are the high level steps that need to be carried out for full cluster restart −
-
Disable shard allocation
.
-
Stop indexing and perform a synced flush
.
-
Shutdown all nodes
.
-
Upgrade all nodes
.
-
Upgrade any plugins
.
-
Start each upgraded node
.
-
Wait for all nodes to join the cluster and report a status of yellow
.
-
Re-enable allocation
.
重新启用分配后,集群开始将副本分片分配到数据节点。此时,恢复编制索引和搜索是安全的,但如果你可以等到所有主分片和副本分片都已成功分配且所有节点的状态都为绿色,那么集群将恢复得更快。
Once allocation is re-enabled, the cluster starts allocating the replica shards to the data nodes. At this point, it is safe to resume indexing and searching, but your cluster will recover more quickly if you can wait until all primary and replica shards have been successfully allocated and the status of all nodes is green.