If serious problems occur after you upgrade Web ODC, you can roll back the MetaDB based on the backup and use the image of the previous version.
Stop the ODC service of the new version.
a. Obtain the container ID.
C:\Users\ob>docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8bfecbc1cd03 acs-reg.alipay.com/oceanbase/obodc:2.0.1 "/bin/sh -c '/usr/bi..." 13 days ago Up 13 days 80/tcp, 8080/tcp, x.x.x.x:8989->8989/tcp obodcb. Stop the container that runs the new ODC version.
C:\Users\ob>docker stop 8bfecbc1cd03 8bfecbc1cd03Restore the MetaDB of the version before the upgrade.
Example: Use the
~/odcmetadb_backupfile, which is backed up before the upgrade, to restore the ODC MetaDB.#restore odc metadb ./obloader --thread 1 -h <host> -P <port> -u <username> -c <cluster_name> -t <tenant_name> -D <database_name> --ddl --csv --no-sys --all -f ~/odcmetadb_backupNote
For more information about the parameters in the restore command, see OBLOADER command-line options.
Start the ODC service of the version before the upgrade.
#!/usr/bin/env bash docker run -d -i --net host --cpu-period 100000 --cpu-quota 400000 --memory 8G --name "obodc" -e "DATABASE_HOST=xxx.xx.xx.xx" -e "DATABASE_PORT=60805" -e "DATABASE_USERNAME=db_user@tenant_name#cluster_name" -e "DATABASE_PASSWORD=******" -e "DATABASE_NAME=odc_metadb" -e "ODC_PROFILE_MODE=alipay" reg.docker.alibaba-inc.com/oceanbase/odc-server:{image_tag}You can run the
docker imagescommand to view {image_tag} on the host after the image is loaded. The following table describes the other parameters.Parameter Description --net Specifies the network configuration of the container. If you set this parameter to host, the host network is directly used. You can also use the--publish(-p) parameter to configure port mapping. However, the Docker container may fail to start in some circumstances due to DNS resolution errors in the Docker container. In this case, run the--net hostcommand to start the Docker container.--cpu-period --cpu-quota --cpu-period specifies the interval in which the CPU cores of the Docker container are reallocated. Unit: microseconds. --cpu-quota specifies the maximum time for running the current Docker container in this interval. Unit: microseconds. You can use these two parameters in combination to specify the number of CPU cores that the Docker container can use. The value of cpu-quota divided by cpu-period is the number of CPU cores that the Docker container can use. In the preceding sample statement, the values of cpu-quota and cpu-period are respectively 400000 and 100000, indicating that the Docker container can use at most four CPU cores. --memory Specifies the maximum memory size for the Docker container. --name Specifies the name of the container. DATABASE_HOST Specifies the IP address of the MetaDB. DATABASE_PORT Specifies the port number of the MetaDB. DATABASE_USERNAME Specifies the username of the MetaDB. In OceanBase Database, the username is given in the db_user@tenant_name#cluster_name format. DATABASE_PASSWORD Specifies the username for connecting to the database. DATABASE_NAME Specifies the name of the MetaDB. ODC_PROFILE_MODE Specifies the mode, which is alipayby default.