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.
Removing resource pools from a tenant is usually performed when you want to reduce the number of replicas for a tenant.
Background
Assuming that a cluster has two zones, z1 and z2, both belonging to the same region, with one OBServer node in each zone. There is a regular tenant named tenant1 with the following replica distribution: locality='F@z1,F@z2', 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') and CREATE RESOURCE POOL pool2 UNIT 'uc2', UNIT_NUM 1, ZONE_LIST ('z2').
According to business requirements, the number of replicas of tenant1 needs to be reduced from 2 to 1 and the number of resource pools needs to be reduced from 2 to 1. That is, the locality of the tenant needs to be changed to locality='F@z1', 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, when the number of replicas of a tenant changes from 2 to 1, you can directly change the locality to
F@z1. For more information about the locality modification rules, see Modify locality.obclient>ALTER TENANT tenant1 LOCALITY='F@z1';Delete the
pool2resource pool fromz2.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.