This topic describes how to upgrade OceanBase Migration Service (OMS) Community Edition in multi-node deployment mode to V4.2.3.
Background information
At present, only OMS Community Edition of the following two versions can be directly upgraded to V4.2.3. To upgrade OMS Community Edition in multi-node deployment mode, you need to upgrade all nodes.
OMS Community Edition V4.2.2
OMS Community Edition V4.1.0
Notice
You can directly upgrade OMS Community Edition from V4.1.0 to V4.2.3 based on the operations described in this topic. To upgrade OMS Community Edition of a version earlier than V4.1.0, you must upgrade it first to V4.1.0 and then to V4.2.3.
Upgrade from V4.2.2 to V4.2.3
If high availability (HA) is enabled, disable it first.
Log on to the console of OMS Community Edition.
In the left-side navigation pane, choose System Management > System Parameters.
On the System Parameters page, find
ha.config.Click the edit icon in the Value column of the parameter.
In the Modify Value dialog box, set
enabletofalseto disable HA.
Back up the databases.
Log on to the two hosts where the container of OMS Community Edition V4.2.2 is deployed by using their respective IP addresses, and suspend the container.
sudo docker stop ${CONTAINER_NAME}Note
CONTAINER_NAMEspecifies the name of the container.Log on to the cluster management (CM) heartbeat database specified in the configuration file and delete some useless records to reduce the backup time.
# Log on to the CM heartbeat database specified in the configuration file. mysql -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> -Dcm_hb_422 # Delete useless records. # The heatbeat_sequence table provides auto-increment IDs and reports heartbeats. delete from heatbeat_sequence where id < (select max(id) from heatbeat_sequence);Run the following commands to back up the
rm,cm, andcm_hbdatabases as SQL files and make sure that the sizes of the files are not 0.If you have deployed databases in multiple regions, you must back up the
cm_hbdatabase in all regions. For example, if you have deployed databases in two regions, you must back up the following four databases:rm,cm,cm_hb1, andcm_hb2.mysqldump -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> --triggers=false rm_422 > /home/admin/rm_422.sql mysqldump -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> --triggers=false cm_422 > /home/admin/cm_422.sql mysqldump -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> --triggers=false cm_hb_422 > /home/admin/cm_hb_422.sqlParameter Description -h The IP address of the host from which the data is exported. -P The port number used to connect to the database. -u The username used to connect to the database. -p The password used to connect to the database. --triggers The data export trigger. The default value is false, which disables data export.rm_422, cm_422, cm_hb_422 Specifies to back up the rm,cm, andcm_hbdatabases as SQL files named in the format ofdatabase name > SQL file storage path.sql. You need to specify the values based on the actual environment.
Load the downloaded OMS Community Edition installation package to the local image repository of the Docker container.
docker load -i <Installation package of OMS Community Edition>Start a new container for OMS Community Edition V4.2.3.
You can access the console of OMS Community Edition by using an HTTP or HTTPS URL. To securely access the console of OMS Community Edition, install a Secure Socket Layer (SSL) certificate and mount it to the specified directory in the container. The certificate is not required for HTTP access.
Notice
Before you start the container for OMS Community Edition V4.2.3, make sure that the three disk mounting paths of OMS Community Edition are the same as those before the upgrade.
You can run thesudo docker inspect ${CONTAINER_NAME} | grep -A5 'Binds'command to view the disk mounting paths before the upgrade, which are paths to the disks mounted to the old container of OMS Community Edition.The
-e IS_UPGRADE=trueparameter is provided in OMS Community Edition V3.3.1 and later. This parameter is provided only to support OMS upgrades and must be specified when you upgrade OMS.Replace
work.oceanbase-dev.com/obartifact-store/oms:${IMAGE_TAG}with the name of the image that is imported by running thedocker load -icommand.
OMS_HOST_IP=xxx CONTAINER_NAME=oms_xxx IMAGE_TAG=feature_x.x.x-ce docker run -dit --net host \ -v /data/config.yaml:/home/admin/conf/config.yaml \ -v /data/oms/oms_logs:/home/admin/logs \ -v /data/oms/oms_store:/home/ds/store \ -v /data/oms/oms_run:/home/ds/run \ # If you mount the SSL certificate to the OMS container, you must set the following two parameters. -v /data/oms/https_crt:/etc/pki/nginx/oms_server.crt -v /data/oms/https_key:/etc/pki/nginx/oms_server.key -e OMS_HOST_IP=${OMS_HOST_IP} \ -e IS_UPGRADE=true \ --privileged=true \ --pids-limit -1 \ --ulimit nproc=65535:65535 \ --name ${CONTAINER_NAME} \ work.oceanbase-dev.com/obartifact-store/oms:${IMAGE_TAG}Parameter Description OMS_HOST_IP The IP address of the host.
Notice
The value ofOMS_HOST_IPis different for each node.CONTAINER_NAME The name of the container IMAGE_TAG The unique identifier of the loaded image. After you load the OMS Community Edition installation package by using Docker, run the docker imagescommand to obtain the [IMAGE ID] or [REPOSITORY:TAG] value of the loaded image. The obtained value is the unique identifier of the loaded image./data/oms/oms_logs
/data/oms/oms_store
/data/oms/oms_run/data/oms/oms_logs,/data/oms/oms_store, and/data/oms/oms_runcan be replaced with the mount directories created on the server where OMS Community Edition is deployed to respectively store the runtime log files of OMS Community Edition, the files generated by the Store component, and the files generated by the Incr-Sync component, for local data persistence.
Notice
The mount directories must remain unchanged during subsequent redeployment or upgrades./home/admin/logs
/home/ds/store
/home/ds/run/home/admin/logs,/home/ds/store, and/home/ds/runare default directories in the container and cannot be modified./data/oms/https_crt (optional)
/data/oms/https_key (optional)The mount directory of the SSL certificate in the container of OMS Community Edition. If you mount an SSL certificate, the NGINX service in the container of OMS Community Edition runs in HTTPS mode. In this case, you can access the console of OMS Community Edition by using only the HTTPS URL. IS_UPGRADE To upgrade OMS Community Edition, you must set the IS_UPGRADEparameter totrue. Note thatIS_UPGRADEmust be in uppercase.privileged Specifies whether to grant extended privileges on the container. pids-limit Specifies whether to limit the number of container processes. The value -1 indicates that the number is unlimited. ulimit nproc The maximum number of user processes. Go to the new container.
docker exec -it ${CONTAINER_NAME} bashNote
CONTAINER_NAMEspecifies the name of the container.Perform metadata initialization in the
rootdirectory.sleep 300 bash /root/docker_init.shNote
After you run the preceding commands, the script automatically implements schema changes of the three databases of OMS Community Edition.
If the same configuration file is used for multiple
cm_nodesin the same region, you need to execute thedocker_init.shscript only once in a region.
If different configuration files are used for multiplecm_nodesin the same region, you need to execute thedocker_init.shscript once on each node.
If the execution of the preceding commands return the
Version before 4.1.1 is not allowed to upgrade.error, perform the following operations:Verify that the version of OMS Community Edition to be upgraded is not earlier than V4.1.1.
Execute the following SQL statements in the
rmdatabase:CREATE TABLE IF NOT EXISTS `oms_version` ( `version` varchar(64) NOT NULL COMMENT 'version', `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`version`) ) DEFAULT CHARSET = utf8mb4 COMMENT = 'version table'; REPLACE INTO `oms_version`(`version`) VALUES('x.x.x-CE'); -- Specify the version number of OMS Community Edition before the upgrade.Run the initialization command again.
After the
docker_init.shscript is executed, verify that the server list is normal and all servers are in the Online state.Log on to the console of OMS Community Edition.
In the left-side navigation pane, choose OPS & Monitoring > Server.
On the Servers page, check whether the server list is normal. Check whether all servers are in the Online state.
After you upgrade OMS on two nodes, enable HA on the System Parameters page, and configure the parameters.
Log on to the console of OMS Community Edition.
In the left-side navigation pane, choose System Management > System Parameters.
On the System Parameters page, find
ha.config.Click the edit icon in the Value column of the parameter.
In the Modify Value dialog box, set
enabletotrueto enable HA, and record the time as T2.You can also set the
perceiveStoreClientCheckpointparameter totrue. After that, you do not need to record T1 and T2.If you set the
perceiveStoreClientCheckpointparameter tofalse, you need to modify the value of therefetchStoreIntervalMinparameter based on your business needs.refetchStoreIntervalMinspecifies the time interval, in minutes, for pulling data from the Store component. The value must be greater than T2 minus T1.If you set the
perceiveStoreClientCheckpointparameter totrue, you can use the default value of therefetchStoreIntervalMinparameter. HA is enabled, so the system starts the Store component based on the earliest request time of downstream components minus the value of therefetchStoreIntervalMinparameter. For example, if the earliest request time of the downstream Connector or JDBC-Connector component is 12:00:00 and therefetchStoreIntervalMinparameter is set to 30 minutes, the system starts the Store component at 11:30:00.The following table shows status changes of components and projects when HA is enabled or disabled.
| Project/Component status before upgrade | After upgrade (HA disabled) | After upgrade (HA enabled) |
The project runs normally.
|
The project status remains unchanged.
|
The project status remains unchanged.
|
The project failed.
|
||
The project is suspended.
|
The project status remains unchanged.
|
The project status remains unchanged.
|
(Optional) To roll back OMS Community Edition, perform the following steps:
Disable the HA feature based on Step 1.
Suspend the new container and record the time as T3.
sudo docker stop ${CONTAINER_NAME}Connect to the MetaDB and run the following commands:
drop database rm_422; drop database cm_422; drop database cm_hb_422; create database rm_422; create database cm_422; create database cm_hb_422;Restore the original databases based on the SQL files created in Step 2.
mysql -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> -e "source /home/admin/rm_422.sql" -Drm_422 mysql -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> -e "source /home/admin/cm_422.sql" -Dcm_422 mysql -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> -e "source /home/admin/cm_hb_422.sql" -Dcm_hb_422Restart the old container of OMS Community Edition V4.2.2.
sudo docker restart ${CONTAINER_NAME}On the System Parameters page, enable HA and set the
refetchStoreIntervalMinparameter.When you perform a rollback, the HA feature supports automatic disaster recovery. However, you may need to manually recover the Incr-Sync or Full-Import component.
After the upgrade is complete, clear the browser cache before you log on to OMS Community Edition.
Upgrade from V4.1.0 to V4.2.3
Limitations
You can directly upgrade OMS Community Edition from V4.1.0 to V4.2.3. To upgrade OMS Community Edition of a version earlier than V4.1.0, you must upgrade it first to V4.1.0 and then to V4.2.3 based on the operations described in this section. For more information about how to upgrade OMS Community Edition to V4.1.0, see Upgrade Guide for V4.1.0.
Before and during the upgrade, make sure that no users are creating data migration or synchronization projects by using OMS Community Edition.
Before you start the upgrade, make sure that no full migration or full verification tasks are in Running state in OMS Community Edition V4.1.0.
Procedure
Copy the configuration file of OMS Community Edition V4.1.0.
sudo docker cp ${CONTAINER_NAME}:/home/admin/conf/config.yaml ${host directory}Note
CONTAINER_NAMEspecifies the name of the container.Suspend the container of OMS Community Edition V4.1.0.
sudo docker stop ${CONTAINER_NAME}Pull the upgrade script
docker_remote_deploy_410_up_423_version.shfrom the image of OMS Community Edition V4.2.3 to the current directory.sudo docker run -d --net host --name oms-config-tool ${OMS_IMAGE} bash && sudo docker cp oms-config-tool:/root/docker_remote_deploy_410_up_423_version.sh . && sudo docker rm -f oms-config-toolNotice
You need to replace
${IMAGE_TAG}with the image name specified in thedocker load -icommand.Execute the upgrade script to deploy OMS Community Edition V4.2.3.
sh docker_remote_deploy_410_up_423_version.sh -o ${mount directory} -c ${configuration file path} -i ${local IP address} -d ${IMAGE_TAG}Parameter Description mount directory The mount directory, which must be the same as that of the container of OMS Community Edition V4.1.0. config.yaml The configuration file used for the container of OMS Community Edition V4.1.0, which is copied in Step 1. IMAGE_TAG The image name. You need to replace IMAGE_TAGwith the image name specified in thedocker load -icommand.The upgrade script automatically generates a backup of
config.yamlnamedconfig_copy.yaml. The deployment tool of OMS Community Edition automatically verifies the CPU, memory, and disk resources. If any type of resource does not meet the requirement, the deployment tool displays a message prompting that insufficient resources will affect the data migration speed.Complete the deployment as prompted. After you set a parameter, press Enter to move on to the next parameter.
Select a deployment mode.
Select Multiple Nodes in Single Region or Multiple Regions.
Select a task.
Select Use Configuration File Uploaded with Script Option [-c].
If the system displays The specified database names already exist in the MetaDB. Are you sure that you want to continue?, enter
yand press Enter.If the message The specified database names already exist in the MetaDB. Do you want to reinitialize the MetaDB? is displayed, enter
yand press Enter.If the configuration file passes the check, all the settings are displayed. If the settings are correct, enter
yand press Enter to proceed. Otherwise, enternand press Enter to modify the settings.If the configuration file fails the check, modify the configuration information as prompted.
Complete deployment settings on each node as follows:
Specify the directory to which the container of OMS Community Edition is mounted in the host.
The mount directory must be the same as that of the container of OMS Community Edition V4.1.0. For a remote node, the username and password for logging on to the remote node are required. The corresponding user account must have the
sudoprivilege on the remote node.Confirm whether the image file of OMS Community Edition can be named as
OMS_IMAGE.If yes, enter
yand press Enter to proceed. Otherwise, enternand press Enter to modify the settings.Determine whether to mount an SSL certificate to the container of OMS Community Edition.
If yes, enter
y, press Enter, and specify thehttps_keyandhttps_crtdirectories as prompted. Otherwise, enternand press Enter.If the current node is a remote node, the system finds that the IP address of the deployment mode is inconsistent with the IP address of the server where the deployment tool resides, and asks you whether to remotely execute the script. This requires that the remote node support SSH connection and you have the
sudoprivilege on the remote node.If you enter
y, check whether the port of the node can be connected through Secure Shell (SSH). If SSH connection is supported, enter the username and password for logging on to the remote node as prompted.If you leave the password empty, the system will prompt that the password is an empty string and ask you whether to use trusted logon. If you enter
y, enter the password of thesudouser again. If no password is required, directly press Enter.Confirm whether the path to which the config.yaml configuration file will be written is correct.
If yes, enter
yand press Enter to proceed. Otherwise, enternand press Enter to modify the settings.
If you select Multiple Regions for Deployment Mode, you also need to specify whether to deploy OMS Community Edition in a new region.
If yes, enter
yand press Enter to proceed as prompted. If not, enternand press Enter to end the deployment process.If the deployment fails, you can log on to the container of OMS Community Edition and view logs in the
.logfile prefixed withdocker_initin the/home/admin/logsdirectory. If the container of OMS Community Edition fails to be started, you cannot obtain logs.
Begin the upgrade process.
Enter the container of OMS Community Edition V4.2.3.
sudo docker exec -it ${CONTAINER_NAME} bashEnter the root directory and check the upgrade script named
docker_oms_ce_version_upgrade.sh.cd /root lsExecute the upgrade script.
sh docker_oms_ce_version_upgrade.sh
When the execution is completed, the following message is displayed: [Completed] All initialization steps are executed. Then, you can use OMS Community Edition V4.2.3.
Check whether the data migration and synchronization projects are successful and whether the components are running properly.
For information about common issues that may occur after the upgrade and solutions, see Common issues in the upgrade from V4.1.0 to V4.2.3.
Perform a rollback
You can roll back OMS Community Edition from V4.2.3 to V4.1.0 by performing the following operations.
Notice
Before you perform a rollback, make sure the following conditions are met:
No data migration or synchronization projects are created in OMS Community Edition V4.2.3.
Data sources that are not supported by OMS Community Edition V4.1.0, such as HBase data sources, are not created in OMS Community Edition V4.2.3.
Execute the rollback script.
Enter the container of OMS Community Edition V4.2.3.
sudo docker exec -it ${CONTAINER_NAME} bashEnter the root directory and view the rollback script named
docker_oms_ce_version_roll_back.sh.cd /root lsExecute the rollback script.
docker_oms_ce_version_roll_back.shWhen the execution is completed, the following message is displayed: [Completed] All initialization steps are executed.
Suspend and delete the container of OMS Community Edition V4.2.3.
Exit the new container.
Suspend the new container.
sudo docker stop ${CONTAINER_NAME}Delete the new container.
sudo docker rm ${CONTAINER_NAME}
Check the
config.yamlfile of OMS Community Edition V4.1.0.config.yamlmust be consistent withconfig_copy.yaml. If not, modify parameters in theconfig.yamlfile.Start the container of OMS Community Edition V4.1.0.
sudo docker start ${CONTAINER_NAME}