Database available mutual backup method realized based on public cloud

By creating master-slave database instances on a public cloud platform and configuring semi-synchronous replication mode, the problems of cross-regional data replication latency and data conflict were solved, realizing an efficient and reliable database backup method and ensuring business continuity and data consistency.

CN120951399APending Publication Date: 2025-11-14CHINA NAT BUILDING MATERIALS TECH CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411733106.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

In existing database backup methods based on public cloud, network latency and data synchronization delays caused by cross-regional data replication affect the performance of real-time applications. Data conflict issues in multi-master replication mode and complex fault detection and automatic switching mechanisms require precise configuration to avoid accidental triggering or switching failure.

Method used

By selecting a suitable public cloud platform, creating master-slave database instances, configuring semi-synchronous replication mode, setting security group rules, establishing master-slave database relationships, and conducting tests, data consistency and reliability can be ensured.

Benefits of technology

It enables efficient and reliable data synchronization and fault recovery in a public cloud environment, ensuring business continuity and data consistency, reducing the risk of data loss, and improving the stability and reliability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120951399A_ABST
    Figure CN120951399A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of cloud computing, in particular to a database available mutual backup method realized based on public cloud. The method comprises the following steps: S1, selecting a public cloud platform according to service requirements; s2, creating a main database instance on the selected public cloud platform; s3, creating a slave database instance on the selected public cloud platform; s4, configuring copy options of the main database on the public cloud platform; s5, configuring copy options of the slave database on the selected public cloud platform; s6, establishing a master-slave database relationship; and S7, testing the copying function of the master and slave databases. Through master-slave replication, data is synchronized among a plurality of database instances, even if a certain instance breaks down, other instances can still continue to provide services, and service continuity is ensured. And through a semi-synchronous replication mode, the data consistency between the master database and the slave database is ensured, and the risk of data loss is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of cloud computing technology, and more specifically, to a database availability and backup method based on public cloud. Background Technology

[0002] Database availability and backup based on public cloud is a technical solution that leverages cloud computing technology to ensure high data availability and disaster recovery capabilities. This method replicates database instances across different geographical locations or data centers to enable rapid switching to a backup database in the event of a primary database failure, thereby ensuring business continuity and data integrity. Specifically, database replicas can be deployed in data centers provided by multiple cloud service providers through master-slave replication or multi-master replication. When the primary database fails, applications can seamlessly switch to the standby database to continue running without significant impact on users.

[0003] Existing database availability and mutual backup methods based on public clouds suffer from network latency and data synchronization lag caused by cross-regional data replication, which can impact the performance of real-time applications. Data conflict issues in multi-master replication models, where simultaneous updates of the same data record across different master databases can lead to inconsistencies, also present challenges. Furthermore, complex fault detection and automatic failover mechanisms require precise configuration to avoid accidental triggering or failover failures, which could otherwise cause larger system problems. Therefore, this paper proposes a database availability and mutual backup method based on public clouds. Summary of the Invention

[0004] The purpose of this invention is to provide a database availability backup method based on public cloud, in order to solve the network latency and data synchronization lag caused by cross-regional data replication in existing database availability backup methods based on public cloud, which may affect the performance of real-time applications; the data conflict problem in multi-master replication mode, that is, the data inconsistency may occur when different master databases update the same data record at the same time; and the complex fault detection and automatic switching mechanism, which requires precise configuration to avoid accidental triggering or switching failure.

[0005] To achieve the above objectives, the present invention aims to provide a database availability backup method based on public cloud, comprising the following steps:

[0006] S1. Select a public cloud platform based on business needs;

[0007] S2. Create a primary database instance on the selected public cloud platform;

[0008] S3. Create a database instance on the selected public cloud platform;

[0009] S4. Configure the replication options for the primary database on the public cloud platform;

[0010] S5. Configure the database replication options on the selected public cloud platform;

[0011] S6. Establish master-slave database relationship;

[0012] S7. Test the master-slave database replication function.

[0013] As a further improvement to this technical solution, the specific steps for selecting a public cloud platform based on business needs in step S1 are as follows:

[0014] S2.1 Analyze business requirements;

[0015] These business requirements include data volume, concurrent requests, security requirements, and budget.

[0016] S2.2 Compare the characteristics of different public cloud platforms;

[0017] Among them, public cloud platforms include Alibaba Cloud, Tencent Cloud, and Huawei Cloud;

[0018] S2.3, Evaluate the service level agreement, technical support, and pricing of public cloud platforms;

[0019] S2.4 Select a public cloud platform.

[0020] As a further improvement to this technical solution, the specific steps in S2 for creating a primary database instance on the selected public cloud platform are as follows:

[0021] S3.1 Log in to the management console of the selected cloud service platform;

[0022] S3.2 Select the database type MySQL;

[0023] S3.3 Select instance specifications;

[0024] The instance specifications include the number of CPU cores, memory size, and storage space.

[0025] S3.4 Configure network settings, select Virtual Private Cloud and Subnet;

[0026] S3.5. Configure security group rules to allow specific IP addresses and CIDR blocks to access the database;

[0027] S3.6. Create the primary database instance.

[0028] As a further improvement to this technical solution, the specific steps in S3 for creating a database instance on the selected public cloud platform are as follows:

[0029] S4.1 Log in to the management console of the selected cloud service platform;

[0030] S4.2 Select the same database type as the primary database;

[0031] S4.3 Select the same instance specification as the primary database;

[0032] S4.4 Configure network settings, select the same VPC as the main database and a different subnet;

[0033] S4.5 Configure security group rules to allow the master database IP address to access the slave database;

[0034] S4.6. Create a database instance on the selected public cloud platform.

[0035] As a further improvement to this technical solution, the specific steps for configuring the replication option of the primary database on the public cloud platform in step S4 are as follows:

[0036] S5.1 Log in to the management interface of the primary database instance;

[0037] S5.2 Enable database replication function and set the replication mode to semi-synchronous replication;

[0038] S5.3 Create a user for copying and grant the necessary permissions for copying;

[0039] S5.4 Configure binary log related parameters;

[0040] S5.5 Save the configuration and restart the database instance for the changes to take effect.

[0041] As a further improvement to this technical solution, the specific steps in S5 for configuring the database replication option on the selected public cloud platform are as follows:

[0042] S6.1 Log in to the database instance's management interface;

[0043] S6.2 Edit the MySQL configuration file;

[0044] S6.3 Save the configuration and restart the database instance for the changes to take effect.

[0045] As a further improvement to this technical solution, the specific steps for establishing the master-slave database relationship in step S6 are as follows:

[0046] S7.1 Use SQL commands to view the status of the main database and obtain the binary log file name and location;

[0047] S7.2 Configuring the master-slave relationship in the database;

[0048] S7.3. Use SQL commands to start a replication thread from the database;

[0049] S7.4 Use SQL commands to check the replication status from the database to ensure that the replication thread is running and there is no delay.

[0050] As a further improvement to this technical solution, in step S7.2, the master-slave relationship of the database is configured:

[0051] S7.21. Log in to the database instance through the management interface or command-line tool;

[0052] S7.22. Confirm the connection information for the main database;

[0053] S7.23. Use SQL commands to configure the connection information, binary log file name, and location of the master database.

[0054] As a further improvement to this technical solution, the specific steps for testing the master-slave database replication function in S7 are as follows:

[0055] S8.1. Insert a test record in the management console of the primary database instance.

[0056] S8.2. In the database instance's management console, query the data that was just inserted.

[0057] S8.3 Check the replication latency between the master and slave databases.

[0058] As a further improvement to this technical solution, the specific steps for checking the replication delay between the master and slave databases in S8.3 are as follows:

[0059] S8.31. Log in to the database instance using the SQL command-line tool;

[0060] S8.32. In the command-line interface of the database instance, use SQL commands to check the replication status of the database.

[0061] S8.33. Verify the output results to determine the replication delay.

[0062] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0063] 1. This database availability and backup method based on public cloud utilizes the management interface provided by the cloud platform to quickly create and configure the primary database instance, ensuring the accuracy and efficiency of the initial setup. Enabling replication and setting a semi-synchronous replication mode ensures data consistency and reliability, reducing the risk of data loss.

[0064] 2. This database availability and backup method based on public cloud utilizes master-slave replication to synchronize data across multiple database instances. Even if one instance fails, other instances can continue to provide services, ensuring business continuity. Semi-synchronous replication ensures data consistency between the master and slave databases, reducing the risk of data loss. Testing ensures the correctness and effectiveness of the replication function, allowing for timely identification and resolution of problems, thus ensuring system stability and reliability. Attached Figure Description

[0065] Figure 1 This is a flowchart of the overall method of the present invention. Detailed Implementation

[0066] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0067] Example:

[0068] Please see Figure 1 As shown, this embodiment provides a database availability backup method based on public cloud, including the following steps:

[0069] S1. Select a public cloud platform based on business needs;

[0070] In this example, the specific steps for selecting a public cloud platform based on business needs are as follows:

[0071] S2.1 Analyze business requirements;

[0072] These business requirements include data volume, concurrent requests, security requirements, and budget.

[0073] S2.2 Compare the characteristics of different public cloud platforms;

[0074] Among them, public cloud platforms include Alibaba Cloud, Tencent Cloud, and Huawei Cloud;

[0075] S2.3, Evaluate the service level agreement, technical support, and pricing of public cloud platforms;

[0076] S2.4 Select a public cloud platform.

[0077] Specifically, a public cloud platform refers to computing services provided by third-party service providers via the internet. These services can be free or pay-as-you-go, and are designed to provide computing resources, such as servers, storage, databases, networks, and software, to a wide range of enterprise and individual users. Users do not need to own or manage physical hardware; instead, they access these resources via the internet, use them on demand, and pay the corresponding fees.

[0078] By conducting a detailed analysis of business requirements (such as data volume, concurrent requests, security requirements, and budget), comparing the characteristics of different public cloud platforms (such as Alibaba Cloud, Tencent Cloud, and Huawei Cloud), and evaluating the service level agreements, technical support, and pricing of each platform, the most suitable public cloud platform can be selected, ensuring the high availability and stability of the database system. This process not only helps enterprises choose the optimal cloud service provider while keeping costs under control, but also lays a solid foundation for subsequent database configuration and the implementation of mutual backup solutions, thereby ensuring business continuity and data security.

[0079] S2. Create a primary database instance on the selected public cloud platform;

[0080] In this example, the specific steps for creating a primary database instance on the selected public cloud platform are as follows:

[0081] S3.1 Log in to the management console of the selected cloud service platform;

[0082] S3.2 Select the database type MySQL;

[0083] S3.3 Select instance specifications;

[0084] The instance specifications include the number of CPU cores, memory size, and storage space.

[0085] S3.4 Configure network settings, select Virtual Private Cloud and Subnet;

[0086] S3.5. Configure security group rules to allow specific IP addresses and CIDR blocks to access the database;

[0087] Specifically, security group rules are a set of rules in a cloud platform used to control network traffic entering and leaving virtual machines or database instances. Similar to a traditional firewall, they ensure that only authorized traffic can access resources by defining what is allowed or denied for specific types of network traffic. Configuring security group rules is a crucial step when creating the primary database instance, effectively improving system security.

[0088] S3.6. Create the primary database instance.

[0089] Specifically, by logging into the management console of the selected cloud service platform, choosing the appropriate database type (MySQL), selecting suitable instance specifications (such as CPU core count, memory size, and storage space), configuring network settings (selecting a Virtual Private Cloud and subnet), setting security group rules (allowing specific IP addresses and CIDR blocks to access the database), and finally creating the master database instance, the database system can be optimized in terms of performance, high availability, and security. This process provides a reliable infrastructure for subsequent master-slave replication configuration and data synchronization, thereby ensuring business continuity and data consistency.

[0090] S3. Create a database instance on the selected public cloud platform;

[0091] In this example, the specific steps for creating a database instance on the selected public cloud platform are as follows:

[0092] S4.1 Log in to the management console of the selected cloud service platform;

[0093] S4.2 Select the same database type as the primary database;

[0094] S4.3 Select the same instance specification as the primary database;

[0095] S4.4 Configure network settings, select the same VPC as the main database and a different subnet;

[0096] S4.5 Configure security group rules to allow the master database IP address to access the slave database;

[0097] S4.6. Create a database instance on the selected public cloud platform.

[0098] Specifically, by logging into the management console of the selected cloud service platform, choosing the same database type and instance specifications as the primary database, configuring network settings (selecting the same VPC as the primary database but a different subnet), setting security group rules (allowing the primary database IP address to access the secondary database), and finally creating the secondary database instance on the selected public cloud platform, the secondary database can be ensured to synchronize data with the primary database efficiently and securely. This process provides a solid foundation for achieving high availability and data redundancy, thereby ensuring business continuity and data consistency.

[0099] S4. Configure the replication options for the primary database on the public cloud platform;

[0100] In this example, the specific steps for configuring the replication options of the primary database on the public cloud platform are as follows:

[0101] S5.1 Log in to the management interface of the primary database instance;

[0102] S5.2 Enable database replication function and set the replication mode to semi-synchronous replication;

[0103] Specifically, semi-synchronous replication is a database replication mode that falls between asynchronous replication and fully synchronous replication. In database systems, replication technology is used to improve system availability and data consistency, ensuring that data changes on the master database can be replicated to one or more slave databases.

[0104] S5.3 Create a user for copying and grant the necessary permissions for copying;

[0105] S5.4 Configure binary log related parameters;

[0106] Specifically, edit the MySQL configuration file (usually my.cnf or my.ini) and add or modify the following parameters:

[0107] Set a unique identifier for the primary database (server-id=1).

[0108] Enable binary logging (log-bin = mysql-bin).

[0109] Set the binary log format to line format (binlog-format=ROW).

[0110] Specify the database for which binary logs should be recorded (binlog-do-db=main_db).

[0111] Set the number of days to retain binary logs (expire_logs_days = 7).

[0112] By logging into the management interface of the primary database instance, enabling database replication and setting the replication mode to semi-synchronous replication, creating a user for replication and granting the necessary permissions, and configuring binary log parameters, you can ensure that the primary database can efficiently and reliably synchronize data to the slave database. This process provides a solid foundation for achieving high data availability and fault recovery, thereby ensuring business continuity and data consistency.

[0113] S5. Configure the database replication options on the selected public cloud platform;

[0114] In this example, the specific steps to configure the database replication option on the selected public cloud platform are as follows:

[0115] S6.1 Log in to the database instance's management interface;

[0116] S6.2 Edit the MySQL configuration file (usually my.cnf or my.ini), and add or modify the following parameters:

[0117] Set a unique identifier from the database (server-id=2);

[0118] Configure relay logs (relay-log=slave-relay-bin);

[0119] Configure the relay log index file (relay-log-index = slave-relay-bin.index);

[0120] Set the database to read-only mode (read-only=1);

[0121] S6.3 Save the configuration and restart the database instance for the changes to take effect.

[0122] Specifically, by logging into the database instance's management interface, editing the MySQL configuration file (usually my.cnf or my.ini), saving the configuration, and restarting the database instance to make the changes take effect, you can ensure that the slave database can correctly connect to the master database and begin synchronizing data. This process provides a solid foundation for achieving high availability and fault recovery, thereby ensuring business continuity and data consistency.

[0123] S6. Establish master-slave database relationship;

[0124] In this example, the specific steps to establish a master-slave database relationship are as follows:

[0125] S7.1 Use SQL commands to view the status of the main database and obtain the binary log file name and location;

[0126] S7.2 Configuring the master-slave relationship in the database;

[0127] In this example, we configure a master-slave relationship for the database:

[0128] S7.21. Log in to the database instance through the management interface or command-line tool;

[0129] S7.22. Confirm the connection information for the main database;

[0130] S7.23. Use SQL commands to configure the connection information, binary log file name, and location of the master database.

[0131] S7.3. Use SQL commands to start a replication thread from the database;

[0132] S7.4 Use SQL commands to check the replication status from the database to ensure that the replication thread is running and there is no delay.

[0133] Specifically, by using SQL commands to view the status of the master database and obtain the binary log file name and location, configuring the master-slave relationship of the slave database, starting the replication thread of the slave database, and checking the replication status of the slave database, it can be ensured that the data in the master database can be efficiently and reliably synchronized to the slave database. This process provides a solid foundation for achieving high availability and fault recovery of data, thereby ensuring business continuity and data consistency.

[0134] S7. Test the master-slave database replication function.

[0135] In this example, the specific steps for testing the master-slave database replication function are as follows:

[0136] S8.1. Insert a test record in the management console of the primary database instance.

[0137] S8.2. In the database instance's management console, query the data that was just inserted.

[0138] S8.3 Check the replication latency between the master and slave databases.

[0139] In this example, the specific steps to check the replication latency between the master and slave databases are as follows:

[0140] S8.31. Log in to the database instance using the SQL command-line tool;

[0141] S8.32. In the command-line interface of the database instance, use SQL commands to check the replication status of the database.

[0142] S8.33. Verify the output results to determine the replication delay.

[0143] Specifically, the implementation process for checking replication latency between master and slave databases is as follows:

[0144] Log in to the management console of the database instance:

[0145] Open the cloud platform's management console and locate the database instance.

[0146] Log in to the database instance through the management interface or command-line tool. For example, when logging in using the MySQL command-line tool, you need to enter the database's IP address, username, and password.

[0147] Use SQL commands to check the replication status from the database:

[0148] From the command-line interface of the database instance, enter the following command:

[0149] SHOW SLAVE STATUS\G

[0150] This command will display replication status information from the database.

[0151] Pay attention to the replication delay field:

[0152] In the output, look for the following fields:

[0153] Slave_IORunning: Should be Yes, indicating that the IO thread is running.

[0154] Slave_SQL_Running: Should be Yes, indicating that the SQL thread is running.

[0155] Seconds_Behind-Master: Displays the number of seconds the slave database lags behind the master database. Ideally, this value should be close to 0, indicating almost no latency.

[0156] Explaining replication delay:

[0157] If the value of Seconds_Behind_Master is 0:

[0158] This indicates that the database is synchronizing well with the master database, with no delay.

[0159] If the value of Seconds_Behind_Master is greater than 0:

[0160] This indicates the number of seconds the slave database lags behind the master database. A larger value indicates a more severe delay.

[0161] If the value of Seconds_Behind_Master is NULL:

[0162] This indicates that the database replication thread encountered a problem and requires further investigation and resolution.

[0163] By inserting test data into the master database instance and then querying that data in the slave database instance, and by checking the replication latency between the master and slave databases, it can be ensured that the data in the master database can be synchronized to the slave database in a timely and accurate manner. This process not only verifies the correctness of the master-slave replication configuration, but also provides a reliable guarantee for achieving high availability and fault recovery of data, thereby ensuring business continuity and data consistency.

[0164] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely preferred examples and are not intended to limit the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention.

Claims

1. A database availability and mutual backup method based on public cloud, characterized by: Includes the following steps: S1. Select a public cloud platform based on business needs; S2. Create a primary database instance on the selected public cloud platform; S3. Create a database instance on the selected public cloud platform; S4. Configure the replication options for the primary database on the public cloud platform; S5. Configure the database replication options on the selected public cloud platform; S6. Establish a master-slave database relationship; S7. Test the master-slave database replication function.

2. The database availability and mutual backup method based on public cloud as described in claim 1, characterized in that: In S1, the specific steps for selecting a public cloud platform based on business needs are as follows: S2.1 Analyze business requirements; These business requirements include data volume, concurrent requests, security requirements, and budget. S2.2 Compare the characteristics of different public cloud platforms; Among them, public cloud platforms include Alibaba Cloud, Tencent Cloud, and Huawei Cloud; S2.3, Evaluate the service level agreement, technical support, and pricing of public cloud platforms; S2.4 Select a public cloud platform.

3. The database availability and mutual backup method based on public cloud as described in claim 1, characterized in that: In step S2, the specific steps for creating a primary database instance on the selected public cloud platform are as follows: S3.1 Log in to the management console of the selected cloud service platform; S3.2 Select the database type MySQL; S3.3 Select instance specifications; The instance specifications include the number of CPU cores, memory size, and storage space. S3.4 Configure network settings, select Virtual Private Cloud and Subnet; S3.

5. Configure security group rules to allow specific IP addresses and CIDR blocks to access the database; S3.

6. Create the primary database instance.

4. The database availability and mutual backup method based on public cloud as described in claim 1, characterized in that: In step S3, the specific steps for creating a database instance on the selected public cloud platform are as follows: S4.1 Log in to the management console of the selected cloud service platform; S4.2 Select the same database type as the primary database; S4.3 Select the same instance specification as the primary database; S4.4 Configure network settings, select the same VPC as the main database and a different subnet; S4.5 Configure security group rules to allow the master database IP address to access the slave database; S4.

6. Create a database instance on the selected public cloud platform.

5. The database availability and mutual backup method based on public cloud as described in claim 1, characterized in that: In step S4, the specific steps for configuring the replication options of the primary database on the public cloud platform are as follows: S5.1 Log in to the management interface of the primary database instance; S5.2 Enable database replication function and set the replication mode to semi-synchronous replication; S5.3 Create a user for copying and grant the necessary permissions for copying; S5.4 Configure binary log related parameters; S5.5 Save the configuration and restart the database instance for the changes to take effect.

6. The database availability and mutual backup method based on public cloud as described in claim 1, characterized in that: In step S5, the specific steps for configuring the database replication option on the selected public cloud platform are as follows: S6.1 Log in to the database instance's management interface; S6.2 Edit the MySQL configuration file; S6.3 Save the configuration and restart the database instance for the changes to take effect.

7. The database availability and mutual backup method based on public cloud as described in claim 1, characterized in that: In step S6, the specific steps for establishing the master-slave database relationship are as follows: S7.1 Use SQL commands to view the status of the main database and obtain the binary log file name and location; S7.2 Configuring the master-slave relationship in the database; S7.

3. Use SQL commands to start a replication thread from the database; S7.4 Use SQL commands to check the replication status from the database to ensure that the replication thread is running and there is no delay.

8. The database availability and mutual backup method based on public cloud as described in claim 7, characterized in that: In S7.2, the master-slave relationship of the database is configured: S7.

21. Log in to the database instance through the management interface or command-line tool; S7.

22. Confirm the connection information for the main database; S7.

23. Use SQL commands to configure the connection information, binary log file name, and location of the master database.

9. The database availability and mutual backup method based on public cloud as described in claim 1, characterized in that: In S7, the specific steps for testing the master-slave database replication function are as follows: S8.

1. Insert a test record in the management console of the primary database instance. S8.

2. In the database instance's management console, query the data that was just inserted. S8.3 Check the replication latency between the master and slave databases.

10. The database availability and mutual backup method based on public cloud as described in claim 9, characterized in that: In S8.3, the specific steps for checking the replication delay between the master and slave databases are as follows: S8.

31. Log in to the database instance using the SQL command-line tool; S8.

32. In the command-line interface of the database instance, use SQL commands to check the replication status of the database. S8.

33. Verify the output results to determine the replication delay.

Citation Information

Patent Citations

  • Method and device for extending database and database system

    CN103412860A

  • Method and device for carrying out data migration on database management platform

    CN104252502A

  • Database available mutual backup method achieved based on public cloud

    CN108200162A

  • Automatic backup method for MySQL database based on Ansible

    CN110795420A

  • Instance creation method and device, electronic equipment and readable storage medium

    CN115878587A