This topic describes how to upgrade OceanBase Migration Service (OMS) to V3.4.0 in single-node deployment mode.
Upgrade procedure
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 V3.3.1 and record the time T1.
sudo docker stop ${CONTAINER_NAME}Notice:
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_331 # Delete useless records. # Obtain the auto-increment ID from heatbeat_sequence, which reports the heartbeat. delete from heatbeat_sequence where id < (select max(id) from heatbeat_sequence);Run the following commands to back up the rm, cm, and cm_hb databases as SQL files and make sure that the sizes of the three files are not 0.
mysqldump -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> --triggers=false rm_331 > /home/admin/rm_331.sql mysqldump -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> --triggers=false cm_331 > /home/admin/cm_331.sql mysqldump -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> --triggers=false cm_hb_331 > /home/admin/cm_hb_331.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_331, cm_331, and cm_hb_331 Specify to back up the rm, cm, and cm_hb databases to SQL files named in the format of database name > SQL file storage path.sql. You need to replace the values based on the actual environment.
Load the downloaded OMS image file to the local image repository of the Docker container.
docker load -i <Storage path of the OMS image>Start the new container of OMS V3.4.0.
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 V3.4.0, 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_xxx format. Specify xxx based on the actual OMS version. For example, if you use OMS V3.4.0, the value is oms_340. IMAGE_TAG The tag of the image in the feature_x.x.x format. Specify x.x.x based on the actual OMS version. For example, if you use OMS V3.4.0, the value is feature_3.4.0. /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 to true.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. Access the new container.
docker exec -it ${CONTAINER_NAME} bashNote:
CONTAINER_NAMEspecifies the name of the container.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.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.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, which specifies 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.
Optional. To roll back, perform the following steps:
Follow the instructions in Step 1 to disable HA.
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_331; drop database cm_331; drop database cm_hb_331; create database rm_331; create database cm_331; create database cm_hb_331;Recover 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_331.sql" -Drm_331 mysql -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> -e "source /home/admin/cm_331.sql" -Dcm_331 mysql -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> -e "source /home/admin/cm_hb_331.sql" -Dcm_hb_331Restart the container of OMS V3.3.1.
sudo docker restart ${CONTAINER_NAME}On the System Parameters page, enable HA and set the
refetchStoreIntervalMinparameter.
When you perform the rollback operation, the HA feature supports automatic disaster recovery. However, you may need to manually recover the JDBCWriter or connector component.
After the upgrade is complete, clear the browser cache before you log on to OMS.