This topic describes how to switch from the primary OMS Community Edition MetaDB to the standby MetaDB in case the primary MetaDB fails, while ensuring that all data from the primary MetaDB is retained.
Procedure
Backup the MetaDB. Manually export the rm, cm, and cm_hb databases to SQL files and verify that the sizes of the three files are not zero.
mysqldump -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> --triggers=false oms_cm_hb_regression > /home/admin/oms_cm_hb_regression.sql mysqldump -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> --triggers=false oms_cm_regression > /home/admin/oms_cm_regression.sql mysqldump -hxxx.xxx.xxx.1 -P<port> -u<username> -p<password> --triggers=false oms_rm_regression > /home/admin/oms_rm_regression.sqlParameter Description -h The host information of the database to be exported. -P The port number for connecting to the database. -u The username for connecting to the database. -p The password for connecting to the database. --triggers Specifies whether to export triggers. The default is false (do not export). oms_cm_hb_regression, oms_cm_regression, oms_rm_regression This parameter specifies to export the rm, cm, and cm_hb databases to SQL files in the format of database name > path to store the SQL file.sql. You need to replace the value with that of your actual environment.Go to the Docker container.
docker exec -it ${CONTAINER_NAME} bashIn the
rootdirectory, run the script to switch the MetaDB.sh docker_update_meta_db.shFollow the prompts to complete the switch. Each time you are prompted to enter information, press Enter to proceed to the next step.
In the Start modifying MetaDB configuration step, enter the IP address, port number, username, and password of the MetaDB as prompted.
You can use a MySQL database or an OceanBase Community Edition MetaDB to store the metadata information of OMS Community Edition.
Wait for the Modify link configuration files of OMS components step to be automatically completed.
In the Do you want to initialize the MetaDB tables step, specify whether to initialize the tables.
If you enter y, the system will automatically create the databases and tables required for the metadata information of OMS Community Edition at the new address.
If you enter n, no databases or tables will be created. Note that in this case, the databases and tables required for the metadata information of OMS Community Edition must already exist at the new address.
Wait for the components to be restarted.
Log in to the OMS Community Edition console to check whether the environment is normal.
You can also check the
/home/admin/conf/config.yamlfile to confirm that the MetaDB configuration has been changed to the new MetaDB.