This topic describes how to scale out a cluster by adding OBServer nodes to zones in the cluster.
You can modify the obcluster.yaml configuration file of the OceanBase cluster to add OBServer nodes to zones.
The spec.topology.cluster[index1].zone[index2].replicas attribute in the obcluster.yaml configuration file specifies the number of OBServer nodes in the [index2] zone of the OceanBase cluster deployed in the [index1] Kubernetes cluster. You can modify the value of this attribute to add OBServer nodes to a zone.
Prerequisites
Before you add an OBServer node to a zone, make sure that the server has sufficient resources for the new OBServer node.
Procedure
Assume that the current cluster has three zones, zone1, zone2, and zone3, each zone contains one OBServer node, and you want to add one OBServer node to each zone so that each zone contains two OBServer nodes.
Modify the
obcluster.yamlconfiguration file and change the value ofreplicasfrom1to2for each zone.# For example, each zone has one OBServer node. spec: topology: - cluster: cn zone: - name: zone1 region: region1 nodeSelector: ob.zone: zone1 replicas: 1 - name: zone2 region: region1 nodeSelector: ob.zone: zone2 replicas: 1 - name: zone3 region: region1 nodeSelector: ob.zone: zone3 replicas: 1 # Add an OBServer node to each zone. spec: topology: - cluster: cn zone: - name: zone1 region: region1 nodeSelector: ob.zone: zone1 replicas: 2 # 1 -> 2 - name: zone2 region: region1 nodeSelector: ob.zone: zone2 replicas: 2 # 1 -> 2 - name: zone3 region: region1 nodeSelector: ob.zone: zone3 replicas: 2 # 1 -> 2You can modify the number of OBServer nodes for multiple zones at a time. Run the following command for the modification to take effect:
kubectl apply -f obcluster.yamlRun the following command to check whether the modification has taken effect:
kubectl get pod -n obclusterHere is an example of the command output:
NAME READY STATUS RESTARTS AGE sapp-ob-test-cn-zone1-0 2/2 Running 0 84m sapp-ob-test-cn-zone3-0 2/2 Running 0 84m sapp-ob-test-cn-zone2-0 2/2 Running 0 84m sapp-ob-test-cn-zone1-1 2/2 Running 0 3m40s sapp-ob-test-cn-zone2-1 2/2 Running 0 3m40s sapp-ob-test-cn-zone3-1 2/2 Running 0 3m39sThe preceding result shows that
zone1,zone2, andzone3each have two pods respectively corresponding to two OBServer nodes, the values ofREADYare all2/2, and the values ofSTATUSare allRunning, indicating that the scale-out is successful.