Die Datenbank sichern
Anleitung zum Erstellen eines Snapshots der etcd-Datenbank
Voraussetzungen
Einen Snapshot der Datenbank erstellen
snapshot zum Speichern eines Snapshots der etcd-Datenbank zu einem bestimmten Zeitpunkt:
etcdctl --endpoints=$ENDPOINT snapshot save DB_NAME
Globale Optionen
etcdctl
--endpoints=[127.0.0.1:2379], gRPC endpoints
Ein Snapshot kann nur von einem einzelnen etcd-Knoten angefordert werden. Daher sollte die Option --endpoints nur einen Endpunkt enthalten.
etcdutl
-w, --write-out string set the output format (fields, json, protobuf, simple, table) (default "simple")
Beispiel

ENDPOINTS=$HOST_1:2379
etcdctl --endpoints=$ENDPOINTS snapshot save my.db
Snapshot saved at my.db
etcdutl --write-out=table snapshot status my.db
+---------+----------+------------+------------+
| HASH | REVISION | TOTAL KEYS | TOTAL SIZE |
+---------+----------+------------+------------+
| c55e8b8 | 9 | 13 | 25 kB |
+---------+----------+------------+------------+