---
title: 通过 OAT 调整 MetaDB 组件的资源规格后如何让修改真正在集群内生效-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于通过 OAT 调整 MetaDB 组件的资源规格后如何让修改真正在集群内生效相关的常见问题和使用技巧，帮助您快速解决通过 OAT 调整 MetaDB 组件的资源规格后如何让修改真正在集群内生效的难题。
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)划线反馈

# 通过 OAT 调整 MetaDB 组件的资源规格后如何让修改真正在集群内生效

更新时间：2026-07-02 15:41

适用版本： V4.x、V3.x、V2.x 内容类型：How-to  

调整 MetaDB 组件的资源规格只变更了 metadb docker 容器使用的 CPU/Memory 的大小，但是 metacluster 实际可以使用的资源受 `cpu_count` 和 `memory_limit` 这两个参数控制，而这两个参数的值没有自动修改，导致可使用的资源没有发生变化。

## 适用版本

OAT V4.1.2 BP1 之前的版本。

## 操作方法

1. 修改 meta cluster 的集群参数 `cpu_count` 和 `memory_limit`。

      - `cpu_count` = MetaDB 容器的 CPU 核数。
      - `memory_limit` = MetaDB 容器的 memory - 3G。

   **方法一：黑屏修改。在 metadb 容器所在的服务器上，黑屏连接 root@sys 租户**

   ```shell
   $ mysql -h127.0.0.1 -uroot@sys -P2881 -pxxx -A oceanbase -c
   Welcome to the MariaDB monitor.  Commands end with ; or \g.
   Your MySQL connection id is 3221xxxxxxx
   Server version: 5.7.25 OceanBase 2.2.77 (r116010032023022813-4f4fbb6de5d75b4db00ee05d44d56d8c1500c21c) (Built Feb 28 2023 13:48:43)
   Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
   Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

   ```

   ```shell
   MySQL [oceanbase]> show parameters like 'cpu_count';
   +-------------+----------+---------------+----------+-----------+-----------+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
   | zone        | svr_type | svr_ip        | svr_port | name      | data_type | value | info                                                                                                                                                                             | section  | scope   | source  | edit_level        |
   +-------------+----------+---------------+----------+-----------+-----------+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
   | META_ZONE_1 | observer | xx.xx.xx.xx |     2882 | cpu_count | NULL      | 16    | the number of CPU\'s in the system. If this parameter is set to zero, the number will be set according to sysconf; otherwise, this parameter is used. Range: [0,+∞) in integer   | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
   +-------------+----------+---------------+----------+-----------+-----------+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
   1 row in set (0.01 sec)

   ```

   ```shell
   MySQL [oceanbase]> show parameters like 'memory_limit';
   +-------------+----------+---------------+----------+--------------+-----------+-------+-------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
   | zone        | svr_type | svr_ip        | svr_port | name         | data_type | value | info                                                                                | section  | scope   | source  | edit_level        |
   +-------------+----------+---------------+----------+--------------+-----------+-------+-------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
   | META_ZONE_1 | observer | xx.xx.xx.xx |     2882 | memory_limit | NULL      | 56G   | the size of the memory reserved for internal use(for testing purpose). Range: [0M,) | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
   +-------------+----------+---------------+----------+--------------+-----------+-------+-------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
   1 row in set (0.00 sec)

   ```

   ```shell
   MySQL [oceanbase]> ALTER SYSTEM SET cpu_count = '20'; --->设置cpu_count
   Query OK, 0 rows affected (0.04 sec)

   ```

   ```shell
   MySQL [oceanbase]> ALTER SYSTEM SET memory_limit='60G'; --->设置memory_limit
   Query OK, 0 rows affected (0.04 sec)
   MySQL [oceanbase]>

   ```

   **方法二：白屏修改**

   如果 meta cluster 已经接管到 OCP 中去了，可以直接在 OCP 白屏界面上调整相应的参数。
 2. 重启 meta cluster 使 `cpu_count` 的修改生效。

## 更多信息

OAT V4.1.2 BP1 修复了这个问题，可以自动变更 Metadb 中的资源规格，并重启 Docker 来使修改生效。

Previous

[OAT MetaDB 组件的小规格部署方案](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000340657)

Next

[OAT 4.0 接管 Metadb 报错 KeyError: MYSQL_PORT](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000284389) ![有帮助](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) 咨询
