动态修改OBServer 的 CPU 上限步骤

以 2C 的机器为例,不同配置下机器上的 OBServer 的 CPU 上限:

--连接集群
obclient -h192.168.40.110 -P2881 -uroot@sys -p'61608Hhd820.' -Doceanbase -A

--修改前查看参数: scope 列对应的值为 CLUSTER 表示该配置项为集群级别;如果 scope 列对应的值为 TENANT,则表示该配置项为租户级别。
obclient(root@sys)[oceanbase]> show parameters like 'cpu_count';
+-------+----------+----------------+----------+-----------+-----------+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+---------------+-----------+
| zone  | svr_type | svr_ip         | svr_port | name      | data_type | value | info                                                                                                                                                                             | section  | scope   | source  | edit_level        | default_value | isdefault |
+-------+----------+----------------+----------+-----------+-----------+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+---------------+-----------+
| zone1 | observer | 192.168.40.110 |     2882 | cpu_count | INT       | 8     | 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 | 0             |         0 |
+-------+----------+----------------+----------+-----------+-----------+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+---------------+-----------+
1 row in set (0.019 sec)

--更改OBServer 自动检测服务器的 CPU 核数 
ALTER SYSTEM SET cpu_count=0;

SELECT SVR_IP,CPU_CAPACITY FROM GV$OB_SERVERS WHERE SVR_IP='192.168.40.110'; 返回2

--更改OBServer  自定义CPU 核数 为1
ALTER SYSTEM SET cpu_count=1;

SELECT SVR_IP,CPU_CAPACITY FROM GV$OB_SERVERS WHERE SVR_IP='192.168.40.110'; 返回1

参数说明:
● cpu_count 默认为 0 时,OBServer 自动检测服务器的 CPU 核数,实际的 CPU_COUNT 等于 CPU 核数。
● 可以在 GV$OB_SERVERS 内部表的 CPU_CAPACITY 字段查看实际生效的值。