Docker 安装的Rancher v2.5.12 备份后无法还原

Rancher Server 设置

  • Rancher 版本:v2.5.12
  • 安装选项 Docker install

**问题描述:Rancher 通过docker-compose 启动,/var/lib/rancher 通过bind 方式挂载在本地硬盘上,尝试在另一台服务器恢复此Rancher报错

日志

rancher_1 | 2022/05/12 01:32:13 [INFO] Rancher version v2.5.12 (c5f7295f6) is starting
rancher_1 | 2022/05/12 01:32:13 [INFO] Rancher arguments {ACMEDomains: AddLocal:true Embedded:false BindHost: HTTPListenPort:80 HTTPSListenPort:443 K8sMode:auto Debug:false Trace:false NoCACerts:false AuditLogPath:/var/log/auditlog/rancher-api-audit.log AuditLogMaxage:10 AuditLogMaxsize:100 AuditLogMaxbackup:10 AuditLevel:0 Agent:false Features: ClusterRegistry:}
rancher_1 | 2022/05/12 01:32:13 [INFO] Listening on /tmp/log.sock
rancher_1 | 2022/05/12 01:32:13 [INFO] Running etcd --data-dir=management-state/etcd --heartbeat-interval=500 --election-timeout=5000
rancher_1 | 2022-05-12 01:32:13.790003 W | pkg/flags: unrecognized environment variable ETCD_URL_arm64=https://github.com/etcd-io/etcd/releases/download/v3.4.3/etcd-v3.4.3-linux-arm64.tar.gz
rancher_1 | 2022-05-12 01:32:13.790156 W | pkg/flags: unrecognized environment variable ETCD_URL_amd64=https://github.com/etcd-io/etcd/releases/download/v3.4.3/etcd-v3.4.3-linux-amd64.tar.gz
rancher_1 | 2022-05-12 01:32:13.790169 W | pkg/flags: unrecognized environment variable ETCD_UNSUPPORTED_ARCH=amd64
rancher_1 | 2022-05-12 01:32:13.790179 W | pkg/flags: unrecognized environment variable ETCD_URL=ETCD_URL_amd64
rancher_1 | [WARNING] Deprecated ‘–logger=capnslog’ flag is set; use ‘–logger=zap’ flag instead
rancher_1 | 2022-05-12 01:32:13.790278 I | etcdmain: etcd Version: 3.4.3
rancher_1 | 2022-05-12 01:32:13.790289 I | etcdmain: Git SHA: 3cf2f69b5
rancher_1 | 2022-05-12 01:32:13.790296 I | etcdmain: Go Version: go1.12.12
rancher_1 | 2022-05-12 01:32:13.790304 I | etcdmain: Go OS/Arch: linux/amd64
rancher_1 | 2022-05-12 01:32:13.790312 I | etcdmain: setting maximum number of CPUs to 2, total number of available CPUs is 2
rancher_1 | 2022-05-12 01:32:13.790560 N | etcdmain: the server is already initialized as member before, starting as etcd member…
rancher_1 | [WARNING] Deprecated ‘–logger=capnslog’ flag is set; use ‘–logger=zap’ flag instead
rancher_1 | 2022-05-12 01:32:13.792275 I | embed: name = default
rancher_1 | 2022-05-12 01:32:13.792304 I | embed: data dir = management-state/etcd
rancher_1 | 2022-05-12 01:32:13.792315 I | embed: member dir = management-state/etcd/member
rancher_1 | 2022-05-12 01:32:13.792323 I | embed: heartbeat = 500ms
rancher_1 | 2022-05-12 01:32:13.792330 I | embed: election = 5000ms
rancher_1 | 2022-05-12 01:32:13.792338 I | embed: snapshot count = 100000
rancher_1 | 2022-05-12 01:32:13.792388 I | embed: advertise client URLs = http://localhost:2379
rancher_1 | 2022-05-12 01:32:13.792403 I | embed: initial advertise peer URLs = http://localhost:2380
rancher_1 | 2022-05-12 01:32:13.792414 I | embed: initial cluster =
rancher_1 | 2022-05-12 01:32:13.809925 I | etcdserver: recovered store from snapshot at index 74000769
rancher_1 | 2022-05-12 01:32:13.812835 I | mvcc: restore compact to 70891160
rancher_1 | 2022-05-12 01:32:13.893724 I | etcdserver: restarting member 8e9e05c52164694d in cluster cdf818194e3a8c32 at commit index 74002108
rancher_1 | raft2022/05/12 01:32:13 INFO: 8e9e05c52164694d switched to configuration voters=(10276657743932975437)
rancher_1 | raft2022/05/12 01:32:13 INFO: 8e9e05c52164694d became follower at term 15
rancher_1 | raft2022/05/12 01:32:13 INFO: newRaft 8e9e05c52164694d [peers: [8e9e05c52164694d], term: 15, commit: 74002108, applied: 74000769, lastindex: 74002108, lastterm: 15]
rancher_1 | 2022-05-12 01:32:13.894681 I | etcdserver/api: enabled capabilities for version 3.4
rancher_1 | 2022-05-12 01:32:13.894719 I | etcdserver/membership: added member 8e9e05c52164694d [http://localhost:2380] to cluster cdf818194e3a8c32 from store
rancher_1 | 2022-05-12 01:32:13.894734 I | etcdserver/membership: set the cluster version to 3.4 from store
rancher_1 | 2022-05-12 01:32:13.900675 I | mvcc: restore compact to 70891160
rancher_1 | 2022-05-12 01:32:13.935920 W | auth: simple token is not cryptographically signed
rancher_1 | 2022-05-12 01:32:13.941372 I | etcdserver: starting server… [version: 3.4.3, cluster version: 3.4]
rancher_1 | 2022-05-12 01:32:13.942614 I | etcdserver: 8e9e05c52164694d as single-node; fast-forwarding 9 ticks (election ticks 10)
rancher_1 | 2022-05-12 01:32:13.946735 I | embed: listening for peers on 127.0.0.1:2380
rancher_1 | raft2022/05/12 01:32:17 INFO: 8e9e05c52164694d is starting a new election at term 15
rancher_1 | raft2022/05/12 01:32:17 INFO: 8e9e05c52164694d became candidate at term 16
rancher_1 | raft2022/05/12 01:32:17 INFO: 8e9e05c52164694d received MsgVoteResp from 8e9e05c52164694d at term 16
rancher_1 | raft2022/05/12 01:32:17 INFO: 8e9e05c52164694d became leader at term 16
rancher_1 | raft2022/05/12 01:32:17 INFO: raft.node: 8e9e05c52164694d elected leader 8e9e05c52164694d at term 16
rancher_1 | 2022-05-12 01:32:17.407025 I | etcdserver: published {Name:default ClientURLs:[http://localhost:2379]} to cluster cdf818194e3a8c32
rancher_1 | 2022-05-12 01:32:17.407109 I | embed: ready to serve client requests
rancher_1 | 2022-05-12 01:32:17.409511 N | embed: serving insecure client requests on 127.0.0.1:2379, this is strongly discouraged!
rancher_1 | 2022/05/12 01:32:17 [INFO] Waiting for k3s to start
rancher_1 | time=“2022-05-12T01:32:17Z” level=fatal msg=“exec format error”
rancher_1 | 2022/05/12 01:32:17 [FATAL] k3s exited with: exit status 1
rancher_rancher_1 exited with code 1

更新:在放弃挂载/var/lib/rancher/k3s/data 和 /var/lib/rancher/k3s/agent 后rancher 终于启动了,登录后导入集群全红,未做其它测试

从日志里没找到详细的问题,你可以 exec 到重启里 查询 /var/lib/rancher/k3s.log 日志。

但从你描述的操作步骤来看,rancher 应该不支持将备份恢复到其他的主机上运行。因为备份复制到其他主机运行之后,对应的主机 IP 也变了。

我试过用相同ip,也不行。

数据卷应该是有四个吧?你怎么知道是哪个里面的呢?说分享下详细的还原步骤吗?
我有安官方的升级失败还原的方法迁移其他机器,但是失败,都跟新安装的一样