This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 11. Manually rolling out Elasticsearch
OpenShift Container Platform supports the Elasticsearch rolling cluster restart. A rolling restart applies appropriate changes to the Elasticsearch cluster without down time (if three masters are configured). The Elasticsearch cluster remains online and operational, with nodes taken offline one at a time.
11.1. Performing an Elasticsearch rolling cluster restart 링크 복사링크가 클립보드에 복사되었습니다!
Perform a rolling restart when you change the elasticsearch
configmap or any of the elasticsearch-*
deployment configurations.
Also, a rolling restart is recommended if the nodes on which an Elasticsearch pod runs requires a reboot.
Prerequisite
- Cluster logging and Elasticsearch must be installed.
Procedure
To perform a rolling cluster restart:
Change to the
openshift-logging
project:oc project openshift-logging
$ oc project openshift-logging
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the following command to extract the CA certificate from Elasticsearch and write to the admin-ca file:
oc extract secret/elasticsearch --to=. --keys=admin-ca
$ oc extract secret/elasticsearch --to=. --keys=admin-ca admin-ca
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Perform a shard synced flush to ensure there are no pending operations waiting to be written to disk prior to shutting down:
oc exec <any_es_pod_in_the_cluster> -c elasticsearch -- curl -s --cacert /etc/elasticsearch/secret/admin-ca --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key -XPOST 'https://localhost:9200/_flush/synced'
$ oc exec <any_es_pod_in_the_cluster> -c elasticsearch -- curl -s --cacert /etc/elasticsearch/secret/admin-ca --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key -XPOST 'https://localhost:9200/_flush/synced'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
oc exec -c elasticsearch-cdm-5ceex6ts-1-dcd6c4c7c-jpw6 -- curl -s --cacert /etc/elasticsearch/secret/admin-ca --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key -XPOST 'https://localhost:9200/_flush/synced'
oc exec -c elasticsearch-cdm-5ceex6ts-1-dcd6c4c7c-jpw6 -- curl -s --cacert /etc/elasticsearch/secret/admin-ca --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key -XPOST 'https://localhost:9200/_flush/synced'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Prevent shard balancing when purposely bringing down nodes using the OpenShift Container Platform es_util tool:
oc exec <any_es_pod_in_the_cluster> -c elasticsearch -- es_util --query=_cluster/settings -XPUT 'https://localhost:9200/_cluster/settings' -d '{ "transient": { "cluster.routing.allocation.enable" : "none" } }'
$ oc exec <any_es_pod_in_the_cluster> -c elasticsearch -- es_util --query=_cluster/settings -XPUT 'https://localhost:9200/_cluster/settings' -d '{ "transient": { "cluster.routing.allocation.enable" : "none" } }'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Once complete, for each deployment you have for an ES cluster:
By default, the OpenShift Container Platform Elasticsearch cluster blocks rollouts to their nodes. Use the following command to allow rollouts and allow the pod to pick up the changes:
oc rollout resume deployment/<deployment-name>
$ oc rollout resume deployment/<deployment-name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
oc rollout resume deployment/elasticsearch-cdm-0-1
$ oc rollout resume deployment/elasticsearch-cdm-0-1 deployment.extensions/elasticsearch-cdm-0-1 resumed
Copy to Clipboard Copied! Toggle word wrap Toggle overflow A new pod is deployed. Once the pod has a ready container, you can move on to the next deployment.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Once complete, reset the pod to disallow rollouts:
oc rollout pause deployment/<deployment-name>
$ oc rollout pause deployment/<deployment-name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
oc rollout pause deployment/elasticsearch-cdm-0-1
$ oc rollout pause deployment/elasticsearch-cdm-0-1 deployment.extensions/elasticsearch-cdm-0-1 paused
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check that the Elasticsearch cluster is in
green
state:oc exec <any_es_pod_in_the_cluster> -c elasticsearch -- es_util --query=_cluster/health?pretty=true
$ oc exec <any_es_pod_in_the_cluster> -c elasticsearch -- es_util --query=_cluster/health?pretty=true
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf you performed a rollout on the Elasticsearch pod you used in the previous commands, the pod no longer exists and you need a new pod name here.
For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Make sure this parameter is
green
before proceeding.
- If you changed the Elasticsearch configuration map, repeat these steps for each Elasticsearch pod.
Once all the deployments for the cluster have been rolled out, re-enable shard balancing:
oc exec <any_es_pod_in_the_cluster> -c elasticsearch -- es_util --query=_cluster/settings -XPUT 'https://localhost:9200/_cluster/settings' -d '{ "transient": { "cluster.routing.allocation.enable" : "none" } }'
$ oc exec <any_es_pod_in_the_cluster> -c elasticsearch -- es_util --query=_cluster/settings -XPUT 'https://localhost:9200/_cluster/settings' -d '{ "transient": { "cluster.routing.allocation.enable" : "none" } }'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow