This topic describes how to scale out a cluster by adding OBServer nodes to zones in the cluster.
You can add OBServer nodes to a zone by executing SQL statements or using OceanBase Cloud Platform (OCP).
Add OBServer nodes to zones by using SQL statements
You can use SQL statements to add OBServer nodes to zones.
Assume that you have a cluster that has three zones, which are z1, z2, and z3, and each zone has two OBServer nodes. The cluster has a user tenant named tenant1. The following code shows the resource distribution of the tenant:
obclient> CREATE RESOURCE UNIT unit1 MAX_CPU 5,MIN_CPU 4, MAX_MEMORY '36G', MIN_MEMORY '32G', MAX_IOPS 128, MIN_IOPS 128, MAX_DISK_SIZE '2T', MAX_SESSION_NUM 64;
obclient> CREATE RESOURCE POOL pool1 UNIT 'unit1', UNIT_NUM 2, ZONE_LIST ('z1','z2','z3');
obclient>CREATE TENANT tenant1 resource_pool_list=('pool1');
Assume that you need to add one OBServer node to each zone. After the scale-out, each of the three zones contains three OBServer nodes.
Perform the following steps:
Log on to the
systenant as therootuser.Add an OBServer node to each of
z1,z2, andz3.For more information about how to add an OBServer node to a zone, see Add an OBServer node.
Adjust the resource configurations of the tenant by increasing the value of the
UNIT_NUMparameter based on your business requirements.Notice
- One resource unit can be located on only one OBServer node, and multiple resource units of the same tenant cannot be located on the same OBServer node. If you have adjusted the resource unit configs to the optimal settings during the tenant scale-out, you must increase the number of resource units in this step.
- When you increase the number of resource units, the value of the
UNIT_NUMparameter cannot be greater than the number of OBServer nodes in each zone.
obclient> CREATE RESOURCE UNIT unit2 MAX_CPU 10, MAX_MEMORY '50G', MAX_IOPS 128,MAX_DISK_SIZE '10G', MAX_SESSION_NUM 64, MIN_CPU=10, MIN_MEMORY='50G', MIN_IOPS=128; obclient> ALTER RESOURCE POOL pool1 UNIT='unit2';In this case, you need to change the value of the
UNIT_NUMparameter to 3. Sample statement:obclient> ALTER RESOURCE POOL pool1 UNIT_NUM 3;
Add OBServer nodes to zones in OCP
You can also add OBServer nodes to zones in OCP. Generally, you need to add the same number of OBServer nodes to each zone.
Background
Assume that you have a cluster that has three zones, which are z1, z2, and z3, and each zone has two OBServer nodes. Assume that you need to add one OBServer node to each zone. After the scale-out, each of the three zones contains three OBServer nodes.
Notice
When you add OBServer nodes to zones, make sure that the number of OBServer nodes in each zone is equal.
Add a host
Before you scale out a cluster, you must add a host. For more information about, see Add a host in Add zones to a cluster.
Add OBServer nodes
Log on to the OCP console.
Add one OBServer node to each of the three zones.
For more information about how to add an OBServer node to a zone in OCP, see Add an OBServer node.
Adjust the resource pool settings of the tenant based on your business requirements. To be specific, increase the number of resource units in each zone.
Notice
One resource unit can be located on only one OBServer node. If you have adjusted the resource unit specifications to the optimal settings during the tenant scale-out, you must increase the number of resource units in this step.
For more information about how to modify a resource pool in OCP, see Modify a resource pool.