---
title: "添加 OBProxy | OceanBase 文档中心"
description: 添加 OBProxy 您可以通过 OCP 或 OBD 添加新的 OBProxy 到已有的 OBProxy 集群中。 前提条件 已创建 OBProxy 集群，OBProxy 集群创建相关操作请参见 创建 OBProxy 集群 。 通过 OCP 添加 OBProxy 登录 OCP。 OCP 的部署和使用，参见 Ocean…
image: https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*OSPzQ6GUQF4AAAAAQHAAAAgAeiGDAQ/original
---
切换语言

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

文档反馈![](https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*P8CuR4UJ_FkAAAAAAAAAAAAADiGDAQ/original) OceanBase 数据库分布式版 - V 4.0.0 社区版

# 添加 OBProxy

更新时间：2026-04-17 09:08:46

[编辑](https://github.com/oceanbase/oceanbase-doc/edit/V4.0.0/zh-CN/500.administrator-guide/500.database-connection-and-routing/200.obproxy-management/300.obproxy-management/100.add-obproxy.md)  

您可以通过 OCP 或 OBD 添加新的 OBProxy 到已有的 OBProxy 集群中。

## 前提条件

已创建 OBProxy 集群，OBProxy 集群创建相关操作请参见 [创建 OBProxy 集群](https://www.oceanbase.com/docs/community-observer-cn-10000000000901737)。

## 通过 OCP 添加 OBProxy

1. 登录 OCP。

   OCP 的部署和使用，参见 [OceanBase 云平台](https://www.oceanbase.com/docs/community-ocp-cn-10000000000866565)。
 2. 在左侧导航栏单击 **OBProxy**。
 3. 在集群列表中选择需要操作的 OBProxy 集群，进入 OBPRoxy 集群总览页面。
 4. 单击 **添加 OBProxy**。

   ![1](http://icms-x-dita.oss-cn-zhangjiakou.aliyuncs.com/xdita-output/zh-CN/task15904357/images/p352396.png?Expires=7258125491&OSSAccessKeyId=LTAIJfoPL6wmrirR&Signature=wMX8um4e3OTeBHz6rfVEyX7Jef4%3D)
 5. 在弹出框中填写 **软件版本**、**SQL 端口**、**Exporter 端口**、**机房**、**机型**、**机器选择方式**、**主机** 等信息。

   ![1](http://icms-x-dita.oss-cn-zhangjiakou.aliyuncs.com/xdita-output/zh-CN/task15904357/images/p273264.png?Expires=7258125491&OSSAccessKeyId=LTAIJfoPL6wmrirR&Signature=GLvWKJESP%2BnPIth9YwYdB1Xcfio%3D)

   参考下表填写信息：

   | 参数 | 说明 |
   | --- | --- |
   | SQL 端口 | 默认为 2883。 |
   | Exporter 端口 | 默认为 2884。 |
   | 软件版本 | 选择要安装的 OBProxy 版本。 |
   | 选择 OBProxy 主机 | 选择部署 OBProxy 所使用的主机，包括该主机的 机房、机型（可选）、机器选择方式、主机 IP。 |
 6. 单击 **确定**。

## 通过 OBD 添加 OBProxy

### 前提条件

- 已创建的 OBProxy 集群需是使用 OBD 创建的集群。
 - 您已部署可供 OBProxy 连接的 OceanBase 集群。

### 操作步骤

1. 从 [GitHub](https://github.com/oceanbase/obdeploy/blob/master/example/obproxy/obproxy-only-example.yaml) 上下载对应的配置文件模板。
 2. 根据自身机器情况修改配置文件，配置文件各个模块的含义可参考 [配置文件说明](https://www.oceanbase.com/docs/community-obd-cn-1000000000050418)。

   > **注意**
   >
   >  
   >
   > 您需在 `rs_list` 配置项中按要求填写该 OBProxy 集群可访问的 OceanBase 集群 IP 和 mysql_port 端口。
 3. 执行如下命令部署新集群。

   ```bash
   obd cluster deploy <deploy_name> -c <deploy_config_path>

   ```

   其中，参数 `deploy_name` 为部署集群名称，可以理解为配置文件的别名，`deploy_config_path` 为配置文件名。

   在您执行了 `obd cluster deploy` 命令之后，OBD 将检查您的目标机器是否有 OBProxy 安装包。如果没有安装包，OBD 将自动从 yum 源获取。
 4. 参考下述步骤将新建集群的信息添加到原 OBProxy 集群中。

      1. 查看配置路径：

        ```bash
        obd cluster list

        ```
      2. 打开原集群配置文件，并添加新部署集群的配置：

        ```bash
        vim .obd/cluster/<deploy_name>/config.yaml

        ```

        修改后的配置文件可参考如下文件：

        ```yaml
         ## Only need to configure when remote login is required
         user:
           username: admin
           # password: your password if need
           key_file: /home/admin/.ssh/id_rsa.pub
           # port: your ssh port, default 22
           # timeout: ssh connection timeout (second), default 30
         obproxy-ce:
           servers:
              - name: z1
                 ip: xxx.xx.xxx.xx # 原集群 IP
              - name: z2
                 ip: xxx.xx.xxx.xx # 新集群 IP
         global:
           listen_port: 2883 # External port. The default value is 2883.
           prometheus_listen_port: 2884 # The Prometheus port. The default value is 2884.
           home_path: /home/admin/obproxy
           # oceanbase root server list
           # format: ip:mysql_port;ip:mysql_port. When a depends exists, OBD gets this value from the oceanbase-ce of the depends.
           rs_list: xxx.xx.xxx.xx:2881;xxx.xx.xxx.xx:2881;xxx.xx.xxx.xx:2881
           enable_cluster_checkout: false
           # observer cluster name, consistent with oceanbase-ce's appname. When a depends exists, OBD gets this value from the oceanbase-ce of the depends.
           cluster_name: obcluster
           skip_proxy_sys_private_check: true
           enable_strict_kernel_release: false
           # obproxy_sys_password: # obproxy sys user password, can be empty. When a depends exists, OBD gets this value from the oceanbase-ce of the depends.
           # observer_sys_password: # proxyro user pasword, consistent with oceanbase-ce's proxyro_password, can be empty. When a depends exists, OBD gets this value from the oceanbase-ce of the depends.

        ```
 5. 执行如下命令再次启动集群：

   ```bash
   obd cluster start <deploy_name>

   ```
 6. 执行如下命令查看集群状态：

   ```bash
   obd cluster display <deploy_name>

   ```

   出现如下结果即表示集群创建成功：

   ```sql
   Get local repositories and plugins ok
   Open ssh connection ok
   Cluster status check ok
   Connect to obproxy ok
   +---------=----------------------------------------+
   |                     obproxy                      |
   +---------=------+------+-----------------+--------+
   | ip             | port | prometheus_port | status |
   +----------------+------+-----------------+--------+
   | 172.xxx.xxx.24 | 2883 | 2884            | active |
   | 172.xxx.xxx.25 | 2883 | 2884            | active |
   +-------------=--+------+-----------------+--------+

   ```

> **说明**
>
>  
>
> 上述步骤中使用的到 OBD 命令，详细信息可参考 [集群命令组](https://www.oceanbase.com/docs/community-obd-cn-1000000000050428)。

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