You can modify the UNIT, UNIT_NUM, and ZONE_LIST parameters for a resource pool. This topic describes 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 in 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(root@sys)[(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(root@sys)[oceanbase]> SELECT * FROM DBA_OB_RESOURCE_POOLS WHERE NAME = 'mq_pool_02';Query result:
+------------------+------------+-----------+----------------------------+----------------------------+------------+----------------+-------------+--------------+ | 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
The current version supports heterogeneous zone mode. When modifying
UNIT_NUM:- In homogeneous zone mode, if the resource pool is already used by a tenant, you cannot modify it with the
ALTER RESOURCE POOLstatement. You need to use theALTER RESOURCE TENANTstatement instead. - In heterogeneous zone mode, even if the resource pool is already used by a tenant, you can modify it with the
ALTER RESOURCE POOLstatement. However, when making modifications, a tenant's resource pools can have at most two differentUNIT_NUMvalues.For example, if a tenant has three resource pools:
pool1,pool2, andpool3, withunit_numvalues of 2, 4, and 4 respectively, and you changepool3'sunit_numto 1, the system will report aMore than two distinct unit_num in a single tenant not allowederror.
For more information about the
ALTER RESOURCE POOLstatement, see ALTER RESOURCE POOL.For more information about the
ALTER RESOURCE TENANTstatement, see ALTER RESOURCE TENANT.- In homogeneous zone mode, if the resource pool is already used by a tenant, you cannot modify it with the
ZONE_LIST: the distribution of the resource pool in zones.
Here are some examples:
Homogeneous zone modeHeterogeneous zone modeThe 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 the resource poolmq_pool_02, execute the following statements:obclient(root@sys)[oceanbase]> ALTER RESOURCE POOL mq_pool_02 UNIT='S2_unit_config';obclient(root@sys)[oceanbase]> ALTER RESOURCE POOL mq_pool_02 UNIT_NUM=3;obclient(root@sys)[oceanbase]> ALTER RESOURCE POOL mq_pool_02 ZONE_LIST=('zone1','zone2','zone3');The resource pool is allocated to a tenant
In homogeneous zone mode, when modifying the resource pool configuration for a tenant that has already been assigned the resource pool, you must use the
ALTER RESOURCE TENANTstatement to modifyUNIT_NUM.To set the unit config to
'S2_unit_config', the number of resource units to 3, andZONE_LISTto'zone1','zone2','zone3'for the resource poolmq_pool_02, execute the following statements:obclient(root@sys)[oceanbase]> ALTER RESOURCE POOL mq_pool_02 UNIT='S2_unit_config';obclient(root@sys)[oceanbase]> ALTER RESOURCE TENANT mq_t2 UNIT_NUM=3;obclient(root@sys)[oceanbase]> ALTER RESOURCE POOL mq_pool_02 ZONE_LIST=('zone1','zone2','zone3');
Notice
By default, existing tenants and upgraded tenants use homogeneous zone mode. To enable heterogeneous zone mode, set the tenant-level parameter
zone_deploy_modetohetero. After the change, you cannot revert tohomo(homogeneous zone mode).To set the unit config to
'S2_unit_config', the number of resource units to 3, andZONE_LISTto'zone1','zone2','zone3'for the resource poolmq_pool_02, execute the following statements:obclient(root@sys)[oceanbase]> ALTER RESOURCE POOL mq_pool_02 UNIT='S2_unit_config';obclient(root@sys)[oceanbase]> ALTER RESOURCE POOL mq_pool_02 UNIT_NUM=3;obclient(root@sys)[oceanbase]> ALTER RESOURCE TENANT mq_t2 UNIT_NUM=3;obclient(root@sys)[oceanbase]> ALTER RESOURCE POOL mq_pool_02 ZONE_LIST=('zone1','zone2','zone3');- 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(root@sys)[oceanbase]> SELECT * FROM DBA_OB_RESOURCE_POOLS WHERE NAME = 'mq_pool_02';The query result is as follows:
+------------------+------------+-----------+----------------------------+----------------------------+------------+----------------+-------------------+--------------+ | 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