问题现象
在 OceanBase 数据库 V3.x 版本中主备切换时,报错 ERROR 4179 (HY000): pre-check failed, switchover to standby not allowed。
主备切换。
MySQL [oceanbase]> ALTER SYSTEM COMMIT TO SWITCHOVER TO PHYSICAL STANDBY; ERROR 4179 (HY000): pre-check failed, switchover to standby not allowed登录主集群,查询
V$OB_STANDBY_STATUS视图,查看各个备集群的日志传输模式。MySQL [oceanbase]> SELECT * FROM V$OB_STANDBY_STATUS;输出结果如下:
+------------+--------------+------------------+----------------+------------------+-----------------------+------------------------------+-----------+---------------+ | cluster_id | cluster_name | cluster_role | cluster_status | current_scn | rootservice_list | redo_transport_options | protection_level | synchronization_status | +------------+--------------+------------------+----------------+------------------+-----------------------+------------------------------+-----------+---------------+ | 1721728395 | obtest | PHYSICAL STANDBY | VALID | 1722175185940113 | 172.xx.0.22:2882:2881 | ASYNC NET_TIMEOUT = 30000000 | MAXIMUM PERFORMANCE | NOT AVAILABLE | | 1721728397 | obtest | PHYSICAL STANDBY | VALID | 1722179509315001 | 172.xx.0.23:2882:2881 | ASYNC NET_TIMEOUT = 30000000 | MAXIMUM PERFORMANCE | OK | +------------+--------------+------------------+----------------+------------------+-----------------------+------------------------------+----------+----------------+ 2 rows in set (0.00 sec)查看关键日志信息。
[2024-07-28 22:52:03.042220] WDIAG [SHARE] ob_multi_cluster_util.cpp:324 [122996][0][xxxxx-xxxxx-xxxxx-xxxxx] [lt=4] [dc=0][errcode=0] failed to get cluster info(ret=0, tmp_ret=-4711, cluster_addr={cluster_id:1721728395, cluster_type:2, cluster_status:1, timestamp:1722168739390107, cluster_name:"obtest", addr_list:[{server:"172.xx.0.22:2882", role:1, sql_port:2881, replica_type:0, reserved:0, property:{memstore_percent_:100}}], readonly_addr_list:[], cluster_idx:1, current_scn:-1, redo_transport_options:{net_timeout:30000000, reopen:300000000, max_failure:0, is_sync:false}, protection_level:0, sync_status:0, last_hb_ts:-1}, arg={need_check_sync:false, max_primary_schema_version:-1, primary_schema_versions:{tenant_schema_versions:[]}, cluster_version:18446744073709551615, standby_became_primary_scn:-1}, cluster_info={cluster_id:-1, cluster_type:0, login_name:"", switchover_status:"SWITCHOVER_INVALID", cluster_status:0, switch_timestamp:0, is_sync:false, gc_snapshot_ts:-1, protection_mode:0, version:-1, protection_level:0}) [2024-07-28 22:52:03.042245] WDIAG [RS] ob_recovery_helper.cpp:1072 [122996][0][xxxxx-xxxxx-xxxxx-xxxxx] [lt=4] [dc=0][errcode=-4179] pre-check failed, refuse to switchover to standby(ret=-4179, cluster_info={cluster_id:1721728393, cluster_type:1, login_name:"__oceanbase_inner_standby_user", switchover_status:"SWITCHOVER_NORMAL", cluster_status:1, switch_timestamp:0, is_sync:false, gc_snapshot_ts:-1, protection_mode:0, version:1722164753108596, protection_level:0}, switchover_info={info:3440, info_str:"", synced_cluster_id_array:[], can_not_access_cluster:[]}) [2024-07-28 22:52:03.042255] WDIAG ob_recovery_helper.cpp:1073 [122996][0][xxxxx-xxxxx-xxxxx-xxxxx] [lt=8] [dc=0][errcode=-4179] pre-check failed, switchover to standby not allowed
问题原因
主集群下存在两套备集群,其中一套备集群之前已被强制删除,该备集群不可访问且已不存在,报错 -4711 即为对应 Cluster 不可访问。
因主集群里仍存在已删备集群信息,导致主备切换 pre-check failed,主集群无法向另外一套运行正常的备集群进行切换。
问题的风险及影响
主备切换无法通过 pre-check。
影响租户
影响 OceanBase 数据库中的 SYS 租户和 Oracle 租户以及 MySQL 租户。
适用版本
OceanBase 数据库 V2.x、V3.x 版本。
解决方法及规避方式
解决方法:
移除不可访问的备集群。
ALTER SYSTEM REMOVE CLUSTER cluster_name cluster_id xxxxx;规避方式:
删除备集群后,及时清理残留信息。建议通过 OCP 图形化界面,删除备集群,避免信息残留。