You can directly upgrade OceanBase Migration Service (OMS) V3.2.1 and later versions to OMS V4.0.2. This topic describes how to upgrade OMS in single-node deployment mode in different scenarios.
Background
An upgrade to OMS V4.0.2 can be classified into the following two version scenarios:
The current OMS version is V3.2.1 or later, but is neither V4.0.1 nor V4.0.1 BP1.
To upgrade OMS of a version earlier than V3.2.1, you must upgrade it first to V3.2.1.
The current OMS version is V4.0.1 or V4.0.1 BP1.
To upgrade OMS from V3.2.1 or later but neither V4.0.1 nor V4.0.1 BP1, you must perform the following two more steps than upgrading from V4.0.1 or V4.0.1 BP1 to V4.0.2:
Check the prerequisites below.
Execute the upgrade package in the
.jarformat during the upgrade.
Upgrade OMS from V4.0.1 or V4.0.1 BP1 to V4.0.2
If high availability (HA) is enabled, disable it first.
Log on to the OMS console.
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.
Suspend the container of OMS V4.0.1 and record the time T1.
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 back up data.
# Log on to the CM heartbeat database specified in the configuration file. mysql -hxxx.xxx.xxx.xxx -P<port> -u<username> -p<password> -Dcm_hb_401 # Create an intermediate table. CREATE TABLE IF NOT EXISTS `heatbeat_sequence_bak` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'PK', `gmt_created` datetime NOT NULL, `gmt_modified` datetime NOT NULL, PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8 COMMENT='Heartbeat sequence table'; # Back up data to the intermediate table. INSERT INTO heatbeat_sequence_bak SELECT `id`,`gmt_created`,`gmt_modified` FROM heatbeat_sequence ORDER BY `id` DESC LIMIT 1; # Rename the heatbeat_sequence table and the intermediate table. # The heatbeat_sequence table provides auto-increment IDs and reports the heartbeat. ALTER TABLE `heatbeat_sequence` RENAME TO `heatbeat_sequence_bak2`; ALTER TABLE `heatbeat_sequence_bak` RENAME TO `heatbeat_sequence`; # Delete the original table. DROP TABLE heatbeat_sequence_bak2;Run the following commands to back up the
rm,cm, andcm_hbdatabases as SQL files and make sure that the sizes of the three files are not 0.mysqldump -hxxx.xxx.xxx.xxx -P<port> -u<username> -p<password> --triggers=false rm_401 > /home/admin/rm_401.sql mysqldump -hxxx.xxx.xxx.xxx -P<port> -u<username> -p<password> --triggers=false cm_401 > /home/admin/cm_401.sql mysqldump -hxxx.xxx.xxx.xxx -P<port> -u<username> -p<password> --triggers=false cm_hb_401 > /home/admin/cm_hb_401.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_401, cm_401, and cm_hb_401 Specifies to back up the rm,cm, andcm_hbdatabases to SQL files named in the format ofdatabase name > SQL file storage path.sql. You need to replace the values based on the actual environment.
Load the downloaded OMS installation package to the local image repository of the Docker container.
docker load -i <OMS installation package>Start the new container of OMS V4.0.2.
You can access the OMS console by using an HTTP or HTTPS URL. To securely access the OMS console, 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 of OMS V4.0.2, make sure that the three disk mounting paths of OMS are the same as those before the upgrade.
You can run thesudo docker inspect ${CONTAINER_NAME} | grep -A5 'Binds'command to view the paths of disks mounted to the old OMS container.The
-e IS_UPGRADE=trueparameter is provided in OMS V3.3.1 or later. This parameter is provided only to support OMS upgrades and must be specified when you upgrade OMS.
OMS_HOST_IP=xxx CONTAINER_NAME=oms_xxx IMAGE_TAG=feature_x.x.x 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 in 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. CONTAINER_NAME The name of the container in the oms_xxxformat. Specifyxxxbased on the actual OMS version. For example, if you use OMS V4.0.1, the value isoms_401.IMAGE_TAG The unique identifier of the loaded image. After you load the OMS installation package by using Docker, run the docker imagescommand to obtain the [IMAGE ID] or [REPOSITORY:TAG] 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_runYou can replace /data/oms/oms_logs,/data/oms/oms_store, and/data/oms/oms_runwith the mount directories created on the server where OMS is deployed. The mount directories store the logs generated during the operation of OMS and files generated by the Store and synchronization components, respectively, to persistently retain the files on the server.
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 OMS container. If you mount an SSL certificate, the NGINX service in the OMS container runs in HTTPS mode. In this case, you can access the OMS console by using only the HTTPS URL. IS_UPGRADE To upgrade OMS, you must set the IS_UPGRADEparameter totrue.privileged Specifies whether to grant extended privileges on the container. pids-limit Specifies whether to limit the number of container processes. The value -1indicates that the number is unlimited.ulimit nproc The maximum number of user processes. Go to the new container.
docker exec -it ${CONTAINER_NAME} bashPerform metadata initialization in the root directory.
bash /root/docker_init.shAfter you run the preceding command, the script automatically implements schema changes of the three OMS databases.
After the
docker_init.shscript is executed, confirm whether the server list is normal and whether all servers are in the Online state.Log on to the OMS console.
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.
On the System Parameters page, enable HA, and configure the parameters.
Log on to the OMS console.
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 T2.We recommend that you set the
perceiveStoreClientCheckpointparameter totrue. After that, you do not need to record T1 and T2.After you set the
perceiveStoreClientCheckpointparameter totrue, you can use the default value30minof 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.If you set the
perceiveStoreClientCheckpointparameter tofalse, you need to modify the value of therefetchStoreIntervalMinparameter based on your business needs, which specifies the time interval, in minutes, for pulling data from the Store component. The value must be greater than T2 minus T1.
(Optional) To roll back, perform the following steps:
When you perform a rollback, the HA feature supports automatic disaster recovery. However, you may need to manually recover the Full-Import or Incr-Sync component.
Disable the HA feature based on Step 1.
Suspend the new container and record the time T3.
sudo docker stop ${CONTAINER_NAME}Connect to the MetaDB and run the following commands:
drop database rm_401; drop database cm_401; drop database cm_hb_401; create database rm_401; create database cm_401; create database cm_hb_401;Restore the original databases based on the SQL files created in Step 2.
mysql -hxxx.xxx.xxx.xxx -P<port> -u<username> -p<password> -e "source /home/admin/rm_401.sql" -Drm_401 mysql -hxxx.xxx.xxx.xxx -P<port> -u<username> -p<password> -e "source /home/admin/cm_401.sql" -Dcm_401 mysql -hxxx.xxx.xxx.xxx -P<port> -u<username> -p<password> -e "source /home/admin/cm_hb_401.sql" -Dcm_hb_401Restart the container of OMS V4.0.1.
sudo docker restart ${CONTAINER_NAME}On the System Parameters page, enable HA and set the
refetchStoreIntervalMinparameter.
After the upgrade is complete, clear the browser cache before you log on to OMS.
Upgrade OMS from V3.2.1 or later but not V4.0.1 or V4.0.1 BP1 to V4.0.2
Prerequisites
Before the upgrade, check for data migration and synchronization projects with duplicate names. If data migration and synchronization projects with duplicate names exist, rename the projects to ensure that all project names are unique.
Run the following command to check whether projects with duplicate names exist:
Data migration project
SELECT project_name,count(*) AS count,group_concat(id) AS ids FROM oms_project WHERE project_status != "DELETED" GROUP BY project_name HAVING count(*) > 1;Data synchronization project
SELECT project_name,count(*) AS count,group_concat(id) AS ids FROM oms_sync_project WHERE project_status != "DELETED" GROUP BY project_name HAVING count(*) > 1;
If projects with duplicate names exist, rename the projects in sequence. Syntax:
Data migration project
UPDATE oms_project SET project_name=<New name of the data migration project> WHERE id=<ID of the data migration project>;Data synchronization project
UPDATE oms_sync_project SET project_name=<New name of the data synchronization project> WHERE id=<ID of the data synchronization project>;
If you use an OceanBase Database data source as both the destination of one data synchronization project and the source of another project, and you have updated the
blackRegionNoparameter of JDBCWriter, perform the following steps:In the OMS container, run the following command to obtain the value of
cm_location:cat /home/admin/conf/config.yaml | grep 'cm_location'Log on to the
drc_cmdatabase of OMS and run the following command:SELECT * FROM config_job WHERE `key`='sourceFile.blackRegionNo' AND VALUE!=xxx;If the query result is not empty and a data source is still used as both the destination of one data synchronization project and the source of another project, contact OMS Technical Support. If the query result is empty, proceed with the upgrade operations.
Procedure
The following procedure takes the upgrade of OMS from V3.4.0 to V4.0.2 as an example.
If HA is enabled, disable it first.
Back up the databases.
Suspend the container of OMS V3.4.0 and record the time T1.
sudo docker stop ${CONTAINER_NAME}Note
CONTAINER_NAMEspecifies the name of the container.Log on to the CM heartbeat database specified in the configuration file and back up data.
# Log on to the CM heartbeat database specified in the configuration file. mysql -hxxx.xxx.xxx.xxx -P<port> -u<username> -p<password> -Dcm_hb_340 # Create an intermediate table. CREATE TABLE IF NOT EXISTS `heatbeat_sequence_bak` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'PK', `gmt_created` datetime NOT NULL, `gmt_modified` datetime NOT NULL, PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8 COMMENT='Heartbeat sequence table'; # Back up data to the intermediate table. INSERT INTO heatbeat_sequence_bak SELECT `id`,`gmt_created`,`gmt_modified` FROM heatbeat_sequence ORDER BY `id` DESC LIMIT 1; # Rename the heatbeat_sequence table and the intermediate table. # The heatbeat_sequence table provides auto-increment IDs and reports the heartbeat. ALTER TABLE `heatbeat_sequence` RENAME TO `heatbeat_sequence_bak2`; ALTER TABLE `heatbeat_sequence_bak` RENAME TO `heatbeat_sequence`; # Delete the original table. DROP TABLE heatbeat_sequence_bak2;Run the following commands to back up the
rm,cm, andcm_hbdatabases as SQL files and make sure that the sizes of the three files are not 0.mysqldump -hxxx.xxx.xxx.xxx -P<port> -u<username> -p<password> --triggers=false rm_401 > /home/admin/rm_340.sql mysqldump -hxxx.xxx.xxx.xxx -P<port> -u<username> -p<password> --triggers=false cm_401 > /home/admin/cm_340.sql mysqldump -hxxx.xxx.xxx.xxx -P<port> -u<username> -p<password> --triggers=false cm_hb_401 > /home/admin/cm_hb_340.sql
Load the downloaded OMS installation package to the local image repository of the Docker container.
docker load -i <OMS installation package>Start the new container of OMS V4.0.2.
You can access the OMS console by using an HTTP or HTTPS URL. To securely access the OMS console, install an 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 of OMS V4.0.2, make sure that the three disk mounting paths of OMS are the same as those before the upgrade.
You can run thesudo docker inspect ${CONTAINER_NAME} | grep -A5 'Binds'command to view the paths of disks mounted to the old OMS container.The
-e IS_UPGRADE=trueparameter is provided in OMS V3.3.1 or later. This parameter is provided only to support OMS upgrades and must be specified when you upgrade OMS.
OMS_HOST_IP=xxx CONTAINER_NAME=oms_xxx IMAGE_TAG=feature_x.x.x 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 in 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}Go to the new container.
docker exec -it ${CONTAINER_NAME} bashAfter the CM and Supervisor services are started, run the command similar to the following to execute the upgrade package in the
.jarformat:Notice
The OMS console must be in the STOPPED state.
Replace the parameter values based on the actual situation.
/opt/alibaba/java/bin/java -jar correction-1.0-SNAPSHOT-jar-with-dependencies.jar -mupgrade -y/home/admin/conf/config.yaml -ltrueParameter Description -m The running mode. Valid values: BACKUPDB(to back up the database) andUPGRADE(to upgrade the database).-y The absolute path of the OMS configuration file. -l Specifies whether this upgrade node is the last one. In single-region scenarios, set this parameter to true. In multi-region scenarios, set this parameter tofalsefor the first several regions, and totruefor the last region only.
Note: In multi-region, multi-node scenarios, you need to execute the upgrade package in the.jarformat only for the first node in each region. When you perform an upgrade for the last region, set the-lparameter totrue.Perform metadata initialization in the root directory.
bash /root/docker_init.shAfter you run the preceding command, the script automatically implements schema changes of the three OMS databases.
After the
docker_init.shscript is executed, confirm whether the server list is normal and whether all servers are in the Online state.On the System Parameters page, enable HA, and configure the parameters.
Log on to the OMS console.
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 T2.We recommend that you set the
perceiveStoreClientCheckpointparameter totrue. After that, you do not need to record T1 and T2.After you set the
perceiveStoreClientCheckpointparameter totrue, you can use the default value30minof 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.If you set the
perceiveStoreClientCheckpointparameter tofalse, you need to modify the value of therefetchStoreIntervalMinparameter based on your business needs, which specifies the time interval, in minutes, for pulling data from the Store component. The value must be greater than T2 minus T1.
(Optional) To roll back, perform the following steps:
When you perform a rollback, the HA feature supports automatic disaster recovery. However, you may need to manually recover the Full-Import or Incr-Sync component.
Disable the HA feature based on Step 1.
Suspend the new container and record the time T3.
sudo docker stop ${CONTAINER_NAME}Connect to the MetaDB and run the following commands:
drop database rm_340; drop database cm_340; drop database cm_hb_340; create database rm_340; create database cm_340; create database cm_hb_340;Restore the original databases based on the SQL files created in Step 2.
mysql -hxxx.xxx.xxx.xxx -P<port> -u<username> -p<password> -e "source /home/admin/rm_340.sql" -Drm_340 mysql -hxxx.xxx.xxx.xxx -P<port> -u<username> -p<password> -e "source /home/admin/cm_340.sql" -Dcm_340 mysql -hxxx.xxx.xxx.xxx -P<port> -u<username> -p<password> -e "source /home/admin/cm_hb_340.sql" -Dcm_hb_340Restart the container of OMS V3.4.0.
sudo docker restart ${CONTAINER_NAME}On the System Parameters page, enable HA and set the
refetchStoreIntervalMinparameter.
After the upgrade is complete, clear the browser cache before you log on to OMS.