You can use the ALTER TENANT statement to remove a resource pool 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.
Removing a resource pool from a tenant is typically used when downgrading the number of tenant replicas.
Background information
Suppose the cluster currently has five zones (z1, z2, z3, z4, and z5), all belonging to the same Region, with one OBServer in each zone. The cluster has a user tenant tenant1 with the current replica distribution locality='F@z1,F@z2,F@z3,F@z4,F@z5', resource_pool_list=('pool1','pool2'). The resource distribution of the resource pools is: 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, the number of replicas for tenant1 needs to be reduced from 5 to 3 and the number of resource pools from 2 to 1. That is, the tenant's Locality 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 as therootuser.Delete replicas by modifying the Locality of
tenant1.According to the Locality modification rules, when changing a tenant from 5 replicas to 3 replicas, you can directly change the Locality to
F@z1,F@z2,F@z3. For more information about the Locality modification rules, see Modify Locality.obclient>ALTER TENANT tenant1 LOCALITY='F@z1,F@z2,F@z3';Remove the resource pool
pool2fromz4andz5.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 resource unit configuration. For instructions on modifying the number of resource units in a resource pool, see Modify resource pool properties.