How to create a backup/snapshot of ETCD in OpenShift 3.11
Environment
- Red Hat OpenShift Container Platform (RHOCP)
- 3.10
- 3.11
Issue
How to create a backup or snapshot of ETCD database in OpenShift 3.11?
Resolution
Preparation
It is important to run the backup process on healthy ETCD cluster. Do not attempt to create a backup if the cluster is unstable or cluster being completely down.
In case of cluster being down, create a backup using Option B in the guide below.
Backup of ETCD
The following only needs to be performed on one ETCD host.
Option A: Capture a snapshot
# etcdctl3 snapshot save /var/lib/etcd/snapshot.db
-
From the host, copy to a new location, as the above will run the
etcdctlcommand in a container and save to a host mounted volume. We will delete the/var/lib/etcdpath in later steps.# cp /var/lib/etcd/snapshot.db /tmp/snapshot.db
Option B: Back up existing database
# cp /var/lib/etcd/member/snap/db /tmp/db
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.