Removing resource pools from a tenant usually happens when you want to reduce the number of replicas for a tenant. You can use the ALTER TENANT statement to remove resource pools from a tenant.
The corresponding SQL syntax is as follows:
ALTER TENANT tenant_name RESOURCE_POOL_LIST [=](pool_name [, pool_name...]) ;
Note the following:
This statement can only be executed by the administrator of the
systenant.For
RESOURCE_POOL_LIST, only one resource pool can be deleted at a time.
Example
Assuming that a cluster has a total of 5 zones, z1, z2, z3, z4, and z5, all belonging to the same region, with one OBServer in each zone. There is a regular tenant named tenant1 with the following locality: locality='F@z1,F@z2,F@z3,F@z4,F@z5', resource_pool_list=('pool1','pool2'). The resource distribution of the resource pools is as follows: CREATE RESOURCE POOL pool1 UNIT 'uc1', UNIT_NUM 1, ZONE_LIST ('z1', 'z2', 'z3') and CREATE RESOURCE POOL pool2 UNIT 'uc2', UNIT_NUM 1, ZONE_LIST ('z4', 'z5').
According to business requirements, it is necessary to reduce the number of replicas from 5 to 3 and the number of resource pools from 2 to 1 for tenant1. That is, the locality of the tenant needs to be changed to locality='F@z1,F@z2,F@z3,', resource_pool_list=('pool1').
Procedure
Log in to the
systenant of the cluster using therootuser.Modify the locality of
tenant1to delete replicas.According to the locality modification rules, only one zone’s locality can be deleted at a time. For more information about the locality modification rules, see Modify locality.
obclient>ALTER TENANT tenant1 LOCALITY='F@z1,F@z2,F@z3,F@z4'; obclient>ALTER TENANT tenant1 LOCALITY='F@z1,F@z2,F@z3';Delete the
pool2resource pool fromz4andz5.obclient>ALTER TENANT tenant1 RESOURCE_POOL_LIST =('pool1') ;
More information
For other scenarios where you need to adjust the available resources for a tenant, you can modify the configuration and number of resource units in the resource pools.
- For instructions on modifying resource unit configurations, see Modify a unit config.
- For instructions on modifying the number of resource units in a resource pool, see Modify attributes of a resource pool.