Delete OBServer nodes from zones

2024-01-29 03:15:01  Updated

This topic describes how to scale in a cluster by removing OBServer nodes from zones in the cluster.

Prerequisites

  • The OceanBase cluster is in the Running state.
  • After the OBServer nodes are deleted, the cluster has sufficient resources for the units of tenants.

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 so that each zone contains one OBServer node.

  1. Open the obcluster.yaml configuration file and change the value of the replica parameter of each zone from 2 to 1.

    # For example, assume that an OceanBase cluster has three zones.
    topology:
      - zone: zone1
        replica: 2
      - zone: zone2
        replica: 2
      - zone: zone3
        replica: 2
    
    # Delete an OBServer node from each zone.
    topology:
      - zone: zone1
        replica: 1
      - zone: zone2
        replica: 1
      - zone: zone3
        replica: 1  
    
  2. Run the following command for the modification to take effect:

    kubectl apply -f obcluster.yaml
    
  3. 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 the OceanBase cluster.

kubectl get obclusters.oceanbase.oceanbase.com test -n oceanbase -o yaml

# obcluster 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
  parameters: []
  status: running

Run the following command to check whether the number of OBServer nodes is correct and whether they are all in the Running state:

kubectl get observers.oceanbase.oceanbase.com -n oceanbase

# observer desired output, only displays status here
oceanbase     obcluster-1-zone1-7b0e9f7e7675   10.42.0.241   running   7h48m
oceanbase     obcluster-1-zone2-67f3d1fe0b40   10.42.0.251   running   28m
oceanbase     obcluster-1-zone3-914ef208ac46   10.42.0.252   running   28m

Contact Us