This topic describes how to upgrade OceanBase Migration Service (OMS) Community Edition in single-node deployment mode to V4.2.11.
Notice
Only OMS Community Edition V4.2.0 to V4.2.10 can be upgraded to OMS Community Edition V4.2.11. OMS Community Edition earlier than V4.2.0 cannot be upgraded to V4.2.11.
Upgrade procedure
Load the downloaded OMS Community Edition installation package to the local image repository of the Docker container.
docker load -i <OMS Community Edition installation package>Back up the database.
Suspend the container of OMS Community Edition V4.2.10 and record the time as T1.
sudo docker stop ${CONTAINER_NAME}Note
CONTAINER_NAMEspecifies the name of the container.Log in to the cluster management (CM) heartbeat database specified in the configuration file and delete some useless records to reduce the backup time.
# Log in to the CM heartbeat database specified in the configuration file. mysql -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> -Dcm_hb_4210 # 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 three files are not 0:mysqldump -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> --triggers=false rm_4210 > /home/admin/rm_4210.sql mysqldump -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> --triggers=false cm_4210 > /home/admin/cm_4210.sql mysqldump -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> --triggers=false cm_hb_4210 > /home/admin/cm_hb_4210.sqlThe following table describes the backup parameters.
Parameter 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_4210, cm_4210, and cm_hb_4210 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.
Start a new container for OMS Community Edition V4.2.11.
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 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 for OMS Community Edition V4.2.11, make sure that the three disk mount 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 mount paths before the upgrade, which are paths to the disks mounted to the old container of OMS Community Edition.The
IS_UPGRADEparameter 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.You need to replace
work.oceanbase-dev.com/obartifact-store/oms:${IMAGE_TAG}with the image name specified in 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}The following table describes the startup parameters.
Parameter Description OMS_HOST_IP The IP address of the host. 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 (<OMS_IMAGE>) 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 -1indicates that the number is unlimited.ulimit nproc The maximum number of user processes. Check the initialization execution status. When the
OMS service start successfullymessage appears, the upgrade is complete.docker logs -f ${CONTAINER_NAME}Note
CONTAINER_NAMEspecifies the name of the container.After the upgrade, verify that the server list is normal and all servers are in the Online state.
Log in 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.
(Optional) To roll back OMS Community Edition, perform the following steps:
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_4210; drop database cm_4210; drop database cm_hb_4210; create database rm_4210; create database cm_4210; create database cm_hb_4210;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_4210.sql" -Drm_4210 mysql -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> -e "source /home/admin/cm_4210.sql" -Dcm_4210 mysql -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> -e "source /home/admin/cm_hb_4210.sql" -Dcm_hb_4210Restart the old container of OMS Community Edition V4.2.10.
sudo docker restart ${CONTAINER_NAME}
After the upgrade is complete, clear the browser cache before you log in to OMS Community Edition.