---
title: OCP 主备集群架构下，黑屏备集群有损 Failover 引发 OBProxy（obconfig_url 方式部署）路由问题的原因和解决方法-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于OCP 主备集群架构下，黑屏备集群有损 Failover 引发 OBProxy（obconfig_url 方式部署）路由问题的原因和解决方法相关的常见问题和使用技巧，帮助您快速解决OCP 主备集群架构下，黑屏备集群有损 Failover 引发 OBProxy（obconfig_url 方式部署）路由问题的原因和解决方法的难题。
image: https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*OSPzQ6GUQF4AAAAAQHAAAAgAeiGDAQ/original
---
[OceanBase AI 数据大会](https://www.oceanbase.com/conference2026 "OceanBase AI 数据大会")

## 体验新一代 AI 数据平台

[立即咨询](https://www.oceanbase.com/contactus) [免费试用 免费试用](https://www.oceanbase.com/free-trial)划线反馈

# OCP 主备集群架构下，黑屏备集群有损 Failover 引发 OBProxy（obconfig_url 方式部署）路由问题的原因和解决方法

更新时间：2026-07-08 08:01

适用版本： V3.x、V4.x 内容类型：Troubleshoot  

## 问题现象

OCP 主备架构下，黑屏执行 OceanBase 数据库备集群有损 Failover，obconfig_url 方式部署的 OBproxy 无法访问新主集群且重启无效。

## 问题原因

黑屏环境下 OceanBase 数据库主备集群 Failover 报错，集群变更信息不会同步至 OCP，引发主备切换后新主集群 obconfig_url 仍指向故障原主集群 Rslist 节点，连接异常。

## 影响租户

影响 OceanBase 数据库中的 SYS 租户和 Oracle 租户以及 MySQL 租户。

## 适用版本

OceanBase 数据库 V3.x 版本、OCP V4.x 版本。

## 解决方法

模拟 OCP 白屏 Failover 步骤，正确修正 OCP_meta 元数据。

#### 备注

OCP 主集群存活时，登录主集群 ocp_meta 执行；OCP 主集群宕机时，备 OCP 切换为主集群后登录至新主 ocp_meta 执行。

1. ocp_meta 库 lock ob clusters （主、备集群）。

      1. 查询集群同步信息表 mc_ob_cluster。

        ```shell
        select ocp_cluster_id,ob_cluster_id,type,lock_count,rootserver_json from mc_ob_cluster where ob_cluster_id in($standby_cluster_id,$primary_cluster_id);

        ```
      2. 更新集群同步信息表 mc_ob_cluster 信息。

        ```shell
        update mc_ob_cluster set locker_id = ?, lock_count = 1 where ob_cluster_id = ? and ob_cluster_name = ? and locker_id is null and lock_count = 0, args: [$ocp_cluster_id, $standby_cluster_id, $cluster_name]

        update mc_ob_cluster set locker_id = ?, lock_count = 1 where ob_cluster_id = ? and ob_cluster_name = ? and locker_id is null and lock_count = 0, args: [$ocp_cluster_id, $primary_cluster_id, $cluster_name]

        ```
 2. 备集群 sys 租户 Failover to Primary。

   ```shell
   -- 设置 SQL 最大执行时间，单位是微秒。
   set ob_query_timeout = 1000000000;

   -- 设置调度转储的间隔时间，默认为 20s，建议修改为 3s。
   ALTER SYSTEM SET _ob_minor_merge_schedule_interval = '3s';

   -- 设置控制 OceanBase 数据库 L0 转储的工作线程数为 16。
   ALTER SYSTEM SET _mini_merge_concurrency = 16;

   -- 执行有损 Failover 命令，主库宕机，备库切换成主库。
   ALTER SYSTEM ACTIVATE PHYSICAL STANDBY CLUSTER;

   ```
 3. 确认 FAILOVER 结束。

   ```shell
   select timestamp,facility,message from v$ob_cluster_event_history where facility like '%failover%' order by timestamp;

   ```

   输出结果如下：

   ```shell
   +----------------------------+---------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | timestamp                  | facility            | message                                                                                                                                                              |
   +----------------------------+---------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | 2024-08-08 19:29:09.645256 | failover to primary | flag:"start", ddl_stmt_str:"ALTER SYSTEM ACTIVATE PHYSICAL STANDBY CLUSTER", trace_id:xxxxx-xxxxx-xxxxx-xxxxx                                           |
   | 2024-08-08 19:31:29.580348 | failover to primary | flag:"finish", failover#:1723116567631872, cost:139935091, ddl_stmt_str:"ALTER SYSTEM ACTIVATE PHYSICAL STANDBY CLUSTER", trace_id:xxxxx-xxxxx-xxxxx-xxxxx |
   +----------------------------+---------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+

   ```
 4. 备集群 sys 租户 Failover to Primary

   ```shell
   -- 设置调度转储的间隔时间为 20s。
   ALTER SYSTEM SET _ob_minor_merge_schedule_interval = '20s';

   -- 设置控制 OceanBase 数据库 L0 转储的工作线程数为 5.
   ALTER SYSTEM SET _mini_merge_concurrency = 5;

   ```
 5. ocp_meta 库 set abandoned status、update mc ob cluster。

   ```shell
   update ob_cluster set status = 'ABANDONED' where ob_cluster_name = '$cluster_name' and ob_cluster_id = $primary_cluster_id; (原主集群)
   delete from mc_ob_cluster where ob_cluster_name = '$cluster_name' and ob_cluster_id = $primary_cluster_id;

   update mc_ob_cluster set type = 'PRIMARY' where ob_cluster_name = '$cluster_name' and ob_cluster_id = $standby_cluster_id;  (新主集群)

   ```
 6. 新主集群 sys 租户 Remove standby cluster。

   ```shell
   -- 删除一个已经存在的备库。
   ALTER SYSTEM REMOVE CLUSTER $cluster_name cluster_id = $primary_cluster_id; (原主集群)

   ```
 7. ocp_meta 库 unlock ob clusters。

   ```shell
   -- 更新集群同步信息表 mc_ob_cluster 信息。
   update mc_ob_cluster set locker_id = null, lock_count = 0 where ob_cluster_id = $standby_cluster_id and ob_cluster_name = '$cluster_name' and locker_id = $ocp_cluster_id and lock_count = 1;  (新主集群)

   ```
 8. 查询集群同步信息表 mc_ob_cluster。

   ```shell
   select ocp_cluster_id, ob_cluster_id, ob_cluster_name, ocp_ob_cluster_id, type, architecture, rootserver_json, ob_version, locker_id, lock_count from mc_ob_cluster where ob_cluster_name = '$cluster_name' and ob_cluster_id = $standby_cluster_id;

   ```
 9. 重启备集群 OBProxy 验证连接。

Previous

[升级 OceanBase 集群时提示 “未找到升级所需安装包”](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000003403533)

Next

[创建 OceanBase 集群时报错 “Large System Extensions (LSE) not supported by host, observer cannot be deployed”](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000003403534) ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ) 咨询
