You can add nodes to an OceanBase cluster in elastic scaling scenarios and deployment adjustment scenarios.
Elastic scaling scenarios: After scaling out, the Zone contains more nodes to accommodate more Units. This allows you to perform subsequent operations such as migrating Units, adjusting the
UNIT_NUMof tenants, and creating new tenants.Deployment adjustment scenarios: Deployment adjustment scenarios include changing the deployment mode of a cluster from three IDCs in the same city to five IDCs in three cities, and moving a Zone from one IDC to another in the event of IDC decommissioning. In this scenario, you need to add a Zone first, then add nodes to the Zone, and finally adjust the Locality attribute of tenants.
OceanBase Database has a clear architectural advantage over traditional databases in terms of elastic scaling. Traditional databases store data on a single machine, while OceanBase Database can distribute data across different machines, effectively addressing scalability issues and demonstrating the advantages of a distributed architecture. When the capacity of a cluster or tenant is insufficient, adding more nodes allows the cluster to accommodate more tenants, and each tenant can handle more data and business traffic. Conversely, when the capacity is abundant, you can decommission nodes to reduce costs.
Multi-replica deployment is another architectural advantage of OceanBase Database over traditional databases. This capability forms the foundation for OceanBase Database's multi-level lossless disaster recovery features, including single-machine, IDC, and city-level lossless disaster recovery. Additionally, OceanBase Database supports flexible adjustments to cluster deployment architectures, enabling it to adapt to evolving business requirements.
Prerequisites
Make sure that all the OBServer nodes to be added are configured properly. For more information, see Prepare servers.
Install OceanBase Database on all the OBServer nodes before you add them. You can download the installation package of OceanBase Database from the Download Center of the OceanBase website or obtain it from OceanBase Technical Support.
Procedure
Note
This topic describes how to add a node to a cluster manually.
(Optional) If you want to add a node to a zone that has been added, confirm that the new zone has been added. For more information, see Add a zone.
Use
sshto log in to the server of the OBServer node to be added, initialize the server, and configure the clock source.For more information about how to initialize the server, see Initialize the OBServer server.
For more information about how to configure the clock source, see Configure the clock source.
Use
sshto log in to the server of the OBServer node to be added, and install the OceanBase Database RPM package on the server.Before you add a node, you must install the OceanBase Database RPM package on the servers of all OBServer nodes to be added.
Run the following command:
[root@xxx /]#cd $rpm_dir [root@xxx $rpm_dir]#rpm -ivh $rpm_nameIn this command,
rpm_dirindicates the directory in which the RPM package is stored, and$rpm_nameindicates the name of the RPM package.Initialize the OceanBase Database directory.
It is recommended that you store the data directory of the OceanBase Database on an independent disk, and then link the disk to the
Homedirectory of the software by using soft links.[root@xxx admin]#su - admin -bash-4.2$ mkdir -p /data/1/$cluster_name/{etc3,sort_dir,sstable,slog} -bash-4.2$ mkdir -p /data/log1/$cluster_name/{clog,etc2,ilog,oob_clog} -bash-4.2$ mkdir -p /home/admin/oceanbase/store/$cluster_name -bash-4.2$ for t in {etc3,sort_dir,sstable,slog};do ln -s /data/1/$cluster_name/$t /home/admin/oceanbase/store/$cluster_name/$t; done -bash-4.2$ for t in {clog,etc2,ilog,oob_clog};do ln -s /data/log1/$cluster_name/$t /home/admin/oceanbase/store/$cluster_name/$t; doneIn this command,
cluster_nameindicates the name of the OBServer node to be added.Here is an example:
[root@xxx admin]#su - admin -bash-4.2$ mkdir -p /data/1/obdemo/{etc3,sort_dir,sstable,slog} -bash-4.2$ mkdir -p /data/log1/obdemo/{clog,etc2,ilog,oob_clog} -bash-4.2$ mkdir -p /home/admin/oceanbase/store/obdemo -bash-4.2$ for t in {etc3,sort_dir,sstable,slog};do ln -s /data/1/obdemo/$t /home/admin/oceanbase/store/obdemo/$t; done -bash-4.2$ for t in {clog,etc2,ilog,oob_clog};do ln -s /data/log1/obdemo/$t /home/admin/oceanbase/store/obdemo/$t; doneStart the observer process for the node.
Run the following command to start the observer process.
[root@xxx admin]$ su - admin -bash-4.2$ cd /home/admin/oceanbase -bash-4.2$ ./bin/observer -I xx.xx.xx.xx -P XXXX -p YYYY -z zone1 -d /home/admin/oceanbase/store/obdemo -r 'xx.xx.xx.xx:xxxx:yyyy' -c 20190716 -n obdemo -o "system_memory=30GB,datafile_size=100G,config_additional_dir=/data/1/obdemo/etc3;/data/log1/obdemo/etc2"The parameters in the preceding command are described as follows:
-I: specifies the IP address of the node to be started. In a multi-node deployment scenario, do not set the target IP to127.0.0.1.Starting a node by specifying the network interface (for example,
-i eth0) is supported in the current version, but it is recommended to start the node by specifying an IP address (for example,-I 10.10.10.1). Additionally, you can start a node by specifying both an IP address and a network interface (for example,-I 10.10.10.1 -i eth0), but we recommend you do not do so.In the current version, the IPv6 address is supported as the IP address of the node to be started. Note that the following items must be observed when you specify an IPv6 address:
- IPv6 addresses are divided into global addresses and link-local addresses. Global addresses are recommended.
- You must add
-6before-I.
-c: specifies the cluster ID. You can executeSHOW PARAMETERS LIKE 'cluster_id';to obtain the cluster ID value.-p: specifies the SQL port number. The default value is 2881. Do not modify this parameter unless explicitly required.-P: specifies the RPC port number. The default value is 2882. Do not modify this parameter unless explicitly required.-n: specifies the cluster name. You can executeSHOW PARAMETERS LIKE 'cluster';to obtain the cluster name value. In the current example, the cluster name isobdemo.-z: specifies the zone to which the node is to be joined. You can query theDBA_OB_ZONESview to obtain the name of the zone in the cluster.-d: specifies the data directory.-r: specifies the list of RS addresses of the OceanBase cluster to which the node is to be added.If you specify the IPv6 address as the RS address, note that the following items must be observed:
- IPv6 addresses are divided into global addresses and link-local addresses. Global addresses are recommended.
- When you specify the IPv6 address as the RS address, wrap the IP address with
[]. - You must add
-6before-r.
-l: specifies the log level. In the current example,WARNis specified. This indicates that the log level is WARNING.For more information about the log levels in OceanBase Database, see Log level.
-o: specifies the startup parameters of the cluster. You must configure the startup parameters according to your environment.When you specify the
-oparameter, note that the following items must be observed:The parameter is case-insensitive, but we recommend that you use the naming conventions in the
observer.config.binfile.The parameter name cannot contain the following special characters: space,
\r,\n, and\t.The parameter name and value must be separated by an equal sign (
=).The parameters must be separated by an English comma (,).
In the preceding statement:
system_memory: specifies the amount of memory reserved for OceanBase Database internally. The default value is 30 G.datafile_size: specifies the size of the SSTables in the data files of the OceanBase Database (initiated in one time). You can evaluate the available space in the/data/1/directory. We recommend that you set the value to at least 100 G, and reserve some space.config_additional_dir: specifies the redundant directory of the parameter file.
Here is an example:
[root@xxx admin]$ su - admin -bash-4.2$ cd /home/admin/oceanbase -bash-4.2$ ./bin/observer -I xx.xx.xx.1 -c 20221216 -p 2881 -P 2882 -z zone4 -n obdemo -d /home/admin/oceanbase/store/obdemo -r 'xx.xx.xx.1:2882:2881' -l WARN -o "system_memory=30GB,datafile_size=100G,config_additional_dir=/data/1/obdemo/etc3;/data/log1/obdemo/etc2"Here is an example of starting a node by using an IPv6 address:
[root@xxx admin]$ su - admin -bash-4.2$ cd /home/admin/oceanbase -bash-4.2$ ./bin/observer -6 -I xxxx:xxxx:xxxx:xxxx:xxx:xxxx:xxxx:ebd8 -c 20221216 -p 2881 -P 2882 -z zone4 -n obdemo -d /home/admin/oceanbase/store/obdemo -r '[xxxx:xxxx:xxxx:xxxx:xxx:xxxx:xxxx:ebd8]:2882:2881' -l WARN -o "system_memory=30GB,datafile_size=100G,config_additional_dir=/data/1/obdemo/etc3;/data/log1/obdemo/etc2"(Optional) If you want to add multiple nodes, repeat steps 2 to 5.
Add nodes to the cluster.
Log in to the
systenant of the cluster as therootuser.The following example shows how to connect to the database. You must use the actual environment in your business scenario.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AFor more information about how to connect to the database, see Overview of how to connect to the database (MySQL mode) and Overview of how to connect to the database (Oracle mode).
Execute the following command to add a node to the zone of the cluster.
ALTER SYSTEM ADD SERVER 'svr_ip:svr_port' [,'svr_ip:svr_port'...] [ZONE [=] 'zone_name'];The parameters are described as follows:
svr_ip: specifies the IP address of the node to be added.svr_port: specifies the RPC port of the node to be added. The default value is2882.zone_name: specifies the zone of the node to be added.
Here is an example:
ALTER SYSTEM ADD SERVER '10.xx.xx.xx:2882','10.xx.xx.xx:2882' ZONE 'zone4';This operation adds the OBServer node to the service list. Only OBServer nodes in the service list can provide services.
After the operation is successful, you can query the
DBA_OB_SERVERSview to confirm the result.Here is an example:
obclient> SELECT * FROM oceanbase.DBA_OB_SERVERS;If the OBServer node is listed in the query result, the node is added.
What to do next
Add nodes primarily for elastic scaling and deployment adjustment scenarios:
In elastic scaling scenarios, after adding nodes, the zone where the nodes are located will have more nodes to accommodate units. This allows subsequent operations such as unit migration, adjusting the
UNIT_NUMof tenants, and creating new tenants. For more information, see the following topics:In deployment adjustment scenarios: This includes scenarios such as changing the deployment method of a cluster from three IDCs in the same city to five IDCs across three regions, and moving a zone from one IDC to another. In this scenario, you must first add a zone, then add nodes in the zone, and finally adjust the locality attribute of tenants. For more information about how to adjust the locality attribute of tenants, see Modify the locality.
References
For more information about node management, see the following topics:
