---
title: "创建 OBProxy 集群 | OceanBase 文档中心"
description: 创建 OBProxy 集群 功能说明 创建 OBProxy 集群时使用的接口。 调用说明 接口约束 调用者需要通过 OCP 应用服务鉴权。 请求路径 POST /api/v2/obproxy/clusters 请求参数 参数 类型 必选 示例值 描述 name String 是 foo OBProxy 集群名 add…
---
切换语言

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

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

# 创建 OBProxy 集群

更新时间：2023-08-30 10:06:07

## 功能说明

创建 OBProxy 集群时使用的接口。

## 调用说明

**接口约束**

调用者需要通过 OCP 应用服务鉴权。

**请求路径**

`POST /api/v2/obproxy/clusters`

### 请求参数

| 参数 | 类型 | 必选 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| name | String | 是 | foo | OBProxy 集群名 |
| address | String | 否 | foo.bar | OBProxy 集群访问地址 |
| port | Integer | 否 | 2883 | OBProxy 集群访问端口 |
| workMode | String | 否 | CONFIG_URL | OBProxy 集群工作模式： * CONFIG_URL * RS_LIST |
| obproxyInstallParam | Object | 否 | -- | 创建 OBProxy 集群时需要安装的 OBProxy 信息 |
| ├─hostIds | Array | 是 | [1,2] | 需要被安装 OBProxy 的主机 ID |
| ├─sqlPort | Integer | 是 | 2883 | OBProxy sql 端口 |
| ├─exporterPort | Integer | 是 | 2884 | OBProxy exporter 端口 |
| ├─version | String | 是 | obproxy-1.9.1.1-1919579.el7.x86_64.rpm | 软件包版本 |
| obLinks | Array | 是 | -- | 可连接 OB 集群信息，数据结构见 ObLink。RS_LIST 模式下有且只能有一个可连接 OB 集群。CONFIG_URL 模式下无限制。 |
| startupParameters | Array | 是 | -- | OBProxy 启动参数，数据结构见 ObproxyParameter。可以为空数组。 |
| parameters | Array | 是 | -- | OBProxy 非启动参数，数据结构见 ObproxyParameter。可以为空数组。 |

ObLink 的数据结构

| 参数 | 类型 | 必选 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| clusterName | String | 是 | foo | OB 集群名 |
| obClusterId | Integer | 是 | 1 | OB 集群 ID |
| username | String | 是 | proxyro | 连接集群用户 |

ObproxyParameter 的数据结构

| 参数 | 类型 | 必选 | 示例值 | 描述 |
| --- | --- | --- | --- | --- |
| name | String | 是 | foo | 参数名称 |
| value | String | 是 | bar | 参数值 |

### 返回结果

基础数据结构

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

## 示例

### 请求示例

`POST /api/v2/obproxy/clusters`

```unknow
{
        "obproxyInstallParam": {
                "hostIds": []
        },
        "obLinks": [{
                "clusterName": "hooray",
                "clusterId": 1,
                "username": "proxyro",
                "obClusterId": 1
        }],
        "name": "OBProxy001",
        "address": "foo.bar",
        "port": 2883,
        "workMode": "CONFIG_URL"
}

```

### 返回示例

```unknow
{
        "data": {
                "context": {
                        "listMap": {},
                        "parallel": false,
                        "parallelIdx": -1,
                        "stringMap": {
                                "prohibit_rollback": "false"
                        }
                },
                "creator": "admin",
                "executor": "xxx.xxx.xxx.xxx",
                "id": 31257,
                "name": "Install obproxy",
                "operation": "EXECUTE",
                "startTime": "2021-09-03T15:05:01.101+08:00",
                "status": "RUNNING",
                "subtasks": [{
                        "className": "com.alipay.ocp.service.task.business.obproxy.FinishTask",
                        "description": "Finish node",
                        "downstreams": [],
                        "id": 32955,
                        "name": "Finish node",
                        "nodeType": "JAVA_TASK",
                        "operation": "EXECUTE",
                        "parallelIdx": -1,
                        "prohibitRollback": false,
                        "runTime": 1,
                        "seriesId": 1,
                        "status": "PENDING",
                        "timeout": 0,
                        "upstreams": [32954]
                }, {
                        "className": "com.alipay.ocp.service.task.business.obproxy.PrepareObproxyInstallTask",
                        "description": "Prepare obproxy install",
                        "downstreams": [32955],
                        "id": 32954,
                        "name": "Prepare obproxy install",
                        "nodeType": "JAVA_TASK",
                        "operation": "EXECUTE",
                        "parallelIdx": -1,
                        "prohibitRollback": false,
                        "runTime": 1,
                        "seriesId": 0,
                        "status": "READY",
                        "timeout": 300,
                        "upstreams": []
                }],
                "taskDefinitionId": -1,
                "type": "MANUAL"
        },
        "duration": 82,
        "server": "a83ad33525",
        "status": 200,
        "successful": true,
        "timestamp": "2021-09-03T15:05:01.106+08:00",
        "traceId": "e874a2cead544112"
}

```

 上一篇 下一篇 ![有帮助](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) 咨询热线
