---
title: "Failover 容灾切换 - 云平台 OCP V4.3.0 | OceanBase 文档中心"
description: "Failover 容灾切换 功能说明 容灾切换，指定备集群切为主集群。 调用说明 接口约束 无。 请求路径 POST /api/v2/ob/clusters/{id}/failover 请求参数 path： 参数 类型 必选 示例值 描述 id Integer 是 1 集群 ID。 返回结果 基础数据结构 参数 类型…"
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

文档反馈![](https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*lJTmRZ61jSUAAAAAAAAAAAAADiGDAQ/original) 云平台 OCPV 4.3.0

# Failover 容灾切换

更新时间：2026-04-14 11:55:54

[编辑](https://github.com/oceanbase/ocp-doc/edit/V4.3.0/zh-CN/1900.reference-guide/200.api-reference/450.cluster-information/2900.failover-switchover.md)  

## 功能说明

容灾切换，指定备集群切为主集群。

## 调用说明

### 接口约束

无。

### 请求路径

`POST /api/v2/ob/clusters/{id}/failover`

### 请求参数

**path：**

| 参数 | 类型 | 必选 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| id | Integer | 是 | 1 | 集群 ID。 |

### 返回结果

**基础数据结构**

| 参数 | 类型 | 说明 |
| --- | --- | --- |
| data | Object | 异步任务信息，详情参见 [任务返回结构](https://www.oceanbase.com/docs/common-ocp-1000000000826896)。 |
| successful | Boolean | 请求是否成功。 |
| timestamp | Datetime | 服务端完成请求的时间戳。 |
| duration | Integer | 服务端处理请求的时间（毫秒）。 |
| status | Integer | 符合 HTTP Status 规范的编码。 |
| traceId | String | 请求的 Trace ID，用于排查问题。 |
| server | String | 响应请求的应用服务的地址。 |

## 示例

### 请求示例

`POST /api/v2/ob/clusters/1/failover`

### 返回示例

```shell
{
  "data": {
    "clusterId": 6,
    "creator": "admin",
    "executor": "xxx.xxx.xxx.xxx",
    "id": 171603,
    "name": "Failover OB cluster",
    "operation": "EXECUTE",
    "prohibitRollback": false,
    "startTime": "2022-09-05T13:39:18.441+08:00",
    "status": "RUNNING",
    "subtasks": [
      {
        "description": "Wait node",
        "downstreams": [
          202627
        ],
        "id": 202625,
        "name": "Wait node",
        "nodeType": "JAVA_TASK",
        "operation": "EXECUTE",
        "parallelIdx": -1,
        "prohibitRollback": false,
        "runTime": 1,
        "seriesId": 6,
        "status": "PENDING",
        "timeout": 30,
        "upstreams": [
          202621
        ]
      },
      {
        "description": "Remove standby cluster",
        "downstreams": [
          202624
        ],
        "id": 202622,
        "name": "Remove standby cluster",
        "nodeType": "JAVA_TASK",
        "operation": "EXECUTE",
        "parallelIdx": 0,
        "prohibitRollback": true,
        "runTime": 1,
        "seriesId": 3,
        "status": "PENDING",
        "timeout": 1800,
        "upstreams": [
          202620
        ]
      },
      {
        "description": "Sync all cluster info",
        "downstreams": [
          202622
        ],
        "id": 202620,
        "name": "Sync all cluster info",
        "nodeType": "JAVA_TASK",
        "operation": "EXECUTE",
        "parallelIdx": -1,
        "prohibitRollback": false,
        "runTime": 1,
        "seriesId": 7,
        "status": "PENDING",
        "timeout": 60,
        "upstreams": [
          202627
        ]
      },
      {
        "description": "Failover to Primary",
        "downstreams": [
          202621
        ],
        "id": 202628,
        "name": "Failover to Primary",
        "nodeType": "JAVA_TASK",
        "operation": "EXECUTE",
        "parallelIdx": -1,
        "prohibitRollback": true,
        "runTime": 1,
        "seriesId": 4,
        "status": "PENDING",
        "timeout": 1800,
        "upstreams": [
          202626
        ]
      },
      {
        "description": "Mc lock ob clusters",
        "downstreams": [
          202626
        ],
        "id": 202623,
        "name": "Mc lock ob clusters",
        "nodeType": "JAVA_TASK",
        "operation": "EXECUTE",
        "parallelIdx": -1,
        "prohibitRollback": false,
        "runTime": 1,
        "seriesId": 8,
        "status": "READY",
        "timeout": 60,
        "upstreams": []
      },
      {
        "description": "Update OB cluster status",
        "downstreams": [
          202625
        ],
        "id": 202621,
        "name": "Update OB cluster status",
        "nodeType": "JAVA_TASK",
        "operation": "EXECUTE",
        "parallelIdx": 0,
        "prohibitRollback": false,
        "runTime": 1,
        "seriesId": 1,
        "status": "PENDING",
        "timeout": 30,
        "upstreams": [
          202628
        ]
      },
      {
        "description": "Failover to Primary Check",
        "downstreams": [
          202628
        ],
        "id": 202626,
        "name": "Failover to Primary Check",
        "nodeType": "JAVA_TASK",
        "operation": "EXECUTE",
        "parallelIdx": -1,
        "prohibitRollback": true,
        "runTime": 1,
        "seriesId": 5,
        "status": "PENDING",
        "timeout": 1800,
        "upstreams": [
          202623
        ]
      },
      {
        "description": "Mc ob failover update mc ob cluster",
        "downstreams": [
          202620
        ],
        "id": 202627,
        "name": "Mc ob failover update mc ob cluster",
        "nodeType": "JAVA_TASK",
        "operation": "EXECUTE",
        "parallelIdx": -1,
        "prohibitRollback": false,
        "runTime": 1,
        "seriesId": 0,
        "status": "PENDING",
        "timeout": 60,
        "upstreams": [
          202625
        ]
      },
      {
        "description": "Mc unlock ob clusters",
        "downstreams": [],
        "id": 202624,
        "name": "Mc unlock ob clusters",
        "nodeType": "JAVA_TASK",
        "operation": "EXECUTE",
        "parallelIdx": -1,
        "prohibitRollback": false,
        "runTime": 1,
        "seriesId": 2,
        "status": "PENDING",
        "timeout": 60,
        "upstreams": [
          202622
        ]
      }
    ],
    "taskDefinitionId": -1,
    "type": "MANUAL"
  },
  "duration": 148,
  "server": "xxx.xxx.xxx.xxx",
  "status": 200,
  "successful": true,
  "timestamp": "2022-09-05T13:39:18.451+08:00",
  "traceId": "b0f5f8868349493c"
}

```

 上一篇 下一篇 ![有帮助](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)[AI](https://www.oceanbase.com/obi) 咨询热线
