如何保存数据库
etcd 数据库快照的使用指南
先决条件
快照数据库
snapshot 用于保存 etcd 数据库的指定时间点快照:
etcdctl --endpoints=$ENDPOINT snapshot save DB_NAME
全局选项
etcdctl
--endpoints=[127.0.0.1:2379], gRPC endpoints
快照只能从一个 etcd 节点请求,因此 --endpoints 标志中应仅包含一个端点。
etcd 工具
-w, --write-out string set the output format (fields, json, protobuf, simple, table) (default "simple")
示例

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 |
+---------+----------+------------+------------+