无法在 Rancher 中备份 etcd 更新 etcd 版本

问题描述

我认为这是一个简单的命令,但无法使其工作。

我已经检查过 etcd 状态,看起来不错。

root@8838a21136ae:/tmp# etcdctl --endpoints=http://localhost:2380 member list
8e9e05c52164694d,started,default,http://localhost:2380,http://localhost:2379,false

然后我运行备份

root@8838a21136ae:/tmp# ETCDCTL_API=3 etcdctl --endpoints=http://localhost:2380 snapshot save snapshotdb
{"level":"info","ts":1617983594.8125136,"caller":"snapshot/v3_snapshot.go:110","msg":"created temporary db file","path":"snapshotdb.part"}
{"level":"warn","ts":"2021-04-09T15:53:14.813Z","caller":"clientv3/retry_interceptor.go:116","msg":"retry stream intercept"}
{"level":"info","ts":1617983594.8140104,"caller":"snapshot/v3_snapshot.go:121","msg":"fetching snapshot","endpoint":"http://localhost:2380"}
{"level":"info","ts":1617983594.9961464,"caller":"snapshot/v3_snapshot.go:134","msg":"fetched snapshot","endpoint":"http://localhost:2380","took":0.183444088}
{"level":"info","ts":1617983595.0013795,"caller":"snapshot/v3_snapshot.go:143","msg":"saved","path":"snapshotdb"}
Snapshot saved at snapshotdb
root@8838a21136ae:/tmp#

但是我查看备份状态时,总是报错

root@8838a21136ae:/tmp# ETCDCTL_API=3 etcdctl --write-out=table snapshot status snapshotdb
Error: cannot get hash of bucket X�_

更新 etcd 版本

这次好了。

$ docker run -d --restart=unless-stopped \
  -p 80:80 -p 443:443 \
  --privileged \
  rancher/rancher:latest

7d6352e9c83c09e2db3b75c65b32e2db924bcbf1bba49a39932970bc30xxxxx

$ docker exec -ti 7d6 bash
root@7d6352e9c83c:/var/lib/rancher# etcdctl version
etcdctl version: 3.4.3
API version: 3.4

$ root@7d6352e9c83c:/tmp# ETCDCTL_API=3 etcdctl --endpoints=http://localhost:2380 snapshot save snapshotdb
{"level":"info","ts":1618220268.335442,"ts":"2021-04-12T09:37:48.336Z","ts":1618220268.3370042,"ts":1618220268.4431155,"took":0.1074284}
{"level":"info","ts":1618220268.4456491,"path":"snapshotdb"}
Snapshot saved at snapshotdb
root@7d6352e9c83c:/tmp# ETCDCTL_API=3 etcdctl --write-out=table snapshot status snapshotdb
+----------+----------+------------+------------+
|   HASH   | REVISION | TOTAL KEYS | TOTAL SIZE |
+----------+----------+------------+------------+
| d1684a92 |     2638 |       2646 |     7.3 MB |
+----------+----------+------------+------------+
root@7d6352e9c83c:/tmp#

这张票现在可以关闭了。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)