This topic describes how to scale in an OceanBase cluster by deleting OBServer nodes from zones.
Make sure that the zones still have sufficient resources to bear the load of the tenant after you delete the OBServer nodes.
You can modify the obcluster.yaml configuration file of the OceanBase cluster to delete OBServer nodes from zones. Generally, you must delete the same number of OBServer nodes from each zone.
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 delete OBServer nodes from a zone.
Procedure
Assume that the current cluster has three zones, zone1, zone2, and zone3, each zone contains two OBServer nodes, and you want to delete one OBServer node from each zone for scale-in. After the scale-in, each of the three zones has only one OBServer node.
Modify the
obcluster.yamlconfiguration file to change the value ofreplicasfrom2to1for each zone.# For example, each zone has two OBServer nodes. spec: topology: - cluster: cn zone: - name: zone1 region: region1 nodeSelector: ob.zone: zone1 replicas: 2 - name: zone2 region: region1 nodeSelector: ob.zone: zone2 replicas: 2 - name: zone3 region: region1 nodeSelector: ob.zone: zone3 replicas: 2 # Reduce the number of OBServer nodes in each zone to 1. spec: topology: - cluster: cn zone: - name: zone1 region: region1 nodeSelector: ob.zone: zone1 replicas: 1 # 2 -> 1 - name: zone2 region: region1 nodeSelector: ob.zone: zone2 replicas: 1 # 2 -> 1 - name: zone3 region: region1 nodeSelector: ob.zone: zone3 replicas: 1 # 2 -> 1Run 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 84mThe preceding result shows that
zone1,zone2, andzone3each have only one OBServer node, the values ofREADYare all2/2, and the values ofSTATUSare allRunning, indicating that the scale-in is successful.