When you use OceanBase Database, you may need to adjust the resource configurations of a tenant based on your business requirements.
You can modify the resource configurations of a tenant by using one of the following ways:
Scale up or down the resource unit configurations of the resource pool for the tenant.
Increase or decrease the number of resource units.
Expand or narrow the application scope of tenant data across the zones.
Scale up or down the resource unit configurations of the resource pool for the tenant
Operations for scaling up or down the resource unit configurations of the resource pool for the tenant are the same as those for tenant scaling. For more information, see Modify unit_config.
Increase or decrease the number of resource units
Operations for increasing or decreasing the number of resource units are the same as those for tenant scaling. For more information, see Modify UNIT_NUM.
Expand or narrow the application scope of tenant data across the zones
You can modify the ZONE_LIST parameter to expand or narrow the usage scope of resource pools on zones.
Expand the scope of zones
You must expand the scope of zones when the number of tenant replicas is increased.
Background information
For example, the current cluster contains three zones, which are z1, z2, and z3. The three zones belong to the same region, and each zone contains two OBServer nodes. The cluster has a user tenant named tenant1, and the locality information is locality='F@z1,F@z2,F@z3', resource_pool_list=('pool1');.
The following code shows the resource information about the tenant when the tenant is created:
obclient> CREATE RESOURCE POOL pool1 UNIT 'unit1', UNIT_NUM 1, ZONE_LIST ('z1', 'z2', 'z3');
obclient> CREATE TENANT tenant1 RESOURCE_POOL_LIST = ('pool1');
Assume that you need to scale out the resources of tenant1 to meet your business needs and improve tenant availability. To be specific, you need to increase the number of replicas from 3 to 5 and expand the resource usage scope from 'z1', 'z2', 'z3' to 'z1','z2','z3','z4','z5'.
Procedure
Log on to the
systenant as therootuser.Create
z4andz5in the cluster that includes three zones:z1,z2, andz3.For more information about the operation of creating zones in a cluster, see Create or delete a zone.
Add an OBServer node to each of
z4andz5.For more information about how to add an OBServer node to a zone, see Add a node.
Expand the usage scope of the
pool1resource pool to'z1','z2','z3','z4'by setting theZONE_LISTparameter.obclient> ALTER RESOURCE POOL pool1 ZONE_LIST=('z1','z2','z3','z4');Add replicas to
z4fortenant1.obclient>ALTER TENANT tenant1 LOCALITY='F@z1,F@z2,F@z3,F@z4';Expand the usage scope of the
pool1resource pool to'z1','z2','z3','z4,'z5'by setting theZONE_LISTparameter.obclient> ALTER RESOURCE POOL pool1 ZONE_LIST=('z1','z2','z3','z4','z5');Add replicas to
z5fortenant1.obclient>ALTER TENANT tenant1 LOCALITY='F@z1,F@z2,F@z3,F@z4,F@z5';
Narrow the scope of zones
Background information
For example, the current cluster contains five zones, which are z1, z2, z3, z4, and z5. The five zones belong to the same region, and each zone contains one OBServer node. The cluster has a user tenant named tenant1, and the locality information is locality='F@z1,F@z2,F@z3,F@z4,F@z5', resource_pool_list=('pool1').
The following code shows the resource information about the tenant when the tenant is created:
obclient> CREATE RESOURCE POOL pool1 UNIT 'unit1', UNIT_NUM 1, ZONE_LIST ('z1','z2','z3','z4','z5');
obclient> CREATE TENANT tenant1 RESOURCE_POOL_LIST = ('pool1');
Assume that you need to scale in the resource of tenant1 to meet your business needs and reduce the usage of storage resources. To be specific, you need to decrease the number of replicas from 5 to 3 and decrease the resource usage scope from 'z1','z2','z3','z4','z5' to 'z1','z2','z3'.
Procedure
Log on to the
systenant as therootuser.Delete the replicas of the tenant on
z5.obclient>ALTER TENANT tenant1 LOCALITY='F@z1,F@z2,F@z3,F@z4';Narrow the usage scope of the resource pool to
'z1','z2','z3','z4'by setting theZONE_LISTparameter.obclient> ALTER RESOURCE POOL pool1 ZONE_LIST=('z1','z2','z3','z4');Delete the replicas of the tenant on
z4.obclient> ALTER TENANT tenant1 locality='F@z1,F@z2,F@z3';Narrow the usage scope of the resource pool to
'z1','z2','z3'by setting theZONE_LISTparameter.obclient> ALTER RESOURCE POOL pool1 ZONE_LIST=('z1','z2','z3');Execute the following statements to delete the zones and their OBServer nodes from the cluster.
obclient> ALTER SYSTEM DELETE SERVER 'xxx.xxx.x.xx4:2882'; obclient> ALTER SYSTEM DELETE ZONE z4; obclient> ALTER SYSTEM DELETE SERVER 'xxx.xxx.x.xx5:2882'; obclient> ALTER SYSTEM DELETE ZONE z5;Execute the following SQL statement to verify that the zone and the OBServer nodes in the zone cannot be queried in the list:
obclient> SELECT * FROM oceanbase.__all_zone; obclient> SELECT * FROM oceanbase.__all_server;The process of scope narrowing is completed.