This topic describes what you need to do in OceanBase Deployer (obd) before you can use OceanBase Cloud Platform (OCP) Community Edition to take over an OceanBase cluster deployed by obd.
Prerequisites
Make sure that the following conditions are met:
- You have installed obd V1.3.0 or later. We recommend that you install the latest version. For more information, see Install obd.
- You have installed OCP Community Edition V3.1.1 or later. We recommend that you install the latest version.
- Only one observer process runs on each OBServer node.
- You have created the
adminuser with password-free sudo access on each OBServer node, and set up password-free SSH login from the central control server to theadminuser on the OBServer node. For more information, see Create a user and Set password-free SSH login.
Procedure
Note
- In this example, the cluster to take over is named
test. You must replace it with the actual cluster name. You can run theobd cluster listcommand to query the name of a deployed cluster. In the output, the value in theNamecolumn is the cluster name. - For more information about the obd commands used in this topic, see Cluster commands.
Step 1: Check whether the cluster meets the conditions
Before you use OCP to take over an OceanBase cluster deployed by obd, you must first run the following command to check whether the cluster meets the takeover conditions. If not, you need to make modifications as prompted.
obd cluster check4ocp test
Step 2: Modify cluster configurations
- Change the style of the configuration file.The configuration file in the default style does not support configuring Internet data center (IDC) information. Therefore, you need to run the following command to change the style of the configuration file to
cluster:
obd cluster chst test -c oceanbase-ce --style cluster
The output is as follows:
Load param plugin ok
Change style ok
Trace ID: 724b42f2-21a4-11f0-ad48-00163e088dda
If you want to view detailed obd logs, please run: obd display-trace 724b42f2-21a4-11f0-ad48-00163e088dda
- Configure IDC information.Run the following command to open the configuration file and add IDC information for zones:
obd cluster edit-config test
After IDC information is added, you must run the obd cluster reload test command for the modifications to take effect. Here is a sample configuration file with IDC information added:
## Only need to configure when remote login is required
user:
username: admin
# password: your password if need
key_file: /home/admin/.ssh/id_rsa
oceanbase-ce:
style: cluster
name: test
config:
devname: eth0
scenario: htap
memory_limit: 64G
system_memory: 30G
datafile_size: 200G
datafile_next: 200G
datafile_maxsize: 1T
log_disk_size: 200G
cpu_count: 16
rpc_port: 2882
mysql_port: 2881
obshell_port: 2886
home_path: /home/admin/observer
root_password: ********
zones:
zone1:
idc: idc1 --- Set the IDC of zone1 to idc1.
servers:
- name: server1
ip: xxx.xxx.xxx.xxx
zone2:
idc: idc2 --- Set the IDC of zone2 to idc2.
servers:
- name: server2
ip: xxx.xxx.xxx.xxx
zone3:
idc: idc3 --- Set the IDC of zone3 to idc3.
servers:
- name: server3
ip: xxx.xxx.xxx.xxx
- (Optional) Configure a password.When you use OCP to take over a cluster, you must enter the password of the
rootuser in thesystenant for connecting to the cluster. If a password has been configured for theroot@sysuser in the cluster, skip this step.If no password is configured for theroot@sysuser in the cluster, run the following command to open the configuration file and configure theroot_passwordparameter for the cluster:
obd cluster edit-config test
Find oceanbase-ce and configure the root_password parameter under config. After you save the setting, you must run the obd cluster reload test command for the modification to take effect. Here is an example:
oceanbase-ce:
style: cluster
name: test
config:
root_password: ********
- (Optional) Change the user.OCP requires that the observer process be started by the
adminuser with password-free sudo access. If the cluster to take over is deployed by theadminuser, namely that the value ofusernameunderuserisadmin, skip this step.If the cluster to take over is not deployed by theadminuser, run the following command to open the configuration file and change the deployment user:
obd cluster edit-config test
Change the deployment user to admin. After that, you must run the obd cluster restart test --wp command for the modification to take effect. Here is an example:
user:
username: admin
# password: your password if need
key_file: /home/admin/.ssh/id_rsa
Note
After you finish the preceding operations, you can run the obd cluster check4ocp <deploy name> command again to confirm whether the cluster meets the takeover conditions. If not, make modifications as prompted.
Step 3: Use OCP to take over the cluster
For more information about how to take over an OceanBase cluster by using OCP, see Take over a cluster.
After the takeover, you must create an OceanBase Database Proxy (ODP) cluster and associate it with the OceanBase cluster that has been taken over. For more information, see Create an OBProxy cluster.
If the original ODP cluster uses a VIP as its access address, you can add the nodes in the new ODP cluster to the VIP, and then remove the original ODP nodes from the VIP one by one.
FAQ
- Can I reuse original hosts when I create a new ODP cluster?Yes. If your original ODP cluster is deployed across multiple hosts and accessed through a VIP, you can remove the cluster nodes from the hosts one by one, deploy the new OCP cluster on the same hosts, and add the new nodes to the VIP, thereby reusing the hosts.
- Can I choose not to create a new ODP cluster?Yes. The original ODP cluster can still connect to the OceanBase cluster that has been taken over. However, we recommend that you create a new ODP cluster in OCP to facilitate subsequent O&M.
