#滚动升级回退
数据库升级过程中可能因为网络故障、命令错误、配置文件错误及版本错误等原因导致数据库升级失败,此时请运行升级回退恢复升级前环境。
Warn:
- 仅升级失败才允许回退。
- 升级回退的过程中会重启备库。
- 回退过程中,不建议对数据库节点进行其他操作。如无法避免,只能使用yasboot执行相关管理操作。
- 若升级失败且回退仍失败,请联系我们的技术支持解决。
升级成功后,执行回退会报错:
$ ./bin/yasboot cluster rollback -c yashandb -p sys_password --rolling
yashandb can't rollback because upgrade result is success
# 兼容版本间滚动升级的回退
# 步骤1:回退数据库
升级失败时执行升级回退预期结果:
$ ./bin/yasboot cluster rollback -c yashandb -p sys_password --rolling
+---------------------------------------------------------------------------------------------------------------------+
| type | uuid | name | hostid | index | status | return_code | progress | cost |
+---------------------------------------------------------------------------------------------------------------------+
| task | c82ebcbb5fb4acd3 | RollbackYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | - |
+-------+------------------+------------------------+--------+--------------+---------+-------------+----------+------+
task completed, status: SUCCESS
参数介绍:
-c, --cluster 集群名称
--rolling 滚动升级回退
若出现回退失败,且提示主库数量为0,请通过应用方式停止用户业务后使用以下命令重启旧版本数据库:
$ ./bin/yasboot cluster restart -c yashandb -p sys_password
+-------------------------------------------------------------------------------------------------------------+
| type | uuid | name | hostid | index | status | return_code | progress | cost |
+-------------------------------------------------------------------------------------------------------------+
| task | 93639d0b633d4eeb | ReStartYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | - |
+------+------------------+---------------------+--------+----------+---------+-------------+----------+------+
task completed, status: SUCCESS
# 步骤2:回退yasom与yasagent
$ ./bin/yasboot package rollback -c yashandb -t /home/yashan/install/hosts.toml
rollback package...
host0001 100% [====================================================================] 2s
参数介绍:
-c, --cluster 集群名称
-t, --toml 需要服务器配置文件hosts.toml,此处指部署旧版本时生成的hosts.toml文件
# 不兼容版本间滚动升级的回退
不兼容版本间滚动升级的回退,存在如下两种场景,以及相应的操作。
- 场景一:主节点是旧版本,将回退到旧版本。
- 场景二:主节点是新版本,只支持继续升级。
执行如下命令,根据输出结果判断是哪一场景。
$ ./bin/yasboot cluster rollback -c yashandb -p sys_password --rolling
参数介绍:
-c, --cluster 集群名称
--rolling 滚动升级回退
# 场景一:主节点是旧版本
若出现如下任务列表,表示主节点是旧版本。
+---------------------------------------------------------------------------------------------------------------------+
| type | uuid | name | hostid | index | status | return_code | progress | cost |
+---------------------------------------------------------------------------------------------------------------------+
| task | c82ebcbb5fb4acd3 | RollbackYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | - |
+-------+------------------+------------------------+--------+--------------+---------+-------------+----------+------+
task completed, status: SUCCESS
回退数据库成功后,执行如下命令回退yasom与yasagent。
$ ./bin/yasboot package rollback -c yashandb -t /home/yashan/install/hosts.toml
rollback package...
host0001 100% [====================================================================] 2s
参数介绍:
-c, --cluster 集群名称
-t, --toml 需要服务器配置文件hosts.toml,此处指部署旧版本时生成的hosts.toml文件
# 场景二:主节点是新版本
出现报错主节点是新版本,表示主节点是新版本。
check that the version of primary node is newer, please execute 'yasboot cluster upgrade --rolling --continue' to continue upgrade
按照提示,追加--continue参数继续升级。
./bin/yasboot cluster upgrade -c yashandb -p sys_password --rolling --continue
+------------------------------------------------------------------------------------------------------------------+
| type | uuid | name | hostid | index | status | return_code | progress | cost |
+------------------------------------------------------------------------------------------------------------------+
| task | 5729a3e06b5fc3aa | UpgradeYasdbClusterRolling | - | yashandb | SUCCESS | 0 | 100 | 27 |
+------+------------------+----------------------------+--------+----------+---------+-------------+----------+------+
task completed, status: SUCCESS
# 回退后操作
若为顺利执行升级而临时调整过某些配置(例如关闭仲裁),回退后若无需再升级应按需还原配置(例如重新开启仲裁)。

