Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 12. Restoring the monitor pods in OpenShift Data Foundation
Restore the monitor pods if all three of them go down, and when OpenShift Data Foundation is not able to recover the monitor pods automatically.
This is a disaster recovery procedure and must be performed under the guidance of the Red Hat support team. Contact Red Hat support team on, Red Hat support.
Procedure
Scale down the
rook-ceph-operatorandocs operatordeployments.oc scale deployment rook-ceph-operator --replicas=0 -n openshift-storage
# oc scale deployment rook-ceph-operator --replicas=0 -n openshift-storageCopy to Clipboard Copied! Toggle word wrap Toggle overflow oc scale deployment ocs-operator --replicas=0 -n openshift-storage
# oc scale deployment ocs-operator --replicas=0 -n openshift-storageCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a backup of all deployments in
openshift-storagenamespace.mkdir backup
# mkdir backupCopy to Clipboard Copied! Toggle word wrap Toggle overflow cd backup
# cd backupCopy to Clipboard Copied! Toggle word wrap Toggle overflow oc project openshift-storage
# oc project openshift-storageCopy to Clipboard Copied! Toggle word wrap Toggle overflow for d in $(oc get deployment|awk -F' ' '{print $1}'|grep -v NAME); do echo $d;oc get deployment $d -o yaml > oc_get_deployment.${d}.yaml; done# for d in $(oc get deployment|awk -F' ' '{print $1}'|grep -v NAME); do echo $d;oc get deployment $d -o yaml > oc_get_deployment.${d}.yaml; doneCopy to Clipboard Copied! Toggle word wrap Toggle overflow Patch the Object Storage Device (OSD) deployments to remove the
livenessProbeparameter, and run it with the command parameter assleep.for i in $(oc get deployment -l app=rook-ceph-osd -oname);do oc patch ${i} -n openshift-storage --type='json' -p '[{"op":"remove", "path":"/spec/template/spec/containers/0/livenessProbe"}]' ; oc patch ${i} -n openshift-storage -p '{"spec": {"template": {"spec": {"containers": [{"name": "osd", "command": ["sleep", "infinity"], "args": []}]}}}}' ; done# for i in $(oc get deployment -l app=rook-ceph-osd -oname);do oc patch ${i} -n openshift-storage --type='json' -p '[{"op":"remove", "path":"/spec/template/spec/containers/0/livenessProbe"}]' ; oc patch ${i} -n openshift-storage -p '{"spec": {"template": {"spec": {"containers": [{"name": "osd", "command": ["sleep", "infinity"], "args": []}]}}}}' ; doneCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy
tarto the OSDs.for i in `oc get pods -l app=rook-ceph-osd -o name | sed -e "s/pod\///g"` ; do cat /usr/bin/tar | oc exec -i ${i} -- bash -c 'cat - >/usr/bin/tar' ; oc exec -i ${i} -- bash -c 'chmod +x /usr/bin/tar' ;donefor i in `oc get pods -l app=rook-ceph-osd -o name | sed -e "s/pod\///g"` ; do cat /usr/bin/tar | oc exec -i ${i} -- bash -c 'cat - >/usr/bin/tar' ; oc exec -i ${i} -- bash -c 'chmod +x /usr/bin/tar' ;doneCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteWhile copying the tar binary to the OSD, it is important to ensure that the
tarbinary matches the container image OS of the pod. Copying the binary from a different OS such as, macOS, Ubuntu, and so on might lead to compatibility issues.Retrieve the
monstorecluster map from all the OSDs.Create the
recover_mon.shscript.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the
recover_mon.shscript.chmod +x recover_mon.sh
# chmod +x recover_mon.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow ./recover_mon.sh
# ./recover_mon.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Patch the MON deployments, and run it with the command parameter as
sleep.Edit the MON deployments.
for i in $(oc get deployment -l app=rook-ceph-mon -oname);do oc patch ${i} -n openshift-storage -p '{"spec": {"template": {"spec": {"containers": [{"name": "mon", "command": ["sleep", "infinity"], "args": []}]}}}}'; done# for i in $(oc get deployment -l app=rook-ceph-mon -oname);do oc patch ${i} -n openshift-storage -p '{"spec": {"template": {"spec": {"containers": [{"name": "mon", "command": ["sleep", "infinity"], "args": []}]}}}}'; doneCopy to Clipboard Copied! Toggle word wrap Toggle overflow Patch the MON deployments to increase the
initialDelaySeconds.for i in a b c ; do oc get deployment rook-ceph-mon-${i} -o yaml | sed "s/initialDelaySeconds: 10/initialDelaySeconds: 10000/g" | oc replace -f - ; done# for i in a b c ; do oc get deployment rook-ceph-mon-${i} -o yaml | sed "s/initialDelaySeconds: 10/initialDelaySeconds: 10000/g" | oc replace -f - ; doneCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy
tarto the MON pods.for i in `oc get pods -l app=rook-ceph-mon -o name | sed -e "s/pod\///g"` ; do cat /usr/bin/tar | oc exec -i ${i} -- bash -c 'cat - >/usr/bin/tar' ; oc exec -i ${i} -- bash -c 'chmod +x /usr/bin/tar' ;done# for i in `oc get pods -l app=rook-ceph-mon -o name | sed -e "s/pod\///g"` ; do cat /usr/bin/tar | oc exec -i ${i} -- bash -c 'cat - >/usr/bin/tar' ; oc exec -i ${i} -- bash -c 'chmod +x /usr/bin/tar' ;doneCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteWhile copying the tar binary to the MON, it is important to ensure that the
tarbinary matches the container image OS of the pod. Copying the binary from a different OS such as, macOS, Ubuntu, and so on might lead to compatibility issues.
Copy the previously retrieved
monstoreto the mon-a pod.oc cp /tmp/monstore/ $(oc get po -l app=rook-ceph-mon,mon=a -oname |sed 's/pod\///g'):/tmp/
# oc cp /tmp/monstore/ $(oc get po -l app=rook-ceph-mon,mon=a -oname |sed 's/pod\///g'):/tmp/Copy to Clipboard Copied! Toggle word wrap Toggle overflow Navigate into the MON pod and change the ownership of the retrieved
monstore.oc rsh $(oc get po -l app=rook-ceph-mon,mon=a -oname)
# oc rsh $(oc get po -l app=rook-ceph-mon,mon=a -oname)Copy to Clipboard Copied! Toggle word wrap Toggle overflow chown -R ceph:ceph /tmp/monstore
# chown -R ceph:ceph /tmp/monstoreCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the keyring template file before rebuilding the
mon db.oc rsh $(oc get po -l app=rook-ceph-mon,mon=a -oname)
# oc rsh $(oc get po -l app=rook-ceph-mon,mon=a -oname)Copy to Clipboard Copied! Toggle word wrap Toggle overflow cp /etc/ceph/keyring-store/keyring /tmp/keyring
# cp /etc/ceph/keyring-store/keyring /tmp/keyringCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow Populate the keyring of all other Ceph daemons (OSD, MGR, MDS and RGW) from their respective secrets.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow When getting the daemons keyring, use the following command:
for i in `oc get secret | grep keyring| awk '{print $1}'` ; do oc get secret ${i} -ojson | jq .data.keyring | xargs echo | base64 -d ; done# for i in `oc get secret | grep keyring| awk '{print $1}'` ; do oc get secret ${i} -ojson | jq .data.keyring | xargs echo | base64 -d ; doneCopy to Clipboard Copied! Toggle word wrap Toggle overflow Get the OSDs keys with the following script:
for i in `oc get pods -l app=rook-ceph-osd -o name | sed -e "s/pod\///g"` ; do oc exec -i ${i} -- bash -c 'cat /var/lib/ceph/osd/ceph-*/keyring ' ;done# for i in `oc get pods -l app=rook-ceph-osd -o name | sed -e "s/pod\///g"` ; do oc exec -i ${i} -- bash -c 'cat /var/lib/ceph/osd/ceph-*/keyring ' ;doneCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the mon keyring locally, then edit it by adding all daemon keys captured in the earlier step and copy it back to one of the MON pods (mon-a):
oc cp $(oc get po -l app=rook-ceph-mon,mon=a -oname|sed -e "s/pod\///g"):/etc/ceph/keyring-store/..data/keyring /tmp/keyring-mon-a
oc cp $(oc get po -l app=rook-ceph-mon,mon=a -oname|sed -e "s/pod\///g"):/etc/ceph/keyring-store/..data/keyring /tmp/keyring-mon-aCopy to Clipboard Copied! Toggle word wrap Toggle overflow vi /tmp/keyring-mon-a
vi /tmp/keyring-mon-aCopy to Clipboard Copied! Toggle word wrap Toggle overflow As an example, the keyring file should look like the following:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf the
capsentries are not present in the OSDs keys output, make sure to addcapsto all the OSDs output as mentioned in the previous keyring file example.oc cp /tmp/keyring-mon-a $(oc get po -l app=rook-ceph-mon,mon=a -oname|sed -e "s/pod\///g"):/tmp/keyring
oc cp /tmp/keyring-mon-a $(oc get po -l app=rook-ceph-mon,mon=a -oname|sed -e "s/pod\///g"):/tmp/keyringCopy to Clipboard Copied! Toggle word wrap Toggle overflow Navigate into the mon-a pod, and verify that the
monstorehas amonmap.Navigate into the mon-a pod.
oc rsh $(oc get po -l app=rook-ceph-mon,mon=a -oname)
# oc rsh $(oc get po -l app=rook-ceph-mon,mon=a -oname)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the
monstorehas amonmap.ceph-monstore-tool /tmp/monstore get monmap -- --out /tmp/monmap
# ceph-monstore-tool /tmp/monstore get monmap -- --out /tmp/monmapCopy to Clipboard Copied! Toggle word wrap Toggle overflow monmaptool /tmp/monmap --print
# monmaptool /tmp/monmap --printCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Optional: If the
monmapis missing then create a newmonmap.monmaptool --create --add <mon-a-id> <mon-a-ip> --add <mon-b-id> <mon-b-ip> --add <mon-c-id> <mon-c-ip> --enable-all-features --clobber /root/monmap --fsid <fsid>
# monmaptool --create --add <mon-a-id> <mon-a-ip> --add <mon-b-id> <mon-b-ip> --add <mon-c-id> <mon-c-ip> --enable-all-features --clobber /root/monmap --fsid <fsid>Copy to Clipboard Copied! Toggle word wrap Toggle overflow <mon-a-id>- Is the ID of the mon-a pod.
<mon-a-ip>- Is the IP address of the mon-a pod.
<mon-b-id>- Is the ID of the mon-b pod.
<mon-b-ip>- Is the IP address of the mon-b pod.
<mon-c-id>- Is the ID of the mon-c pod.
<mon-c-ip>- Is the IP address of the mon-c pod.
<fsid>- Is the file system ID.
Verify the
monmap.monmaptool /root/monmap --print
# monmaptool /root/monmap --printCopy to Clipboard Copied! Toggle word wrap Toggle overflow Import the
monmap.ImportantUse the previously created keyring file.
ceph-monstore-tool /tmp/monstore rebuild -- --keyring /tmp/keyring --monmap /root/monmap
# ceph-monstore-tool /tmp/monstore rebuild -- --keyring /tmp/keyring --monmap /root/monmapCopy to Clipboard Copied! Toggle word wrap Toggle overflow chown -R ceph:ceph /tmp/monstore
# chown -R ceph:ceph /tmp/monstoreCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a backup of the old
store.dbfile.mv /var/lib/ceph/mon/ceph-a/store.db /var/lib/ceph/mon/ceph-a/store.db.corrupted
# mv /var/lib/ceph/mon/ceph-a/store.db /var/lib/ceph/mon/ceph-a/store.db.corruptedCopy to Clipboard Copied! Toggle word wrap Toggle overflow mv /var/lib/ceph/mon/ceph-b/store.db /var/lib/ceph/mon/ceph-b/store.db.corrupted
# mv /var/lib/ceph/mon/ceph-b/store.db /var/lib/ceph/mon/ceph-b/store.db.corruptedCopy to Clipboard Copied! Toggle word wrap Toggle overflow mv /var/lib/ceph/mon/ceph-c/store.db /var/lib/ceph/mon/ceph-c/store.db.corrupted
# mv /var/lib/ceph/mon/ceph-c/store.db /var/lib/ceph/mon/ceph-c/store.db.corruptedCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the rebuild
store.dbfile to themonstoredirectory.mv /tmp/monstore/store.db /var/lib/ceph/mon/ceph-a/store.db
# mv /tmp/monstore/store.db /var/lib/ceph/mon/ceph-a/store.dbCopy to Clipboard Copied! Toggle word wrap Toggle overflow chown -R ceph:ceph /var/lib/ceph/mon/ceph-a/store.db
# chown -R ceph:ceph /var/lib/ceph/mon/ceph-a/store.dbCopy to Clipboard Copied! Toggle word wrap Toggle overflow After rebuilding the
monstoredirectory, copy thestore.dbfile from local to the rest of the MON pods.oc cp $(oc get po -l app=rook-ceph-mon,mon=a -oname | sed 's/pod\///g'):/var/lib/ceph/mon/ceph-a/store.db /tmp/store.db
# oc cp $(oc get po -l app=rook-ceph-mon,mon=a -oname | sed 's/pod\///g'):/var/lib/ceph/mon/ceph-a/store.db /tmp/store.dbCopy to Clipboard Copied! Toggle word wrap Toggle overflow oc cp /tmp/store.db $(oc get po -l app=rook-ceph-mon,mon=<id> -oname | sed 's/pod\///g'):/var/lib/ceph/mon/ceph-<id>
# oc cp /tmp/store.db $(oc get po -l app=rook-ceph-mon,mon=<id> -oname | sed 's/pod\///g'):/var/lib/ceph/mon/ceph-<id>Copy to Clipboard Copied! Toggle word wrap Toggle overflow <id>- Is the ID of the MON pod
Navigate into the rest of the MON pods and change the ownership of the copied
monstore.oc rsh $(oc get po -l app=rook-ceph-mon,mon=<id> -oname)
# oc rsh $(oc get po -l app=rook-ceph-mon,mon=<id> -oname)Copy to Clipboard Copied! Toggle word wrap Toggle overflow chown -R ceph:ceph /var/lib/ceph/mon/ceph-<id>/store.db
# chown -R ceph:ceph /var/lib/ceph/mon/ceph-<id>/store.dbCopy to Clipboard Copied! Toggle word wrap Toggle overflow <id>- Is the ID of the MON pod
Revert the patched changes.
For MON deployments:
oc replace --force -f <mon-deployment.yaml>
# oc replace --force -f <mon-deployment.yaml>Copy to Clipboard Copied! Toggle word wrap Toggle overflow <mon-deployment.yaml>- Is the MON deployment yaml file
For OSD deployments:
oc replace --force -f <osd-deployment.yaml>
# oc replace --force -f <osd-deployment.yaml>Copy to Clipboard Copied! Toggle word wrap Toggle overflow <osd-deployment.yaml>- Is the OSD deployment yaml file
For MGR deployments:
oc replace --force -f <mgr-deployment.yaml>
# oc replace --force -f <mgr-deployment.yaml>Copy to Clipboard Copied! Toggle word wrap Toggle overflow <mgr-deployment.yaml>Is the MGR deployment yaml file
ImportantEnsure that the MON, MGR and OSD pods are up and running.
Scale up the
rook-ceph-operatorandocs-operatordeployments.oc -n openshift-storage scale deployment rook-ceph-operator --replicas=1
# oc -n openshift-storage scale deployment rook-ceph-operator --replicas=1Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc -n openshift-storage scale deployment ocs-operator --replicas=1
# oc -n openshift-storage scale deployment ocs-operator --replicas=1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification steps
Check the Ceph status to confirm that CephFS is running using the
odf-clitool, which you can download from the which you need to download from the customer portal.odf ceph -s
# odf ceph -sCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the Multicloud Object Gateway (MCG) status. It should be active, and the backingstore and bucketclass should be in
Readystate.noobaa status -n openshift-storage
noobaa status -n openshift-storageCopy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantIf the MCG is not in the active state, and the backingstore and bucketclass not in the
Readystate, you need to restart all the MCG related pods. For more information, see Section 12.1, “Restoring the Multicloud Object Gateway”.
12.1. Restoring the Multicloud Object Gateway Copier lienLien copié sur presse-papiers!
If the Multicloud Object Gateway (MCG) is not in the active state, and the backingstore and bucketclass is not in the Ready state, you need to restart all the MCG related pods, and check the MCG status to confirm that the MCG is back up and running.
Procedure
Restart all the pods related to the MCG.
oc delete pods <noobaa-operator> -n openshift-storage
# oc delete pods <noobaa-operator> -n openshift-storageCopy to Clipboard Copied! Toggle word wrap Toggle overflow oc delete pods <noobaa-core> -n openshift-storage
# oc delete pods <noobaa-core> -n openshift-storageCopy to Clipboard Copied! Toggle word wrap Toggle overflow oc delete pods <noobaa-endpoint> -n openshift-storage
# oc delete pods <noobaa-endpoint> -n openshift-storageCopy to Clipboard Copied! Toggle word wrap Toggle overflow oc delete pods <noobaa-db> -n openshift-storage
# oc delete pods <noobaa-db> -n openshift-storageCopy to Clipboard Copied! Toggle word wrap Toggle overflow <noobaa-operator>- Is the name of the MCG operator
<noobaa-core>- Is the name of the MCG core pod
<noobaa-endpoint>- Is the name of the MCG endpoint
<noobaa-db>- Is the name of the MCG db pod
If the RADOS Object Gateway (RGW) is configured, restart the pod.
oc delete pods <rgw-pod> -n openshift-storage
# oc delete pods <rgw-pod> -n openshift-storageCopy to Clipboard Copied! Toggle word wrap Toggle overflow <rgw-pod>- Is the name of the RGW pod
In OpenShift Container Platform, after the recovery, RBD PVC fails to get mounted on the application pods. Hence, you need to restart the node that is hosting the application pods. To get the node name that is hosting the application pod, run the following command:
oc get pods <application-pod> -n <namespace> -o yaml | grep nodeName
# oc get pods <application-pod> -n <namespace> -o yaml | grep nodeName
nodeName: node_name