You can modify the UNIT, UNIT_NUM, and ZONE_LIST parameters for a resource pool. This topic introduces the modification procedure.
You can use the ALTER RESOURCE POOL statement to modify attributes of a resource pool.
You can scale up or down a tenant by modifying the attributes of its resource pool. For example, you can increase the value of UNIT_NUM to increase the number of nodes in each zone to scale out the tenant.
Procedure
Log on to the sys tenant of the cluster as the root user.
obclient -h172.30.xx.xx -P2883 -uroot@sys#cluster -p**** -AAccess the database named
oceanbase.obclient [(none)]> USE oceanbase;Query the
DBA_OB_RESOURCE_POOLSview for the configuration information about resource pools.To query the configuration information about the resource pool named
mq_pool_02, execute the following statement: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 DBA_OB_RESOURCE_POOLS.Execute the
ALTER RESOURCE POOLstatement to modify the configurations of the resource pool.Notice
- This statement modifies only one attribute at a time. To modify two or more of the
UNIT,UNIT_NUM, andZONE_LISTattributes, execute this statement multiple times. - When you modify the
ZONE_LISTattribute, you can add or remove only one zone at a time.
The syntax is as follows:
ALTER RESOURCE POOL pool_name UNIT [=] unit_name, UNIT_NUM [=] unit_num, ZONE_LIST [=] ('zone' [, 'zone' ...]);The parameters are described as follows:
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, you cannot modify the
UNIT_NUMattribute. You must use theALTER RESOURCE TENANTstatement to modify it.ZONE_LIST: the distribution of the resource pool in zones.
For more information about the
ALTER RESOURCE POOLstatement, see ALTER RESOURCE POOL.For more information about the
ALTER RESOURCE TENANTstatement, see ALTER RESOURCE TENANT.Here are some examples:
The resource pool is not allocated to any tenant
To set the unit config to
'S2_unit_config', the number of resource units to 3, andZONE_LISTto'zone1','zone2','zone3'for themq_pool_02tenant, execute the following statements: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 affectedThe resource pool is allocated to a tenant
You must use the
ALTER RESOURCE TENANTstatement to modify theUNIT_NUMattribute of a resource pool allocated to a tenant.To set the unit config to
'S2_unit_config', the number of resource units to 3, andZONE_LISTto'zone1','zone2','zone3'for themq_pool_02tenant, execute the following statements: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
- This statement modifies only one attribute at a time. To modify two or more of the
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