Add zones to a cluster
This topic describes how to add zones to a cluster.
Prerequisites
Before you add a zone to a cluster, make sure that the following conditions are met:
- The server must have sufficient resources for the new zone.
- The OceanBase cluster is in the
Running
state.
Procedure
Assume that the current cluster has three zones, zone1
, zone2
, and zone3
, and each zone contains one OBServer node. You can perform the following steps to scale out the cluster to one that consists of five zones.
-
Modify the
spec.topology
parameter in theobcluster.yaml
configuration file to addzone4
andzone5
. For more information about the complete configuration file, see Create a cluster.# For example, assume that an OceanBase cluster has three zones.
topology:
- zone: zone1
replica: 1
- zone: zone2
replica: 1
- zone: zone3
replica: 1
# Add zone4 and zone5 to the cluster.
topology:
- zone: zone1
replica: 1
- zone: zone2
replica: 1
- zone: zone3
replica: 1
- zone: zone4
replica: 1
- zone: zone5
replica: 1 -
Run the following command for the modification to take effect:
kubectl apply -f obcluster.yaml
-
Query the status of custom resources in the OceanBase cluster to check whether the operation succeeds.
Run the following command to query the status of custom resources in the OceanBase cluster. If the cluster and the five zones are in the Running
state, the operation is successful.
kubectl get obclusters.oceanbase.oceanbase.com test -n oceanbase -o yaml
# desired output, only displays status here
status:
image: oceanbase/oceanbase-cloud-native:4.2.0.0-101000032023091319
obzones:
- status: running
zone: obcluster-1-zone1
- status: running
zone: obcluster-1-zone2
- status: running
zone: obcluster-1-zone3
- status: running
zone: obcluster-1-zone4
- status: running
zone: obcluster-1-zone5
parameters: []
status: running