Scale out a cluster and change cluster components

2025-03-25 02:31:02  Updated

This topic describes how to scale out an OceanBase cluster managed by OceanBase Deployer (obd) and how to add a component to or delete a component from the cluster.

Prerequisites

Make sure that the following conditions are met:

  • The cluster is in the running state.

  • You have installed obd V2.5.0 or later in the environment.

  • You have installed OBClient in the environment.

Scale out a cluster

You can scale out all components of an OceanBase cluster except OCP-Server. The following example describes how to scale out OceanBase Database Community Edition of an OceanBase cluster named test.

  1. The following sample code shows the information of the node to be added in a configuration file named scale_out.yaml:

    oceanbase-ce:
      servers:
        - name: server2
          ip: 10.10.10.2
      server2:
        mysql_port: 2881 # The external port for OceanBase Database. Default value: 2881.
        rpc_port: 2882 # The internal port for OceanBase Database. Default value: 2882.
        home_path: /home/admin/observer
        zone: zone2
    

    You can specify the information of the new node in a new configuration file, and you cannot modify the parameters such as those in the depends, global, or servers section in the configuration files of obd.

  2. Run the scale-out command. Here is an example:

    obd cluster scale_out test -c scale_out.yaml
    

    For more information about the obd cluster scale_out command, see Cluster commands.

    After the command is executed successfully, as shown below:

    Execute ` obd cluster display test ` to view the cluster status
    Trace ID: 3777cea4-dd1a-11ee-b38d-00163e0808cc
    If you want to view detailed obd logs, please run: obd display-trace 3777cea4-dd1a-11ee-b38d-00163e0808cc
    
  3. Verify the scale-out result.

    You can copy and run the obd cluster display command to view the status of the cluster. Here is an example of command output:

    +----------------------------------------------+
    |                  observer                    |
    +------------+---------+------+-------+--------+
    | ip         | version | port | zone  | status |
    +------------+---------+------+-------+--------+
    | 10.10.10.1 | 4.2.1.2 | 2881 | zone1 | ACTIVE |
    | 10.10.10.2 | 4.2.1.2 | 2881 | zone2 | ACTIVE |
    +------------+---------+------+-------+--------+
    obclient -h10.10.10.1 -P2881 -uroot -p'********' -Doceanbase -A
    

    You can also copy the obclient command in the output and run the command to log on to the OceanBase cluster, and then run the select svr_ip,id,zone,status from __all_server; command to view information about nodes in the cluster. Here is an example of command output:

    +------------+----+-------+--------+
    | svr_ip     | id | zone  | status |
    +------------+----+-------+--------+
    | 10.10.10.1 |  1 | zone1 | ACTIVE |
    | 10.10.10.2 |  2 | zone2 | ACTIVE |
    +------------+----+-------+--------+
    

Add a component

You can add the following components to an OceanBase cluster in the running state: OceanBase Database Community Edition, OceanBase Database Proxy (ODP) Community Edition, OBAgent, OceanBase Cloud Platform (OCP) Express, Prometheus, Grafana, and obconfigserver. Note that you can add only a component that does not exist in the cluster.

The following example describes how to add OBAgent to an OceanBase cluster named test.

  1. View the component information.

    obd cluster edit-config test
    

    The following output indicates that only OceanBase Database Community Edition and ODP Community Edition exist in the cluster.

    ##Only need to configure when remote login is required
    user:
      username: admin
      key_file: /home/admin/.ssh/id_rsa
    oceanbase-ce:
      servers:
        - name: server1
          ip: 10.10.10.1
        - name: server2
          ip: 10.10.10.2
        - name: server3
          ip: 10.10.10.3
      global:
        cluster_id: 1
        mysql_port: 2881 # External port for OceanBase Database. The default value is 2881. DO NOT change this value after the cluster is started.
        rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882. DO NOT change this value after the cluster is started.
        home_path: /home/admin/observer
        # Some parameters are omitted here.
      server1:
        zone: zone1
      server2:
        zone: zone2
      server3:
        zone: zone3
    obproxy-ce:
      depends:
        - oceanbase-ce
      servers:
        - 10.10.10.1
      global:
        listen_port: 2883 # External port. The default value is 2883.
        prometheus_listen_port: 2884 # The Prometheus port. The default value is 2884.
        home_path: /home/admin/obproxy
        enable_cluster_checkout: false
        skip_proxy_sys_private_check: true
        enable_strict_kernel_release: false
        obproxy_sys_password: ******** # obproxy sys user password, can be empty. When a depends exists, obd gets this value from the oceanbase-ce of the depends.
    
  2. Create a configuration file named addtional_component.yaml to add OBAgent. Here is an example:

    obagent:
      depends:
        - oceanbase-ce
      servers:
        - name: server1
          ip: 10.10.10.1
        - name: server2
          ip: 10.10.10.2
        - name: server3
          ip: 10.10.10.3
      global:
        home_path: /home/admin/obagent
    

    Notice

    Parameters in the servers section in the configuration file of OBAgent must be identical to those of OceanBase Database Community Edition.

  3. Run the following command to add the component:

    [admin@test ~]$ obd cluster component add test -c addtional_component.yaml
    
  4. Verify the result.

    After the command is executed, you can run the obd cluster display command to view the status of the cluster:

    [admin@test ~]$ obd cluster display test
    

    The following output indicates the information of OBAgent, which means that the component already exists in the cluster:

    +----------------------------------------------+
    |                  observer                    |
    +------------+---------+------+-------+--------+
    | ip         | version | port | zone  | status |
    +------------+---------+------+-------+--------+
    | 10.10.10.1 | 4.2.1.2 | 2881 | zone1 | ACTIVE |
    | 10.10.10.2 | 4.2.1.2 | 2881 | zone2 | ACTIVE |
    | 10.10.10.3 | 4.2.1.2 | 2881 | zone3 | ACTIVE |
    +------------+---------+------+-------+--------+
    obclient -h10.10.10.1 -P2881 -uroot -p'********' -Doceanbase -A
    
    Connect to obproxy ok
    +----------------------------------------------+
    |                  obproxy                     |
    +------------+------+-----------------+--------+
    | ip         | port | prometheus_port | status |
    +------------+------+-----------------+--------+
    | 10.10.10.1 | 2883 | 2884            | active |
    +------------+------+-----------------+--------+
    obclient -h10.10.10.1 -P2883 -uroot -p'********' -Doceanbase -A
    Connect to Obagent ok
    +---------------------------------------------------------------+
    |                          obagent                              |
    +------------+--------------------+--------------------+--------+
    | ip         | mgragent_http_port | monagent_http_port | status |
    +------------+--------------------+--------------------+--------+
    | 10.10.10.1 | 8089               | 8088               | active |
    +------------+--------------------+--------------------+--------+
    

Delete a component

You can delete a component from an OceanBase cluster in the running state. Before you delete a component, make sure that the component exists in the cluster.

The following example describes how to delete OBAgent and ODP Community Edition from an OceanBase cluster named test.

  1. View the component information.

    obd cluster edit-config test
    

    The following output indicates that OceanBase Database Community Edition, ODP Community Edition, and OBAgent exist in the cluster.

    ##Only need to configure when remote login is required
    user:
      username: admin
      key_file: /home/admin/.ssh/id_rsa
    oceanbase-ce:
      servers:
        - name: server1
          ip: 10.10.10.1
        - name: server2
          ip: 10.10.10.2
        - name: server3
          ip: 10.10.10.3
      global:
        cluster_id: 1
        mysql_port: 2881 # External port for OceanBase Database. The default value is 2881. DO NOT change this value after the cluster is started.
        rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882. DO NOT change this value after the cluster is started.
        home_path: /home/admin/observer
        # Some parameters are omitted here.
      server1: 
        zone: zone1
      server2:
        zone: zone2
      server3:
        zone: zone3
    obproxy-ce:
      depends:
        - oceanbase-ce
      servers:
        - 10.10.10.1
      global:
        listen_port: 2883 # External port. The default value is 2883.
        prometheus_listen_port: 2884 # The Prometheus port. The default value is 2884.
        home_path: /home/admin/obproxy
        enable_cluster_checkout: false
        skip_proxy_sys_private_check: true
        enable_strict_kernel_release: false
        obproxy_sys_password: ******** # obproxy sys user password, can be empty. When a depends exists, obd gets this value from the oceanbase-ce of the depends.
    obagent:
      depends:
        - oceanbase-ce
      servers:
        - name: server1
          ip: 10.10.10.1
        - name: server2
          ip: 10.10.10.2
        - name: server3
          ip: 10.10.10.3
      global:
        home_path: /home/admin/obagent
    
  2. Run the following command to delete components:

    [admin@test ~]$ obd cluster component del test obagent obproxy-ce
    
  3. Verify the result.

    After the command is executed, you can run the obd cluster display command to view the status of the cluster:

    [admin@test ~]$ obd cluster display test
    

    The following output indicates that ODP Community Edition and OBAgent no longer exist in the cluster:

    +----------------------------------------------+
    |                  observer                    |
    +------------+---------+------+-------+--------+
    | ip         | version | port | zone  | status |
    +------------+---------+------+-------+--------+
    | 10.10.10.1 | 4.2.1.2 | 2881 | zone1 | ACTIVE |
    | 10.10.10.2 | 4.2.1.2 | 2881 | zone2 | ACTIVE |
    | 10.10.10.3 | 4.2.1.2 | 2881 | zone3 | ACTIVE |
    +------------+---------+------+-------+--------+
    obclient -h10.10.10.1 -P2881 -uroot -p'********' -Doceanbase -A
    

References

Contact Us