This section describes how to scale out an OB cluster managed by OBD, add or remove components.
Prerequisites
Before you start, make sure that you meet the following conditions:
The cluster involved in the operation is in the running state.
obd V2.5.0 or later is installed in the environment.
OBClient is installed in the environment.
Scale out a cluster
You can scale out any component other than oblogproxy and obbinlog-ce in the cluster. Assume that the cluster to be scaled out is named test. This example shows how to scale out the oceanbase-ce component in the cluster.
Create a configuration file for the new node.
[admin@test ~]$ vim scale_out.yamlIn this example, the configuration file is named
scale_out.yaml. You can define the file name as needed. The content of the configuration file is as follows:oceanbase-ce: servers: - name: server2 ip: 10.10.10.2 server2: mysql_port: 2881 # External port for OceanBase Database. The default value is 2881. rpc_port: 2882 # Internal port for OceanBase Database. The default value is 2882. home_path: /home/admin/observer zone: zone2You can only configure the information of the new node in the newly created configuration file. You cannot modify the
depends,global, or otherserverparameters in the original cluster configuration in this file. For more information about the configuration file format and parameters, see Configuration file description.Run the scale-out command.
[admin@test ~]$ obd cluster scale_out test -c scale_out.yamlFor more information about the
obd cluster scale_outcommand, see Cluster command groups.If the command is executed successfully, the following information is returned:
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.
Copy and execute the
obd cluster displaycommand in the command-line output. The output shows the status of the cluster, as shown in the following example:+----------------------------------------------+ | oceanbase-ce | +------------+---------+------+-------+--------+ | 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 copy and execute the obclient command in the preceding output to log in to OceanBase Database and execute the
select svr_ip,id,zone,status from __all_server;command to view the information about the nodes in the cluster. The output is as follows:+------------+----+-------+--------+ | svr_ip | id | zone | status | +------------+----+-------+--------+ | 10.10.10.1 | 1 | zone1 | ACTIVE | | 10.10.10.2 | 2 | zone2 | ACTIVE | +------------+----+-------+--------+Scale out resources in a tenant
After the OceanBase cluster is scaled out, you can scale out resources in a tenant.
Add a component
You can add a component to a running cluster. All components except obbinlog-ce deployed by using obd support being added to a cluster. Before you add a component, make sure that the component does not exist in the cluster.
Assume that there is a cluster named test with a deployed cluster name of test, and the example will explain how to add the obagent component to this cluster.
View cluster component information.
[admin@test ~]$ obd cluster edit-config testThe following output shows that only the oceanbase-ce and obproxy components 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 ······ # Omitted configuration items 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. rpc_listen_port: 2885 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 for the new
obagentcomponent.[admin@test ~]$ vim addtional_component.yamlHere is an example configuration file named
addtional_component.yaml. You can define the name of the configuration file as needed. The content of the configuration file is as follows: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/obagentThe format and parameters of the configuration file are described in Configure the parameter files.
Note
The
serverssection of theobagentcomponent configuration file must be consistent with theserverssection of theoceanbase-cecomponent configuration file. Specifically, use the samenameandipfor configuration.Run the command to add the component.
[admin@test ~]$ obd cluster component add test -c addtional_component.yamlFor more information about the
obd cluster component addcommand, see Cluster commands.The command is executed and the following information is returned:
+---------------------------------------------------------------+ | obagent | +------------+--------------------+--------------------+--------+ | ip | mgragent_http_port | monagent_http_port | status | +------------+--------------------+--------------------+--------+ | 10.10.10.1 | 8089 | 8088 | active | | 10.10.10.2 | 8089 | 8088 | active | | 10.10.10.3 | 8089 | 8088 | active | +------------+--------------------+--------------------+--------+ test running Trace ID: ae0122ea-ddd9-11ee-9b38-00163e0808cc If you want to view detailed obd logs, please run: obd display-trace ae0122ea-ddd9-11ee-9b38-00163e0808ccVerification.
After the new component command is executed, run the
obd cluster displaycommand to view the cluster status. The following example shows the result of theobd cluster displaycommand:[admin@test ~]$ obd cluster display testThe following information is returned, indicating that the
obagentcomponent exists in the cluster:+----------------------------------------------+ | oceanbase-ce | +------------+---------+------+-------+--------+ | 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-ce | +------------+------+-----------------+--------+ | ip | port | prometheus_port | status | +------------+------+-----------------+--------+ | 10.10.10.1 | 2883 | 2884 | active | +------------+------+-----------------+--------+ obclient -h10.10.10.1 -P2883 -uroot@proxysys -p'********' -Doceanbase -A Connect to Obagent ok +---------------------------------------------------------------+ | obagent | +------------+--------------------+--------------------+--------+ | ip | mgragent_http_port | monagent_http_port | status | +------------+--------------------+--------------------+--------+ | 10.10.10.1 | 8089 | 8088 | active | | 10.10.10.2 | 8089 | 8088 | active | | 10.10.10.3 | 8089 | 8088 | active | +------------+--------------------+--------------------+--------+
Delete component
You can delete the component in a running cluster. Before you do so, make sure the component exists in the cluster.
Assume there is a cluster named test with a deployment name of test and that you want to delete the obagent and obproxy-ce components in the cluster. Here is how you can proceed.
View the information about the cluster components.
[admin@test ~]$ obd cluster edit-config testThe following output appears, indicating that the
oceanbase-ce,obproxy-ce, andobagentcomponents are installed 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 ······ # The following is an example for illustration only. 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. rpc_listen_port: 2885 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/obagentExecute the Delete component command.
[admin@test ~]$ obd cluster component del test obagent obproxy-ceFor more information about the
obd cluster component delcommand, see Cluster commands.Validate results.
After the component deletion command is executed, you can execute the
obd cluster displaycommand to view the status of the cluster.[admin@test ~]$ obd cluster display testThe output is as follows. The ODP and OBAgent components are removed from the cluster.
+----------------------------------------------+ | oceanbase-ce | +------------+---------+------+-------+--------+ | 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
Related Documents
For more information about the obd commands used in this topic, see Cluster commands.
For more information about the configurations in the operation steps, see Configuration file description.
After you expand the
oceanbase-cecomponent of the cluster, you can also expand the resource quota of the resource pool or the tenant.Use the OBClient to connect to an OceanBase database.
