Upgrade from Elasticsearch OSS to OpenSearch
If your existing cluster runs an older version of Elasticsearch OSS, the first step is to upgrade to version 6.x or 7.x. Elasticsearch OSS supports two types of upgrades: rolling and cluster restart.
Rolling upgrades let you shut down one node at a time for minimal disruption of service.
Rolling upgrades work between minor versions (e.g. 6.5 to 6.8) and also support a single path to the next major version (e.g. 6.8 to 7.10.2). Performing these upgrades might require intermediate upgrades to arrive at your desired version and can affect cluster performance as nodes leave and rejoin, but the cluster remains available throughout the process.
Cluster restart upgrades require you to shut down all nodes, perform the upgrade, and restart the cluster.
Cluster restart upgrades work between minor versions (e.g. 6.5 to 6.8) and the next major version (for example, 6.x to 7.10.2). Cluster restart upgrades are faster to perform and require fewer intermediate upgrades, but require downtime.
Disable shard allocation to prevent Elasticsearch OSS from replicating shards as you shut down nodes:
Stop Elasticsearch OSS on one node (rolling upgrade) or all nodes (cluster restart upgrade).
On Linux distributions that use systemd, use this command:
For tarball installations, find the process ID (
ps aux
) and kill it (kill <pid>
).Upgrade the node (rolling) or all nodes (cluster restart).
The exact command varies by package manager, but likely looks something like this:
sudo yum install elasticsearch-oss-7.10.2 --enablerepo=elasticsearch
For tarball installations, extract to a new directory to ensure you do not overwrite your
config
,data
, andlogs
directories. Ideally, these directories should have their own, independent paths and not be colocated with the Elasticsearch application directory. Then set theES_PATH_CONF
environment variable to the directory that containselasticsearch.yml
(e.g./etc/elasticesarch/
). Inelasticsearch.yml
, setpath.data
andpath.logs
to yourdata
andlogs
directories (e.g./var/lib/elasticsearch
and/var/log/opensearch
).-
On Linux distributions that use systemd, use this command:
For tarball installations, run
./bin/elasticsearch -d
. Wait for the node to rejoin the cluster (rolling) or for the cluster to start (cluster restart). Check the
_nodes
summary to verify that all nodes are available and running the expected version:# Elasticsearch OSS
curl -XGET 'localhost:9200/_nodes/_all?pretty=true'
# Open Distro for Elasticsearch with security plugin enabled
Specifically, check the portion of the response. Also check
_cat/indices?v
for a green status on all indices.(Rolling) Repeat steps 2–5 until all nodes are using the new version.
After all nodes are using the new version, re-enable shard allocation:
PUT _cluster/settings
{
"persistent": {
"cluster.routing.allocation.enable": "all"
}
}
If you upgraded from 5.x to 6.x, reindex all indices.
Repeat all steps as necessary until you arrive at your desired Elasticsearch OSS version.
Disable shard allocation to prevent Elasticsearch OSS from replicating shards as you shut down nodes:
Stop Elasticsearch OSS on one node (rolling upgrade) or all nodes (cluster restart upgrade).
On Linux distributions that use systemd, use this command:
sudo systemctl stop elasticsearch.service
For tarball installations, find the process ID (
ps aux
) and kill it (kill <pid>
).-
Extract the OpenSearch tarball to a new directory to ensure you do not overwrite your Elasticsearch OSS
config
,data
, andlogs
directories.Set the
OPENSEARCH_PATH_CONF
environment variable to the directory that containsopensearch.yml
(e.g./etc/opensearch
).In
opensearch.yml
, setpath.data
and . You might also want to disable the security plugin for now.opensearch.yml
might look something like this:path.data: /var/lib/opensearch
path.logs: /var/log/opensearch
plugins.security.disabled: true
Port your settings from
elasticsearch.yml
toopensearch.yml
. Most settings use the same names. At a minimum, specifycluster.name
,node.name
,discovery.seed_hosts
, andcluster.initial_master_nodes
.(Optional) Add your certificates to your
config
directory, add them toopensearch.yml
, and initialize the security plugin.
Start OpenSearch on the node (rolling) or all nodes (cluster restart).
For the tarball, run
./bin/opensearch -d
.Wait for the OpenSearch node to rejoin the cluster (rolling) or for the cluster to start (cluster restart). Check the
_nodes
summary to verify that all nodes are available and running the expected version:Specifically, check the
nodes.<node-id>.version
portion of the response. Also check_cat/indices?v
for a green status on all indices.(Rolling) Repeat steps 2–5 until all nodes are using OpenSearch.
After all nodes are using the new version, re-enable shard allocation:
PUT _cluster/settings
{
"persistent": {
"cluster.routing.allocation.enable": "all"
}