This topic describes how to scale out a cluster by adding zones to the cluster.
Add zones to a cluster by using SQL statements
You can use SQL statements to add zones to a cluster. For example, you can use this method to increase the number of replicas from 3 to 5 for a tenant. When you add zones to a cluster, you must add the same number of OBServer nodes to each new zone as that of an existing zone.
Assume that the current cluster has three zones, which are z1, z2, and z3. The three zones belong to the same region, and each zone has one OBServer node. The cluster has a user tenant named tenant1, and the locality information is locality='F@z1,F@z2,F@z3', resource_pool_list=('pool1');. Assume that you need to increase the number of replicas from 3 to 5 for tenant1 to meet the business needs. You must change the locality of the tenant from F@z1,F@z2,F@z3 to F@z1,F@z2,F@z3,F@z4,F@z5.
To add zones to the cluster and change the tenant locality, perform the following steps:
Log on to the
systenant of the cluster as therootuser.Create
z4andz5in the cluster that includes three zones:z1,z2, andz3.For more information about how to create zones in a cluster, see Create or delete a zone.
Add an OBServer node to each of the
z4andz5zones.For more information about how to add an OBServer node to a zone, see Add a node.
Add resources to
z4andz5fortenant1.Note
To add tenant resources after zones are added, you can increase the usage scope of the tenant resource pool by setting the ZONE_LIST parameter or creating a new resource pool and allocating the resource pool to the tenant. The following example describes how to create a new resource pool and allocate it to the tenant. For more information about how to set the ZONE_LIST parameter, see Modify the resource configurations of a tenant.
Create a resource unit and a resource pool.
obclient>CREATE RESOURCE UNIT unit2 MAX_CPU 1, MIN_CPU=1, MEMORY_SIZE '5G', MAX_IOPS 1024, MIN_IOPS=1024, IOPS_WEIGHT=0,LOG_DISK_SIZE = '2G'; obclient>CREATE RESOURCE POOL pool2 unit = 'unit2', unit_num = 1, zone_list=('z4','z5');Add resources to
z4andz5.obclient>ALTER TENANT tenant1 RESOURCE_POOL_LIST =('pool1', 'pool2') ;
Modify the locality of the tenant to add replicas.
Based on the locality modification rule, you can add only one zone at a time. For more information about the locality modification rule, see Locality overview.
obclient>ALTER TENANT tenant1 LOCALITY='F@z1,F@z2,F@z3,F@z4'; obclient>ALTER TENANT tenant1 LOCALITY='F@z1,F@z2,F@z3,F@z4,F@z5';The scale-out process is completed.