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 oblogproxy. The following example describes how to scale out OceanBase Database Community Edition of an OceanBase cluster named test.
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: zone2You 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, orserverssection in the configuration files of obd.Run the scale-out command. Here is an example:
obd cluster scale_out test -c scale_out.yamlFor more information about the
obd cluster scale_outcommand, 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-00163e0808ccVerify the scale-out result.
You can copy and run the
obd cluster displaycommand 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 -AYou 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 components deployed by using OceanBase Deployer (obd) to an OceanBase cluster in the running state. 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.
View the component information.
obd cluster edit-config testThe 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.Create a configuration file named
addtional_component.yamlto addOBAgent. 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/obagentNotice
Parameters in the
serverssection in the configuration file ofOBAgentmust be identical to those of OceanBase Database Community Edition.Run the following command to add the component:
[admin@test ~]$ obd cluster component add test -c addtional_component.yamlVerify the result.
After the command is executed, you can run the
obd cluster displaycommand to view the status of the cluster:[admin@test ~]$ obd cluster display testThe 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.
View the component information.
obd cluster edit-config testThe following output indicates that
OceanBase Database Community Edition,ODP Community Edition, andOBAgentexist 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/obagentRun the following command to delete components:
[admin@test ~]$ obd cluster component del test obagent obproxy-ceVerify the result.
After the command is executed, you can run the
obd cluster displaycommand to view the status of the cluster:[admin@test ~]$ obd cluster display testThe 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
For more information about obd commands used in this topic, see Cluster commands.
After you scale out
OceanBase Database Community Edition, you can also scale out a tenant or resource pool of the cluster. For more information, see Horizontal scaling of tenant resources in the OceanBase Database documentation.For more information about how to log on to OceanBase Database by using OBClient, see Connect to an OceanBase Database tenant by using OBClient in the OceanBase Database documentation.