This is the process for in-place upgrades of Elasticsearch (ES), meaning ones that can use the using an existing Search feed and index data.
Info | ||
---|---|---|
| ||
|
Upgrading Elasticsearch by script
On each node in your an Elasticsearch cluster, follow this process and run the files from your the Swarm download bundle:
Query the running Elasticsearch cluster, before upgrading, for the list of nodes.
Code Block language bash curl -i http://ELASTICSEARCH:9200/_cat/nodes
Note which node is starred. That is the Elasticsearch master node which you should is recommended to upgrade last to avoid problems electing a new one.
- Backup your the existing elasticsearch.yml, so that you have a record of any customizations you may have made exists.
- If you have customized path.data, create Create a symbolic (soft) link:
symlink /var/lib/elasticsearch
. If you cannot, perform if path.data is customized . Perform the upgrade manually, as described below if unable. When upgrading Elasticsearch 6, start Start by installing the latest Swarm Search, which is the
caringo-elasticsearch-search
RPM when upgrading Elasticsearch 6.Code Block language bash yum install caringo-elasticsearch-search-VERSION.noarch.rpm
Info title Tip The error: "
ES_PATH_CONF must be set to the configuration path chown: cannot access '/etc/elasticsearch/elasticsearch.keystore': No such file or directory
" displays if Elasticsearch 7 RPM is inadvertently installed. Install caringo-elasticsearch-search-7.0.0 RPM to proceed.Run the script that installs and configures the upgrade.
The script detects that Elasticsearch 6 is installed and thatdiscovery.zen.unicast.hosts
is configured, so it runs as with--upgrade
instead of configuring a new cluster.Code Block language bash /usr/share/caringo-elasticsearch-search/bin/configure_elasticsearch_with_swarm_search.py
- Compare your the backup file to the newly created
elasticsearch.yml
and add back any customizations you needneeded, such asnetwork.host
(which defaults to_site_
, meaning all interfaces). Verify all nodes are accounted for, that all shards are assigned, and that the status is green.
Code Block language bash curl -i 'http://ELASTICSEARCH:9200/_cat/health?v'
If Elasticsearch 7 is already installed, the The script updates the configuration files and restarts the service for youif Elasticsearch 7 is already installed.
Info | ||
---|---|---|
| ||
If Change permissions if the Elasticsearch service fails and
|
Info | ||
---|---|---|
| ||
If the cluster loses master during the upgrade process and does not recover, that’s fine, type Type Ctrl-C once, whenever the upgrade script is stuck in retrying status checks and proceed to the next node after the script finishes if the cluster loses master during the upgrade process and does not recover. Review Once The nodes elect the master and recover once all nodes have started on Elasticsearch 7.5.2, they should be able to elect the master and recover. Health status should go goes yellow then eventually green. Re-enable shard allocation, otherwise |
Upgrading Elasticsearch manually
If you should need to upgrade manually, these These are the steps that the script automates if needing to upgrade manually:
- It fixes
/etc/sysconfig/elasticsearch
to be the correct ES6 version (it's also the same as ES7). - It increases the
systemd
timeout in/etc/systemd/system/elasticsearch.service.d/override.conf
(see github.com/elastic/elasticsearch/issues/60140) - After refreshing the config files for Elasticsearch 6, it prompts A prompt to continue with the yum upgrade to 7.5.2 appears after refreshing the config files for Elasticsearch 6.
It disables shard allocation and does a POST synced-flush for safer rolling upgrades.
Info title Important Disabling shard allocation or sync-flush can fail to contact the node, but do not proceed to upgrade the next node until the cluster health is green again.
- It uninstalls the Prometheus Exporter plugin if it exists.
It shells out to yum to install the Elasticsearch 7 RPM in the current directory or from artifacts.elastic.co, if unavailable.
Warning We expect Internet access by default is expected for the upgrade. In case it is not available, ensure that Verify the Elasticsearch RPM is in the current directory if access is unavailable.
- It updates elasticsearch.yml for version 7 compatibility, including
discovery.initial_master_nodes
instead ofdiscovery.zen.unicast.hosts
, andjvm.options
. - It starts the upgraded Elasticsearch 7 and waits for it to be ready.
- If the cluster health is green or yellow, it The cluster re-enables shard allocation and prompts you to repeat these two steps on the next node if the cluster health is green or yellow.