You can modify the attributes of a resource pool by adjusting the parameters of the resource pool, such as the UNIT, UNIT_NUM, and ZONE_LIST parameters. This topic describes how to modify the attributes of a resource pool.
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 resources for a tenant. For example, you can increase the value of UNIT_NUM to add more nodes to each zone.
Procedure
Log in to the
systenant of the cluster as therootuser.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.For example, 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 setExecute 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 by using theALTER RESOURCE POOLstatement. Instead, use theALTER RESOURCE TENANTstatement.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 to3, andZONE_LISTto'zone1','zone2','zone3'for the resource pool namedmq_pool_02, 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 to3, andZONE_LISTto'zone1','zone2','zone3'for the resource pool namedmq_pool_02, 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