---
title: "扩容与组件变更 - 安装部署工具 OBD V3.6.0 | OceanBase 文档中心"
description: 扩容与组件变更 本节介绍如何为 obd 管理的集群进行扩容、组件新增、组件删除操作。 前提条件 在开始之前，请确保您已满足以下条件： 操作涉及的集群已处于运行中状态。 环境中已安装 obd V2.5.0 或以上版本。 环境中已安装 OBClient。 集群扩容 您可为集群中包含的除 oblogproxy 和 obbi…
---
切换语言

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

文档反馈![](https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*Qq8pT6yBPTcAAAAAAAAAAAAADiGDAQ/original) 安装部署工具 OBDV 3.6.0

# 扩容与组件变更

更新时间：2025-09-09 17:04:35

[编辑](https://github.com/oceanbase/obd-doc/edit/V3.6.0/zh-CN/400.user-guide/300.command-line-operations/300.manage-cluster/900.expansion-and-component-changes.md)  

本节介绍如何为 obd 管理的集群进行扩容、组件新增、组件删除操作。

## 前提条件

在开始之前，请确保您已满足以下条件：

- 操作涉及的集群已处于运行中状态。
 - 环境中已安装 obd V2.5.0 或以上版本。
 - 环境中已安装 OBClient。

## 集群扩容

您可为集群中包含的除 `oblogproxy` 和 `obbinlog-ce` 组件外的任意组件进行扩容，假设存在一个部署集群名（`deploy name`）为 `test` 的集群，本节以为该集群中 `oceanbase-ce` 组件扩容为例讲解如何操作。

1. 创建待新增节点的配置文件。

   ```shell
   [admin@test ~]$ vim scale_out.yaml

   ```

   此处以配置文件名为 `scale_out.yaml` 为例，实际操作时您可自由定义文件名。配置文件内容如下：

   ```yaml
   oceanbase-ce:
     servers:
       - name: server2
         ip: 10.10.10.2
     server2:
       mysql_port: 2881 # External port for OceanBase Database. The default value is 2881.
       rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882.
       home_path: /home/admin/observer
       zone: zone2

   ```

   您仅可在新建的配置文件中配置新节点的信息，不允许在该配置文件中修改原集群配置中的 `depends`、`global` 或其他 `server` 部分的配置。配置文件的格式及各个组件的配置项说明可参见 [配置文件说明](https://www.oceanbase.com/docs/common-obd-cn-1000000003892319)。
 2. 执行扩容命令。

   ```shell
   [admin@test ~]$ obd cluster scale_out test -c scale_out.yaml

   ```

   `obd cluster scale_out` 命令的详细介绍可参见 [集群命令组](https://www.oceanbase.com/docs/common-obd-cn-1000000003892230)。

   命令执行成功返回如下信息：

   ```shell
   Execute ` obd cluster display test ` to view the cluster status
   Trace ID: 3777cea4-dd1a-11ee-b38d-00163e0808cc
   If you want to view detailed obd logs, please run: obd display-trace 3777cea4-dd1a-11ee-b38d-00163e0808cc

   ```
 3. 验证扩容结果。

   复制命令行输出的 `obd cluster display` 命令并执行，可查看集群的状态，命令输出示例如下：

   ```shell
   +----------------------------------------------+
   |              oceanbase-ce                    |
   +------------+---------+------+-------+--------+
   | ip         | version | port | zone  | status |
   +------------+---------+------+-------+--------+
   | 10.10.10.1 | 4.2.1.2 | 2881 | zone1 | ACTIVE |
   | 10.10.10.2 | 4.2.1.2 | 2881 | zone2 | ACTIVE |
   +------------+---------+------+-------+--------+
   obclient -h10.10.10.1 -P2881 -uroot -p'********' -Doceanbase -A

   ```

   您可复制并执行上述输出的 obclient 命令登录 OceanBase 数据库，执行 `select svr_ip,id,zone,status from __all_server;` 命令查看集群中的节点信息，命令输出示例如下：

   ```shell
   +------------+----+-------+--------+
   | svr_ip     | id | zone  | status |
   +------------+----+-------+--------+
   | 10.10.10.1 |  1 | zone1 | ACTIVE |
   | 10.10.10.2 |  2 | zone2 | ACTIVE |
   +------------+----+-------+--------+

   ```
 4. 租户内资源扩容

   OceanBase 集群扩容成功后，租户内的资源扩容详见 [租户内资源扩容和缩容概述](https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000000821576)。

## 组件新增

您可向运行的集群中新增组件，目前支持通过 obd 部署的组件中，除 `obbinlog-ce` 外均支持新增。新增组件前需确认集群中不存在该组件。

此处假设存在一个部署集群名（`deploy name`）为 `test` 的集群，以向该集群中新增 `obagent` 组件为例讲解如何操作。

1. 查看集群组件信息。

   ```shell
   [admin@test ~]$ obd cluster edit-config test

   ```

   输出如下，集群中仅存在 oceanbase-ce 组件和 obproxy 组件。

   ```yaml
   ##Only need to configure when remote login is required
   user:
     username: admin
     key_file: /home/admin/.ssh/id_rsa
   oceanbase-ce:
     servers:
       - name: server1
         ip: 10.10.10.1
       - name: server2
         ip: 10.10.10.2
       - name: server3
         ip: 10.10.10.3
     global:
       cluster_id: 1
       mysql_port: 2881 # External port for OceanBase Database. The default value is 2881. DO NOT change this value after the cluster is started.
       rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882. DO NOT change this value after the cluster is started.
       home_path: /home/admin/observer
       ······ # 省略部分配置项
     server1:
       zone: zone1
     server2:
       zone: zone2
     server3:
       zone: zone3
   obproxy-ce:
     depends:
       - oceanbase-ce
     servers:
       - 10.10.10.1
     global:
       listen_port: 2883 # External port. The default value is 2883.
       prometheus_listen_port: 2884 # The Prometheus port. The default value is 2884.
       rpc_listen_port: 2885
       home_path: /home/admin/obproxy
       enable_cluster_checkout: false
       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.

   ```
 2. 创建新增 `obagent` 组件的配置文件。

   ```shell
   [admin@test ~]$ vim addtional_component.yaml

   ```

   此处以配置文件名为 `addtional_component.yaml` 为例，实际操作时您可自由定义文件名。配置文件内容如下：

   ```yaml
   obagent:
     depends:
       - oceanbase-ce
     servers:
       - name: server1
         ip: 10.10.10.1
       - name: server2
         ip: 10.10.10.2
       - name: server3
         ip: 10.10.10.3
     global:
       home_path: /home/admin/obagent

   ```

   配置文件的格式及各个组件的配置项说明可参见 [配置文件说明](https://www.oceanbase.com/docs/common-obd-cn-1000000003892319) 一文。

   #### 注意

   `obagent` 组件配置文件中的 `servers` 部分需和 `oceanbase-ce` 组件中 `servers` 部分配置保持完全一致，即使用相同的 `name` 和 `ip` 进行配置。
 3. 执行新增组件命令。

   ```shell
   [admin@test ~]$ obd cluster component add test -c addtional_component.yaml

   ```

   `obd cluster component add` 命令的详细介绍可参见 [集群命令组](https://www.oceanbase.com/docs/common-obd-cn-1000000003892230)。

   ```shell
   +---------------------------------------------------------------+
   |                          obagent                              |
   +------------+--------------------+--------------------+--------+
   | ip         | mgragent_http_port | monagent_http_port | status |
   +------------+--------------------+--------------------+--------+
   | 10.10.10.1 | 8089               | 8088               | active |
   | 10.10.10.2 | 8089               | 8088               | active |
   | 10.10.10.3 | 8089               | 8088               | active |
   +------------+--------------------+--------------------+--------+
   test running
   Trace ID: ae0122ea-ddd9-11ee-9b38-00163e0808cc
   If you want to view detailed obd logs, please run: obd display-trace ae0122ea-ddd9-11ee-9b38-00163e0808cc

   ```
 4. 结果验证。

   新增组件命令执行完成后，可执行 `obd cluster display` 命令查看集群的状态，示例如下：

   ```shell
   [admin@test ~]$ obd cluster display test

   ```

   输出如下，集群中已存在 `obagent` 组件信息。

   ```shell
   +----------------------------------------------+
   |              oceanbase-ce                    |
   +------------+---------+------+-------+--------+
   | ip         | version | port | zone  | status |
   +------------+---------+------+-------+--------+
   | 10.10.10.1 | 4.2.1.2 | 2881 | zone1 | ACTIVE |
   | 10.10.10.2 | 4.2.1.2 | 2881 | zone2 | ACTIVE |
   | 10.10.10.3 | 4.2.1.2 | 2881 | zone3 | ACTIVE |
   +------------+---------+------+-------+--------+
   obclient -h10.10.10.1 -P2881 -uroot -p'********' -Doceanbase -A

   Connect to obproxy ok
   +----------------------------------------------+
   |                   obproxy-ce                 |
   +------------+------+-----------------+--------+
   | ip         | port | prometheus_port | status |
   +------------+------+-----------------+--------+
   | 10.10.10.1 | 2883 | 2884            | active |
   +------------+------+-----------------+--------+
   obclient -h10.10.10.1 -P2883 -uroot@proxysys -p'********' -Doceanbase -A
   Connect to Obagent ok
   +---------------------------------------------------------------+
   |                          obagent                              |
   +------------+--------------------+--------------------+--------+
   | ip         | mgragent_http_port | monagent_http_port | status |
   +------------+--------------------+--------------------+--------+
   | 10.10.10.1 | 8089               | 8088               | active |
   | 10.10.10.2 | 8089               | 8088               | active |
   | 10.10.10.3 | 8089               | 8088               | active |
   +------------+--------------------+--------------------+--------+

   ```

## 组件删除

您可删除运行的集群中的组件，删除组件前需确认集群中存在该组件。

此处假设存在一个部署集群名（`deploy name`）为 `test` 的集群，以删除该集群中 `obagent` 和 `obproxy-ce` 组件为例讲解如何操作。

   ```

   输出如下，集群中存在 `oceanbase-ce` 组件、`obproxy-ce` 组件和 `obagent` 组件。

   ```yaml
   ##Only need to configure when remote login is required
   user:
     username: admin
     key_file: /home/admin/.ssh/id_rsa
   oceanbase-ce:
     servers:
       - name: server1
         ip: 10.10.10.1
       - name: server2
         ip: 10.10.10.2
       - name: server3
         ip: 10.10.10.3
     global:
       cluster_id: 1
       mysql_port: 2881 # External port for OceanBase Database. The default value is 2881. DO NOT change this value after the cluster is started.
       rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882. DO NOT change this value after the cluster is started.
       home_path: /home/admin/observer
       ······ # 省略部分配置项
     server1:
       zone: zone1
     server2:
       zone: zone2
     server3:
       zone: zone3
   obproxy-ce:
     depends:
       - oceanbase-ce
     servers:
       - 10.10.10.1
     global:
       listen_port: 2883 # External port. The default value is 2883.
       prometheus_listen_port: 2884 # The Prometheus port. The default value is 2884.
       rpc_listen_port: 2885
       home_path: /home/admin/obproxy
       enable_cluster_checkout: false
       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.
   obagent:
     depends:
       - oceanbase-ce
     servers:
       - name: server1
         ip: 10.10.10.1
       - name: server2
         ip: 10.10.10.2
       - name: server3
         ip: 10.10.10.3
     global:
       home_path: /home/admin/obagent

   ```
 2. 执行删除组件命令。

   ```shell
   [admin@test ~]$ obd cluster component del test obagent obproxy-ce

   ```

   `obd cluster component del` 命令的详细介绍可参见 [集群命令组](https://www.oceanbase.com/docs/common-obd-cn-1000000003892230)。
 3. 结果验证。

   删除组件命令执行完成后，可执行 `obd cluster display` 命令查看集群的状态。

   ```

   输出如下，集群中已不存在 ODP 和 OBAgent 的组件信息。

   ```

## 相关文档

- 本文中使用到的 obd 命令的详细介绍可参见 [集群命令组](https://www.oceanbase.com/docs/common-obd-cn-1000000003892230)。
 - 本文操作涉及的配置文件及配置项的详细说明可参见 [配置文件说明](https://www.oceanbase.com/docs/common-obd-cn-1000000003892319)。
 - 为集群中 `oceanbase-ce` 组件扩容后，您还可以为租户或资源池扩容，详细操作可参见 《OceanBase 数据库》文档 [租户资源水平扩缩容](https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000000220979)。
 - 使用 OBClient 登录 OceanBase 数据库的详细介绍可参见《OceanBase 数据库》文档 [通过 OBClient 连接 OceanBase 租户](https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000000218474)。

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