Modifying the attributes of a resource pool involves adjusting parameters such as UNIT, UNIT_NUM, and ZONE_LIST. This topic describes the modification procedure.
You can use the ALTER RESOURCE POOL statement to modify the attributes of a resource pool.
Modifying the attributes of a resource pool is another way to scale up or down a tenant. For example, you can increase the value of UNIT_NUM to increase the number of nodes in each zone to achieve scaling up.
Note
Currently, the values of the parameters related to resource pool attributes cannot be decreased.
Procedure
Log on to the
systenant of the cluster as the root user.obclient -h172.30.xx.xx -P2883 -uroot@sys#cluster -p**** -AEnter the
oceanbasedatabase.obclient [(none)]> USE oceanbase;Use the
DBA_OB_RESOURCE_POOLSview to query the configuration information of a resource pool.The following command uses the
mq_pool_02resource pool as an example:obclient [oceanbase]> SELECT * FROM DBA_OB_RESOURCE_POOLS WHERE NAME = 'mq_pool_02'; +------------------+------------+-----------+----------------------------+----------------------------+------------+----------------+-------------+--------------+ | RESOURCE_POOL_ID | NAME | TENANT_ID | CREATE_TIME | MODIFY_TIME | UNIT_COUNT | UNIT_CONFIG_ID | ZONE_LIST | REPLICA_TYPE | +------------------+------------+-----------+----------------------------+----------------------------+------------+----------------+-------------+--------------+ | 1026 | mq_pool_02 | NULL | 2023-01-10 23:54:24.177685 | 2023-01-10 23:54:24.177685 | 1 | 1020 | zone1;zone2 | FULL | +------------------+------------+-----------+----------------------------+----------------------------+------------+----------------+-------------+--------------+ 1 row in setFor more information about the
DBA_OB_RESOURCE_POOLSview, see oceanbase.DBA_OB_RESOURCE_POOLS.Execute the
ALTER RESOURCE POOLstatement to modify the attributes of the resource pool.Notice
- Only one attribute can be modified in a single statement. If two or more attributes in
UNIT,UNIT_NUM, andZONE_LISTneed to be modified at the same time, multiple statements need to be executed separately. - When modifying the
ZONE_LISTattribute, you can add or delete only one zone at a time.
Syntax:
ALTER RESOURCE POOL pool_name UNIT [=] unit_name, UNIT_NUM [=] unit_num, ZONE_LIST [=] ('zone' [, 'zone' ...]);Parameters:
pool_name: the name of the resource pool.UNIT: the unit config for the resource pool.UNIT_NUM: the number of resource units. When you add resource units, make sure that the value ofUNIT_NUMdoes not exceed the number of OBServer nodes in each zone.Notice
If a resource pool is allocated to a tenant, the number of resource units cannot be modified using
ALTER RESOURCE POOLstatement. Use theALTER RESOURCE TENANTstatement instead.ZONE_LIST: the distribution of zones in the resource pool.
For more information about the
ALTER RESOURCE POOLstatement, see ALTER RESOURCE POOL.For more information about the
ALTER RESOURCE TENANTstatement, see ALTER RESOURCE TENANT.Example:
If the resource pool is not allocated to any tenant
Set
UNITto'S2_unit_config',UNIT_NUMto 3, andZONE_LISTto'zone1','zone2','zone3'for themq_pool_02resource pool:obclient [oceanbase]> ALTER RESOURCE POOL mq_pool_02 UNIT='S2_unit_config'; Query OK, 0 rows affected obclient [oceanbase]> ALTER RESOURCE POOL mq_pool_02 UNIT_NUM=3; Query OK, 0 rows affected obclient [oceanbase]> ALTER RESOURCE POOL mq_pool_02 ZONE_LIST=('zone1','zone2','zone3'); Query OK, 0 rows affectedIf the resource pool is allocated to a tenant
Set
UNITto'S2_unit_config',UNIT_NUMto 3, andZONE_LISTto'zone1','zone2','zone3'for themq_pool_02resource pool. Note thatUNIT_NUMmust be modified using theALTER RESOURCE TENANTstatement.obclient [oceanbase]> ALTER RESOURCE POOL mq_pool_02 UNIT='S2_unit_config'; Query OK, 0 rows affected obclient [oceanbase]> ALTER RESOURCE TENANT mq_t2 UNIT_NUM=3; Query OK, 0 rows affected obclient [oceanbase]> ALTER RESOURCE POOL mq_pool_02 ZONE_LIST=('zone1','zone2','zone3'); Query OK, 0 rows affected
- Only one attribute can be modified in a single statement. If two or more attributes in
Query the
DBA_OB_RESOURCE_POOLSview to verify the modification result.The query result shows that the values of
UNIT_COUNT,UNIT_CONFIG_ID, andZONE_LISTare updated.obclient [oceanbase]> SELECT * FROM DBA_OB_RESOURCE_POOLS WHERE NAME = 'mq_pool_02'; +------------------+------------+-----------+----------------------------+----------------------------+------------+----------------+-------------------+--------------+ | RESOURCE_POOL_ID | NAME | TENANT_ID | CREATE_TIME | MODIFY_TIME | UNIT_COUNT | UNIT_CONFIG_ID | ZONE_LIST | REPLICA_TYPE | +------------------+------------+-----------+----------------------------+----------------------------+------------+----------------+-------------------+--------------+ | 1026 | mq_pool_02 | NULL | 2023-01-10 23:54:24.177685 | 2023-01-10 23:56:04.961771 | 2 | 1021 | zone1;zone2;zone3 | FULL | +------------------+------------+-----------+----------------------------+----------------------------+------------+----------------+-------------------+--------------+ 1 row in set