How to save the database

Guide to taking a snapshot of the etcd database

Pre-requisites

Snapshot a database

snapshot to save point-in-time snapshot of etcd database:

1. etcdctl --endpoints=$ENDPOINT snapshot save DB_NAME

Global Options

etcdctl

1. --endpoints=[127.0.0.1:2379], gRPC endpoints

Snapshot can only be requested from one etcd node, so --endpoints flag should contain only one endpoint.

etcdutl

1. -w, --write-out string   set the output format (fields, json, protobuf, simple, table) (default "simple")

Example

11_etcdctl_snapshot_2016051001

1. ENDPOINTS=$HOST_1:2379
2. etcdctl --endpoints=$ENDPOINTS snapshot save my.db

4. Snapshot saved at my.db
1. etcdutl --write-out=table snapshot status my.db

3. +---------+----------+------------+------------+
4. |  HASH   | REVISION | TOTAL KEYS | TOTAL SIZE |
5. +---------+----------+------------+------------+
6. | c55e8b8 |        9 |         13 | 25 kB      |
7. +---------+----------+------------+------------+

Last modified July 6, 2025: etcd-website: rearrange files in developer and operator (06dc032)