Upgrade OMS Community Edition in multi-node deployment mode

2024-06-26 08:14:11  Updated

This topic describes how to upgrade OceanBase Migration Service (OMS) Community Edition in multi-node deployment mode to V4.2.4.

Notice

Currently, it is only supported to upgrade from OMS Community Edition V4.2.3 to Community Edition V4.2.4. Upgrading from versions lower than Community Edition V4.2.3 to Community Edition V4.2.4 is not supported.

Upgrade procedure

  1. If high availability (HA) is enabled, disable it first.

    1. Log on to the console of OMS Community Edition.

    2. In the left-side navigation pane, choose System Management > System Parameters.

    3. On the System Parameters page, find ha.config.

    4. Click the edit icon in the Value column of the parameter.

    5. In the Modify Value dialog box, set enable to false to disable HA.

  2. Back up the databases.

    1. 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_NAME specifies the name of the container.

    2. 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_423
      
      # 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);
      
    3. 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 files are not 0.

      If you have deployed databases in multiple regions, you must back up the cm_hb database 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, and cm_hb2.

      mysqldump -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> --triggers=false rm_423 > /home/admin/rm_423.sql
      
      mysqldump -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> --triggers=false cm_423 > /home/admin/cm_423.sql
      
      mysqldump -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> --triggers=false cm_hb_423 > /home/admin/cm_hb_423.sql
      
      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_423, cm_423, cm_hb_423 Specifies to back up the rm, cm, and cm_hb databases as SQL files named in the format of database name > SQL file storage path.sql. You need to specify the values based on the actual environment.
  3. 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>
    
  4. Start a new container for OMS Community Edition V4.2.4.

    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.4, make sure that the three disk mounting paths of OMS Community Edition are the same as those before the upgrade.
      You can run the sudo 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=true parameter 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 the docker load -i command.

    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 of OMS_HOST_IP is 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 images command 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_run can 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/run are 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_UPGRADE parameter to true. Note that IS_UPGRADE must 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.
  5. Go to the new container.

    docker exec -it ${CONTAINER_NAME} bash  
    

    Note

    CONTAINER_NAME specifies the name of the container.

  6. Perform metadata initialization in the root directory.

    sleep 300
    bash /root/docker_init.sh
    

    Note

    • 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_nodes in the same region, you need to execute the docker_init.sh script only once in a region.
      If different configuration files are used for multiple cm_nodes in the same region, you need to execute the docker_init.sh script 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:

    1. Verify that the version of OMS Community Edition to be upgraded is not earlier than V4.1.1.

    2. Execute the following SQL statements in the rm database:

      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.
      
    3. Run the initialization command again.

  7. After the docker_init.sh script is executed, verify that the server list is normal and all servers are in the Online state.

    1. Log on to the console of OMS Community Edition.

    2. In the left-side navigation pane, choose OPS & Monitoring > Server.

    3. On the Servers page, check whether the server list is normal. Check whether all servers are in the Online state.

  8. After you upgrade OMS on two nodes, enable HA on the System Parameters page, and configure the parameters.

    1. Log on to the console of OMS Community Edition.

    2. In the left-side navigation pane, choose System Management > System Parameters.

    3. On the System Parameters page, find ha.config.

    4. Click the edit icon in the Value column of the parameter.

    5. In the Modify Value dialog box, set enable to true to enable HA, and record the time as T2.

      You can also set the perceiveStoreClientCheckpoint parameter to true. After that, you do not need to record T1 and T2.

    6. If you set the perceiveStoreClientCheckpoint parameter to false, you need to modify the value of the refetchStoreIntervalMin parameter based on your business needs. refetchStoreIntervalMin 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 perceiveStoreClientCheckpoint parameter to true, you can use the default value of the refetchStoreIntervalMin parameter. HA is enabled, so the system starts the Store component based on the earliest request time of downstream components minus the value of the refetchStoreIntervalMin parameter. For example, if the earliest request time of the downstream Connector or JDBC-Connector component is 12:00:00 and the refetchStoreIntervalMin parameter is set to 30 minutes, the system starts the Store component at 11:30:00.

      The following table shows status changes of components and tasks when HA is enabled or disabled.

    Task/Component status before upgrade After upgrade (HA disabled) After upgrade (HA enabled)
    The task runs normally.
    • The Incr-Sync component runs normally.
    • The store component runs normally.
    The task status remains unchanged.
    • The Incr-Sync component is abnormal.
    • The store component is abnormal.
    The task status remains unchanged.
    • The Incr-Sync component automatically starts.
    • The store component is automatically created based on the configurations. For more information, see Modify HA configurations.
    The task failed.
    • The Incr-Sync component is abnormal.
    • The store component is abnormal.
    The task is suspended.
    • The Incr-Sync component is suspended.
    • The store component runs normally.
    The task status remains unchanged.
    • The Incr-Sync component is suspended.
    • The store component is abnormal.
    The task status remains unchanged.
    • The Incr-Sync component is suspended.
    • The store component is automatically created based on the configurations. For more information, see Modify HA configurations.
  9. (Optional) To roll back OMS Community Edition, perform the following steps:

    1. Disable the HA feature based on Step 1.

    2. Suspend the new container and record the time as T3.

      sudo docker stop ${CONTAINER_NAME}
      
    3. Connect to the MetaDB and run the following commands:

      drop database rm_423;
      drop database cm_423;
      drop database cm_hb_423;
      
      create database rm_423;
      create database cm_423;
      create database cm_hb_423;
      
    4. 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_423.sql" -Drm_423
      
      mysql -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> -e "source /home/admin/cm_423.sql" -Dcm_423
      
      mysql -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> -e "source /home/admin/cm_hb_423.sql" -Dcm_hb_423
      
    5. Restart the old container of OMS Community Edition V4.2.2.

      sudo docker restart ${CONTAINER_NAME}
      
    6. On the System Parameters page, enable HA and set the refetchStoreIntervalMin parameter.

      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.

  10. After the upgrade is complete, clear the browser cache before you log on to OMS Community Edition.

Contact Us