Data synchronization methods, systems, devices, equipment, and storage media

By monitoring the status of the dedicated network and updating the configuration file through the configuration center, the data synchronization problem caused by the failure of the dedicated network between cloud servers was resolved, and data consistency and service availability were achieved during the failure.

CN119561954BActive Publication Date: 2025-11-14GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411753022.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-11-14
Estimated Expiration
2044-12-02

AI Technical Summary

Technical Problem

When the dedicated network between two cloud servers fails, the databases cannot synchronize data, leading to data inconsistency and service unavailability.

Method used

By monitoring the leased network status through the configuration center, updating the configuration file to instruct the read/write server, ensuring that data operation requests are properly allocated in the event of a network failure, and synchronizing incremental data when the network recovers.

Benefits of technology

Maintaining data consistency during leased network outages ensures the availability of database services and the continuity of data synchronization, avoiding data inconsistency issues caused by network failures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119561954B_ABST
    Figure CN119561954B_ABST
Patent Text Reader

Abstract

This application relates to a data synchronization method, system, apparatus, device, and storage medium. The method includes: a first server receiving a data operation request and reading a configuration file from a configuration center; when the configuration file is a network failure configuration file, identifying the operation type corresponding to the data operation request, executing a read operation type data operation request on the first server, and executing a write operation type data operation request on a read-write server; the network failure configuration file indicates a failure in the leased network between the first server and the second server; the read-write server is either the first server or the second server; when the configuration file is updated from a network failure configuration file to a normal network configuration file, executing the data operation request on the first server and performing data synchronization between the first server and the second server. This application aggregates incremental data during the leased network failure period on the read-write server, and synchronizes this incremental data after the leased network returns to normal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a data synchronization method, system, apparatus, device, and storage medium. Background Technology

[0002] A dual-cloud multi-master database consists of two database services running on two separate cloud servers, forming a database cluster. For example... Figure 1 The diagram illustrates the data synchronization architecture of an existing dual-cloud multi-master database cluster. The cluster includes Cloud A (a cloud server) and Cloud B. Each cloud server runs a database service. Users access these services and perform database-related operations via the Domain Name System (DNS). These operations can be performed on either database. Automatic bidirectional data synchronization (replication) occurs between the two databases. One purpose of setting up dual-cloud servers is to improve service availability. For example, if one database service experiences a network outage, the database service in the other region can still provide services. A multi-master database means that each node in the database is a master node, and they are equal, all capable of providing database read and write operations. Data consistency is ensured through data replication between master nodes. Multi-master databases are designed to increase the concurrency of database operations, allowing the database service to serve more users simultaneously.

[0003] Currently, the two databases are synchronized via a dedicated network between the two cloud servers. However, if this dedicated network fails, the inability to synchronize data between the two databases will prevent data synchronization, leading to inconsistencies and potentially causing database service unavailability. Summary of the Invention

[0004] This application provides a data synchronization method, system, apparatus, device, and storage medium to solve the problem that when the leased network between two cloud servers fails, the two databases cannot be synchronized due to the unavailability of the leased network.

[0005] To address the aforementioned technical problems, the technical solution of this application is provided through the following embodiments:

[0006] This application provides a data synchronization method applied to a configuration center, comprising: monitoring a dedicated network for data synchronization between two servers; updating the current configuration file to a network failure configuration file when a failure is detected in the dedicated network; wherein the network failure configuration file indicates that one of the two servers is a read-write server; and updating the current configuration file to a network normal configuration file when the dedicated network is detected to be restored to normal; wherein the network normal configuration file indicates that both servers are read-write servers.

[0007] The monitoring of the dedicated network used for data synchronization between the two servers includes: monitoring the dedicated network used for data synchronization between the two servers through a preset monitoring service; the method further includes: receiving a configuration file corresponding to the network status of the dedicated network pushed by the monitoring service; wherein, when the monitoring service detects a fault in the dedicated network, it pushes a network fault configuration file; when the monitoring service detects that the dedicated network has returned to normal, it pushes a network normal configuration file.

[0008] Specifically, when a fault is detected in the dedicated line network, updating the current configuration file to a network fault configuration file includes: receiving a network fault configuration file pushed by the monitoring center when the monitoring center detects a fault in the dedicated line network, and using the network fault configuration file to overwrite the current configuration file; when the dedicated line network is detected to have returned to normal, updating the current configuration file to a network normal configuration file includes: receiving a network normal configuration file pushed by the monitoring center when the monitoring center detects that the dedicated line network has returned to normal, and using the network normal configuration file to overwrite the network fault configuration file that is currently the configuration file.

[0009] This application also provides a data synchronization method applied to a first server, comprising: receiving a data operation request and reading a configuration file from a preset configuration center; wherein the configuration file is used to instruct a read / write server; if the configuration file is a network failure configuration file, identifying the operation type corresponding to the data operation request, executing the data operation request of the read operation type on the first server, and executing the data operation request of the write operation type on the read / write server; wherein the read / write server is the first server or a preset second server; if the configuration file is updated from a network failure configuration file to a network normal configuration file, executing the data operation request on the first server, and performing data synchronization between the first server and the second server through a dedicated network between the first server and the second server.

[0010] The receiving of data operation requests includes: receiving a data operation request from the Domain Name System; or receiving a data operation request forwarded by the second server.

[0011] The step of executing the data operation request of the write operation type on the read-write server includes: determining whether the first server is the read-write server according to the network fault configuration file; if the first server is the read-write server, executing the data operation request of the write operation type on the first server; if the first server is not the read-write server, sending the data operation request of the write operation type to the second server through the public network, so that the second server executes the data operation request of the write operation type.

[0012] The data synchronization between the first server and the second server includes: when the first server is the read-write server, recording a first update time and a second update time during the process of reading the configuration file from the configuration center; wherein the first update time is the time when the configuration file is updated from a network-normal configuration file to a network-failure configuration file; and the second update time is the time when the configuration file is updated from a network-failure configuration file to a network-normal configuration file; copying the first incremental data generated in the first database between the first update time and the second update time, and sending the first incremental data to the second server through a dedicated network between the first server and the second server, so that the second server can use the first incremental data to update the data in the second database; when the first server is not the read-write server, receiving the second incremental data from the second server through the dedicated network between the first server and the second server, and using the second incremental data to update the data in the first database.

[0013] This application embodiment also provides a data synchronization system, the data synchronization system comprising: a configuration center and two servers respectively connected to the configuration center; the two servers perform data synchronization through a dedicated line network; the configuration center monitors the dedicated line network used for data synchronization between the two servers; when a failure is detected in the dedicated line network, the current configuration file is updated to a network failure configuration file; wherein, the network failure configuration file is used to indicate that one of the two servers is a read-write server; when the dedicated line network is detected to be restored to normal, the current configuration file is updated to a network normal configuration file; wherein, the network normal configuration file is used to indicate that both servers are read-write servers; the two servers respectively perform the following operations: receiving a data operation request and reading a configuration file from a preset configuration center; if the configuration file is a network failure configuration file, identifying the operation type corresponding to the data operation request, executing the data operation request of the read operation type on the current server, and executing the data operation request of the write operation type on the read-write server; if the configuration file is updated from the network failure configuration file to the network normal configuration file, executing the data operation request on the current server, and performing data synchronization between the current server and the other server through the dedicated line network between the current server and the other server.

[0014] This application embodiment also provides a data synchronization device, set in a configuration center, including: a network monitoring module for monitoring a dedicated network used for data synchronization between two servers; a first update module for updating the current configuration file to a network failure configuration file when a fault is detected in the dedicated network; wherein the network failure configuration file indicates that one of the two servers is a read-write server; and a second update module for updating the current configuration file to a network normal configuration file when the dedicated network is detected to have returned to normal; wherein the network normal configuration file indicates that both servers are read-write servers.

[0015] This application embodiment also provides a data synchronization device, set on a first server, including: a receiving module, used to receive data operation requests and read a configuration file from a preset configuration center; wherein the configuration file is used to instruct a read / write server; an identification and processing module, used to identify the operation type corresponding to the data operation request when the configuration file is a network failure configuration file, execute the data operation request of the read operation type on the first server, and execute the data operation request of the write operation type on the read / write server; wherein the read / write server is the first server or a preset second server; and a processing and synchronization module, used to execute the data operation request on the first server when the configuration file is updated from a network failure configuration file to a network normal configuration file, and to perform data synchronization between the first server and the second server through a dedicated network between the first server and the second server.

[0016] This application embodiment also provides a data synchronization device, including: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus, wherein the processor is configured to: execute a data synchronization program stored in the memory to implement the data synchronization method executed in a configuration center, or to implement the data synchronization method executed in a first server.

[0017] This application also provides a computer-readable storage medium storing computer-executable instructions, which are executed to implement the data synchronization method described above, either executed in a configuration center or executed on a first server.

[0018] Compared with the prior art, the technical solution provided in this application has the following advantages: The method provided in this application can receive a data operation request from a first server and read a configuration file from a preset configuration center; wherein, the configuration file is used to instruct a read / write server; when the configuration file is a network failure configuration file, the operation type corresponding to the data operation request is identified, the data operation request of the read operation type is executed on the first server, and the data operation request of the write operation type is executed on the read / write server; wherein, the configuration file being a network failure configuration file indicates that the leased network between the first server and the second server has failed; the read / write server is the first server or a preset second server; when the configuration file is updated from a network failure configuration file to a network normal configuration file, the data operation request is executed on the first server, and data synchronization is performed between the first server and the second server. In this embodiment, while receiving a data operation request, the system reads the configuration file in the configuration center. When the configuration file is a network failure configuration file, the system first determines the read / write server specified in the configuration file. Read operations are performed locally, and write operations are performed on the read / write server. The incremental data generated by write operations during the dedicated network failure is collected on the read / write server. When the configuration file is a network normal configuration file, that is, after the dedicated network is restored to normal, read / write operations are performed locally, and the incremental data generated by write operations during the dedicated network failure is synchronized. Attached Figure Description

[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0020] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0022] Figure 1 This is a schematic diagram of the data synchronization architecture of an existing dual-cloud multi-master database cluster.

[0023] Figure 2 This is a structural diagram of a data synchronization system according to an embodiment of this application;

[0024] Figure 3 This is a flowchart of a data synchronization method performed in a configuration center according to an embodiment of this application;

[0025] Figure 4 This is a detailed structural diagram of a data synchronization system according to an embodiment of this application;

[0026] Figure 5 This is a flowchart of a data synchronization method executed on a first server according to an embodiment of this application;

[0027] Figure 6 This is a structural diagram of a data synchronization device installed in a configuration center according to an embodiment of this application;

[0028] Figure 7 This is a structural diagram of a data synchronization device installed on a first server according to an embodiment of this application;

[0029] Figure 8 This is a structural diagram of a data synchronization device according to an embodiment of this application. Detailed Implementation

[0030] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0031] The following disclosure provides numerous different embodiments or examples for implementing various structures of this application. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of this application. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.

[0032] This application provides a data synchronization system. This data synchronization system can be applied in a dual-cloud, multi-master database cluster.

[0033] like Figure 2 The diagram shown is a structural diagram of a data synchronization system according to an embodiment of this application.

[0034] The data synchronization system includes a configuration center and two servers connected to the configuration center. The two servers synchronize data via a dedicated network. Each server runs a database service. The first server runs a first database, and the second server runs a second database. The first server can be either the first or the second server.

[0035] The configuration center monitors the dedicated network used for data synchronization between the two servers; when a failure is detected in the dedicated network, the current configuration file is updated to the network failure configuration file; wherein, the network failure configuration file is used to indicate that one of the two servers is a read-write server; when the dedicated network is detected to be back to normal, the current configuration file is updated to the network normal configuration file; wherein, the network normal configuration file is used to indicate that both servers are read-write servers.

[0036] Furthermore, the configuration center can be a Zookeeper configuration center. The Zookeeper configuration center manages configuration files. These configuration files specify the read / write servers among the two servers. There must be at least one read / write server. A read / write server can perform both read and write operations on the database running on it, while a server not designated as a read / write server can only perform read operations on the database running on it.

[0037] Furthermore, a pre-defined monitoring service can monitor the dedicated network used for data synchronization between the two servers to determine if the dedicated network is experiencing a failure. Specifically, if the monitoring service detects a failure, it can push a network failure configuration file to the configuration center; conversely, if the dedicated network recovers, it can push a normal network configuration file to the configuration center. The configuration center then updates its current configuration file with the one pushed by the monitoring service, allowing the database service on the server to read the updated configuration file from the configuration center.

[0038] The two servers respectively perform the following operations: receive data operation requests and read configuration files from a preset configuration center; if the configuration file is a network failure configuration file, identify the operation type corresponding to the data operation request, execute the data operation request of the read operation type on the current server, and execute the data operation request of the write operation type on the read-write server; if the configuration file is updated from a network failure configuration file to a network normal configuration file, execute the data operation request on the current server, and perform data synchronization between the current server and the other server through the dedicated network between the first server and the second server.

[0039] Furthermore, the database service in the first server receives database operation requests. These database operation requests originate from the Domain Name System (DNS), or they may be forwarded by the second server.

[0040] Based on the aforementioned data synchronization system, this application provides a data synchronization method. The following will describe in detail the operations required to be performed by each device in the data synchronization system, in conjunction with the data synchronization method.

[0041] For the configuration center in a data synchronization system, embodiments of this application provide a data synchronization method executed in the configuration center. For example... Figure 3 The diagram shown is a flowchart of a data synchronization method performed in a configuration center according to an embodiment of this application.

[0042] Step S310: Monitor the dedicated network used for data synchronization between the two servers.

[0043] A leased network is used to connect two servers in a dual-cloud, multi-master database cluster. This leased network can be a wired or wireless network.

[0044] In this embodiment of the application, the leased network used for data synchronization between two servers can be monitored in real time in order to determine whether the leased network is malfunctioning.

[0045] In this embodiment, a pre-defined monitoring service can be used to monitor the dedicated network used for data synchronization between two servers. This monitoring service can be installed in a configuration center or on a separate device independent of the configuration center. For example: Figure 4 The diagram shown is a detailed structural diagram of a data synchronization system according to an embodiment of this application.

[0046] Step S320: Determine whether a fault has been detected in the leased network; if yes, proceed to step S330; if no, proceed to step S340.

[0047] A leased network failure means that two servers are unable to communicate via the leased network. For example, the leased network connection is lost.

[0048] Step S330: When a fault is detected in the leased network, the current configuration file is updated to a network fault configuration file; wherein, the network fault configuration file is used to indicate that one of the two servers is a read-write server.

[0049] A read-write server is a server that can perform read operations on the database running on it, and also perform write operations on the database.

[0050] The network fault configuration file is used to instruct the two servers how to perform database operations when a fault occurs in the leased network. The network fault configuration file includes: one of the two servers acts as a read / write server; the other server forwards data operation requests corresponding to write operations to the read / write server for processing; and each server processes the received data operation requests corresponding to read operations.

[0051] Furthermore, one server is pre-selected as a read-write server and the other as a read-only server, and a network fault configuration file is generated accordingly. A read-only server is one that performs only read operations on the database running on it. When selecting the read-write server, it can be randomly chosen from the two servers.

[0052] Furthermore, the network fault configuration file can specify only the server acting as a read-write server, while another server defaults to being a read-only server. Alternatively, the network fault configuration file can specify both the server acting as a read-write server and the server acting as a read-only server.

[0053] In this embodiment, when a fault is detected in the leased network, the current configuration file in the configuration center may be the network-normal configuration file. The network-normal configuration file is used to indicate how each of the two servers processes received data operation requests when the leased network is functioning normally. If the network-normal configuration file is still used to perform database operations when the leased network fails, the two servers will be unable to synchronize data. Therefore, in this embodiment, the network-normal configuration file is replaced with the network-failure configuration file when the leased network fails.

[0054] Step S340: When the leased network is detected to have returned to normal, update the current configuration file to the network normal configuration file; wherein, the network normal configuration file is used to indicate that both servers are read-write servers.

[0055] The leased network has been restored to normal, meaning that the two servers, which were previously unable to synchronize data via the leased network, can now synchronize data via the leased network.

[0056] In this embodiment, the monitoring service can push a configuration file corresponding to the network state of the leased network when it detects a change in the network state of the leased network. The configuration center receives the configuration file corresponding to the network state of the leased network pushed by the monitoring service; wherein, when the monitoring service detects a fault in the leased network, it pushes a network fault configuration file; and when the monitoring service detects that the leased network has returned to normal, it pushes a network normal configuration file.

[0057] Upon receiving a network fault configuration file from the monitoring service, the current configuration file is updated to the network fault configuration file. Upon receiving a network normal configuration file from the monitoring service, the current configuration file is updated to the network normal configuration file. In other words, if the monitoring center detects a fault in the dedicated network, it receives the network fault configuration file pushed by the monitoring center and uses it to overwrite the current configuration file; if the monitoring center detects that the dedicated network has returned to normal, it receives the network normal configuration file pushed by the monitoring center and uses it to overwrite the network fault configuration file that is currently the configuration file.

[0058] In this embodiment, the monitoring service can also issue a network status message corresponding to the current network status of the leased line network when it detects a change in the network status. After receiving the network status message from the monitoring service, the configuration center retrieves the corresponding configuration file from a set of preset configuration files based on the network status message. Specifically, when the network status message indicates a fault in the leased line network, a network fault configuration file is retrieved; when the network status message indicates that the leased line network has returned to normal, a network normal configuration file is retrieved.

[0059] In this embodiment, a dedicated network used for data synchronization between two servers is monitored. When a failure is detected in the dedicated network, the current configuration file is updated to a network failure configuration file, which indicates that one of the two servers is a read-write server. When the dedicated network returns to normal, the current configuration file is updated to a normal network configuration file, which indicates that both servers are read-write servers. This embodiment monitors the dedicated network between the two servers in real time for failures. In the event of a failure, the configuration file is updated to the network failure configuration file. After reading the network failure configuration file, both servers can perform read operations locally and write operations on the designated read-write server. All write operations during the dedicated network failure are performed on one server, ensuring that incremental data during the failure period is stored on a single server. After the dedicated network failure is resolved, the incremental data during the failure period can be automatically synchronized to the other server, ensuring data consistency between the two servers.

[0060] For servers in a data synchronization system, this application provides a data synchronization method executed on a first server. The first server is either one of two servers, and the other server is a second server. That is, each of the two servers executes the data synchronization method of this embodiment.

[0061] In this embodiment, a Software Development Kit (SDK) can be installed on the first server, enabling the SDK to execute data synchronization methods on the first server. Furthermore, third-party tools can be integrated into the SDK to achieve read / write operation separation on the first server. These third-party tools can be Apache ShardingSphere-JDBC, which is a JAR file.

[0062] like Figure 5 The diagram shown is a flowchart of a data synchronization method executed on a first server according to an embodiment of this application.

[0063] Step S510: Receive a data operation request and read a configuration file from a preset configuration center; wherein the configuration file is used to instruct the read / write server.

[0064] Data manipulation requests are used to request the execution of database operations on the database.

[0065] Database operations include, but are not limited to: create, delete, update, and query operations.

[0066] Database operations are categorized into two types: read operations and write operations. Specifically, query operations correspond to read operations, while insert, delete, and update operations correspond to write operations.

[0067] In this embodiment of the application, a data operation request is received from the Domain Name System; or, a data operation request is received forwarded by the second server.

[0068] Furthermore, the client sends a data operation request, which reaches the Domain Name System (DNS). The DNS distributes the data operation request to one of the two servers. If the server receiving the data operation request is a read-write server, it processes the request directly. If the server receiving the request is a read-only server, it forwards the request to the other server, which is a read-write server.

[0069] Step S520: If the configuration file is a network fault configuration file, identify the operation type corresponding to the data operation request, execute the data operation request of the read operation type on the first server, and execute the data operation request of the write operation type on the read-write server; wherein, the read-write server is the first server or a preset second server.

[0070] Based on the network fault configuration file, determine whether the first server is the read / write server; if the first server is the read / write server, execute the data operation request of the write operation type on the first server; if the first server is not the read / write server, send the data operation request of the write operation type to the second server through the public network, so that the second server executes the data operation request of the write operation type.

[0071] Public networks and leased networks are different networks. For example, a public network is the Internet.

[0072] In step S530, if the configuration file is updated from a network failure configuration file to a network normal configuration file, the data operation request is executed on the first server, and data synchronization is performed between the first server and the second server through the dedicated network between the first server and the second server.

[0073] The first server runs the first database, and the second server runs the second database.

[0074] In this embodiment, after the configuration file is updated from a network failure configuration file to a normal network configuration file, the incremental data generated during the leased network failure is first synchronized between the first server and the second server. Then, the first server and the second server respectively execute the received data operation requests and perform normal data synchronization. In other words, after the configuration file is updated from a network failure configuration file to a normal network configuration file, data synchronization is first performed between the first server and the second server for the incremental data generated during the leased network failure, followed by normal database services and normal data synchronization operations, i.e., executing the data operation requests received by the first server and performing data synchronization between the first server and the second server in response to these data operation requests.

[0075] Furthermore, when the first server is the read / write server, during the process of reading the configuration file from the configuration center, a first update time and a second update time are recorded; wherein, the first update time is the time when the configuration file is updated from a network-normal configuration file to a network-failure configuration file; the second update time is the time when the configuration file is updated from a network-failure configuration file to a network-normal configuration file; the first incremental data generated in the first database between the first update time and the second update time is copied, and the first incremental data is sent to the second server through a dedicated network between the first server and the second server, so that the second server can use the first incremental data to update the data in the second database.

[0076] Furthermore, if the first server is not the read / write server, the second incremental data is received from the second server via the dedicated network between the first and second servers, and the data in the first database is updated using the second incremental data. If the first server is not the read / write server, then the second server is the read / write server; that is, the second server handles all write operations during the dedicated network failure. In this case, the second server can copy the incremental data generated by the second database during the dedicated network failure and synchronize it to the first server via the restored dedicated network, ensuring data consistency between the first database in the first server and the second database in the second server. The second incremental data is the incremental data generated by the second database between the first update time and the second update time.

[0077] In this embodiment, a first server receives a data operation request and reads a configuration file from a preset configuration center; wherein the configuration file is used to instruct a read / write server; when the configuration file is a network failure configuration file, the operation type corresponding to the data operation request is identified, the data operation request of the read operation type is executed on the first server, and the data operation request of the write operation type is executed on the read / write server; wherein the configuration file being a network failure configuration file indicates that the leased network between the first server and the second server has failed; the read / write server is the first server or a preset second server; when the configuration file is updated from a network failure configuration file to a network normal configuration file, the data operation request is executed on the first server, and data synchronization is performed between the first server and the second server. In this embodiment, while receiving a data operation request, the system reads the configuration file in the configuration center. When the configuration file is a network failure configuration file, the system first determines the read / write server specified in the configuration file. Read operations are performed locally, and write operations are performed on the read / write server. Incremental data generated by write operations during the dedicated network failure are collected on the read / write server. When the configuration file is a network normal configuration file, that is, after the dedicated network is restored to normal, read / write operations are performed locally, and incremental data generated by write operations during the dedicated network failure are synchronized.

[0078] Furthermore, in this embodiment, if the local end is a read / write server, it synchronizes the incremental data generated by the write operation during the leased network failure to another server; if the other server is a read / write server, it receives the incremental data generated by the write operation during the leased network failure synchronized from the other server.

[0079] Furthermore, in this embodiment of the application, in the event of a failure in the dedicated network used for data synchronization between the dual-cloud multi-master databases, the dual-cloud multi-master databases can still provide database services and perform database read and write operations normally. By implementing a read-write separation method for the database of one of the servers, the problem of data inconsistency between the databases running on the two servers can be avoided, thereby improving service availability.

[0080] This application also provides a data synchronization device set up in a configuration center. For example... Figure 6 The diagram shown is a structural diagram of a data synchronization device installed in a configuration center according to an embodiment of this application.

[0081] The data synchronization device set up in the configuration center includes:

[0082] The network monitoring module 610 is used to monitor the dedicated network used for data synchronization between two servers.

[0083] The first update module 620 is used to update the current configuration file to a network fault configuration file when a fault is detected in the leased network; wherein the network fault configuration file is used to indicate that one of the two servers is a read-write server.

[0084] The second update module 630 is used to update the current configuration file to a network normal configuration file when the leased network is detected to have returned to normal; wherein, the network normal configuration file is used to indicate that both servers are read-write servers.

[0085] The functions of the apparatus described in this application embodiment have been described in the above method embodiments. Therefore, for any parts not detailed in the description of this embodiment, please refer to the relevant descriptions in the foregoing embodiments, which will not be repeated here.

[0086] This application also provides a data synchronization device configured on a first server. For example... Figure 7 The diagram shown is a structural diagram of a data synchronization device installed on a first server according to an embodiment of this application.

[0087] The data synchronization device set up on the first server includes:

[0088] The receiving module 710 is used to receive data operation requests and read configuration files from a preset configuration center; wherein the configuration files are used to instruct the read / write server.

[0089] The identification and processing module 720 is used to identify the operation type corresponding to the data operation request when the configuration file is a network fault configuration file, execute the data operation request of the read operation type on the first server, and execute the data operation request of the write operation type on the read-write server; wherein the read-write server is the first server or a preset second server.

[0090] The processing and synchronization module 730 is used to execute the data operation request on the first server when the configuration file is updated from a network failure configuration file to a network normal configuration file, and to perform data synchronization between the first server and the second server through a dedicated network between the first server and the second server.

[0091] The functions of the apparatus described in this application embodiment have been described in the above method embodiments. Therefore, for any parts not detailed in the description of this embodiment, please refer to the relevant descriptions in the foregoing embodiments, which will not be repeated here.

[0092] This application also provides a data synchronization device, such as... Figure 8 The diagram shown is a structural diagram of a data synchronization device according to an embodiment of this application.

[0093] The data synchronization device includes a processor 810, a communication interface 820, a memory 830, and a communication bus 840. The processor 810, communication interface 820, and memory 830 communicate with each other via the communication bus 840.

[0094] The memory 830 is used to store computer programs.

[0095] In one embodiment of this application, when the processor 810 executes a program stored in the memory 830, it implements any of the aforementioned data synchronization methods executed in the configuration center, including: monitoring a leased network used for data synchronization between two servers; when a fault is detected in the leased network, updating the current configuration file to a network fault configuration file; wherein the network fault configuration file is used to indicate that one of the two servers is a read-write server; and when the leased network is detected to be restored to normal, updating the current configuration file to a network normal configuration file; wherein the network normal configuration file is used to indicate that both servers are read-write servers.

[0096] The monitoring of the dedicated network used for data synchronization between the two servers includes: monitoring the dedicated network used for data synchronization between the two servers through a preset monitoring service; the method further includes: receiving a configuration file corresponding to the network status of the dedicated network pushed by the monitoring service; wherein, when the monitoring service detects a fault in the dedicated network, it pushes a network fault configuration file; when the monitoring service detects that the dedicated network has returned to normal, it pushes a network normal configuration file.

[0097] Specifically, when a fault is detected in the dedicated line network, updating the current configuration file to a network fault configuration file includes: receiving a network fault configuration file pushed by the monitoring center when the monitoring center detects a fault in the dedicated line network, and using the network fault configuration file to overwrite the current configuration file; when the dedicated line network is detected to have returned to normal, updating the current configuration file to a network normal configuration file includes: receiving a network normal configuration file pushed by the monitoring center when the monitoring center detects that the dedicated line network has returned to normal, and using the network normal configuration file to overwrite the network fault configuration file that is currently the configuration file.

[0098] In one embodiment of this application, when the processor 810 executes a program stored in the memory 830, it implements any of the aforementioned data synchronization methods executed on the first server, including: receiving a data operation request and reading a configuration file from a preset configuration center; wherein the configuration file is used to instruct a read / write server; if the configuration file is a network failure configuration file, identifying the operation type corresponding to the data operation request, executing the data operation request of the read operation type on the first server, and executing the data operation request of the write operation type on the read / write server; wherein the read / write server is the first server or a preset second server; if the configuration file is updated from a network failure configuration file to a network normal configuration file, executing the data operation request on the first server, and performing data synchronization between the first server and the second server through a dedicated network between the first server and the second server.

[0099] The receiving of data operation requests includes: receiving a data operation request from the Domain Name System; or receiving a data operation request forwarded by the second server.

[0100] The step of executing the data operation request of the write operation type on the read-write server includes: determining whether the first server is the read-write server according to the network fault configuration file; if the first server is the read-write server, executing the data operation request of the write operation type on the first server; if the first server is not the read-write server, sending the data operation request of the write operation type to the second server through the public network, so that the second server executes the data operation request of the write operation type.

[0101] The data synchronization between the first server and the second server includes: when the first server is the read-write server, recording a first update time and a second update time during the process of reading the configuration file from the configuration center; wherein the first update time is the time when the configuration file is updated from a network-normal configuration file to a network-failure configuration file; and the second update time is the time when the configuration file is updated from a network-failure configuration file to a network-normal configuration file; copying the first incremental data generated in the first database between the first update time and the second update time, and sending the first incremental data to the second server through a dedicated network between the first server and the second server, so that the second server can use the first incremental data to update the data in the second database; when the first server is not the read-write server, receiving the second incremental data from the second server through the dedicated network between the first server and the second server, and using the second incremental data to update the data in the first database.

[0102] This application also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the steps of the data synchronization method provided in the configuration center as described in any of the foregoing method embodiments, or implements the steps of the data synchronization method provided in the first server as described in any of the foregoing method embodiments. Since the data synchronization method has been described in detail above, any omissions or deficiencies in the description of this embodiment can be found in the relevant descriptions in the foregoing embodiments, and will not be repeated here.

[0103] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0104] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0105] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “described” as used herein may also include the plural forms. The terms “comprising,” “including,” “containing,” and “having” are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a particular order described or illustrated unless the order of performance is explicitly indicated. It should also be understood that additional or alternative steps may be used.

[0106] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A data synchronization method, characterized in that, Applied to the configuration center, including: Monitor the dedicated network used for data synchronization between the two servers; When a fault is detected in the leased network, the current configuration file is updated to a network fault configuration file; wherein, the network fault configuration file is used to indicate that one of the two servers is a read-write server; When the leased network is detected to have returned to normal, the current configuration file is updated to the network normal configuration file; wherein, the network normal configuration file is used to indicate that both servers are read-write servers, so as to perform data synchronization between the first server and the second server; the data synchronization between the first server and the second server includes: When the first server is the read / write server during a failure of the dedicated network, a first update time and a second update time are recorded during the process of reading the configuration file from the configuration center; wherein, the first update time is the time when the configuration file is updated from the network normal configuration file to the network failure configuration file; and the second update time is the time when the configuration file is updated from the network failure configuration file to the network normal configuration file. The first incremental data generated in the first database between the first update time and the second update time is copied, and the first incremental data is sent to the second server through a dedicated network between the first server and the second server so that the second server can use the first incremental data to update the data in the second database; If the first server is not the read / write server during a failure of the leased network, it receives second incremental data from the second server through the leased network between the first server and the second server, and updates the data in the first database using the second incremental data.

2. The method according to claim 1, characterized in that, The dedicated network used for data synchronization between the two monitoring servers includes: The dedicated network used for data synchronization between the two servers is monitored through a pre-set monitoring service. The method further includes: The monitoring service receives a configuration file corresponding to the network status of the leased network, pushed by the monitoring service; wherein, when the monitoring service detects a fault in the leased network, it pushes a network fault configuration file; and when the monitoring service detects that the leased network has returned to normal, it pushes a network normal configuration file.

3. The method according to claim 2, characterized in that, When a fault is detected in the leased network, the current configuration file is updated to the network fault configuration file, including: When the monitoring center detects a fault in the dedicated line network, it receives a network fault configuration file pushed by the monitoring center and uses the network fault configuration file to overwrite the current configuration file. When the leased network is detected to have returned to normal, the current configuration file is updated to the normal network configuration file, including: When the monitoring center detects that the dedicated line network has returned to normal, it receives the network normal configuration file pushed by the monitoring center and uses the network normal configuration file to overwrite the network fault configuration file that is the current configuration file.

4. A data synchronization method, characterized in that, Applied to the first server, including: The system receives data operation requests and reads configuration files from a preset configuration center; wherein the configuration files are used to instruct the read / write server. In the case that the configuration file is a network fault configuration file, the operation type corresponding to the data operation request is identified, the data operation request of the read operation type is executed on the first server, and the data operation request of the write operation type is executed on the read-write server; wherein, the read-write server is the first server or a preset second server; When the configuration file is updated from a network failure configuration file to a network normal configuration file, the data operation request is executed on the first server, and data synchronization is performed between the first server and the second server via a dedicated network between them; wherein, the data synchronization between the first server and the second server includes: When the first server is the read / write server during a failure of the dedicated network, a first update time and a second update time are recorded during the process of reading the configuration file from the configuration center; wherein, the first update time is the time when the configuration file is updated from the network normal configuration file to the network failure configuration file; and the second update time is the time when the configuration file is updated from the network failure configuration file to the network normal configuration file. The first incremental data generated in the first database between the first update time and the second update time is copied, and the first incremental data is sent to the second server through a dedicated network between the first server and the second server so that the second server can use the first incremental data to update the data in the second database; If the first server is not the read / write server during a failure of the leased network, it receives second incremental data from the second server through the leased network between the first server and the second server, and updates the data in the first database using the second incremental data.

5. The method according to claim 4, characterized in that, The data receiving operation request includes: Receive data operation requests from the Domain Name System; or, Receive data operation requests from the second server.

6. The method according to claim 4, characterized in that, The data operation request of the write operation type executed on the read-write server includes: Based on the network fault configuration file, determine whether the first server is the read / write server; If the first server is the read-write server, the data operation request of the write operation type is executed on the first server; If the first server is not the read / write server, the data operation request of the write operation type is sent to the second server through the public network, so that the second server executes the data operation request of the write operation type.

7. A data synchronization system, characterized in that, The data synchronization system includes: a configuration center and two servers respectively connected to the configuration center; the two servers synchronize data with each other via a dedicated network. The configuration center monitors the dedicated network used for data synchronization between the two servers; when a failure is detected in the dedicated network, the current configuration file is updated to the network failure configuration file; wherein, the network failure configuration file is used to indicate that one of the two servers is a read-write server; when the dedicated network is detected to be back to normal, the current configuration file is updated to the network normal configuration file; wherein, the network normal configuration file is used to indicate that both servers are read-write servers. The two servers respectively perform the following operations: receiving data operation requests and reading configuration files from a preset configuration center; if the configuration file is a network failure configuration file, identifying the operation type corresponding to the data operation request, executing the data operation request of the read operation type on the current server, and executing the data operation request of the write operation type on the read-write server; if the configuration file is updated from a network failure configuration file to a network normal configuration file, executing the data operation request on the current server, and performing data synchronization between the current server and the other server through a dedicated network between the current server and the other server; the data synchronization between the current server and the other server includes: When the current server is the read / write server during a failure of the dedicated network, the current update time and another update time are recorded during the process of reading the configuration file from the configuration center; wherein, the current update time is the time when the configuration file is updated from the network normal configuration file to the network failure configuration file; and the other update time is the time when the configuration file is updated from the network failure configuration file to the network normal configuration file. The current incremental data generated between the current update time and the other update time is copied from the current database, and the current incremental data is sent to the other server via a dedicated network between the current server and the other server so that the other server can use the current incremental data to update the data in another database; If the current server is not the read / write server during a failure of the leased network, it receives additional incremental data from the other server through the leased network between the current server and the other server, and uses the additional incremental data to update the data in the current database.

8. A data synchronization device, characterized in that, Settings in the configuration center include: The network monitoring module is used to monitor the dedicated network used for data synchronization between the two servers; The first update module is used to update the current configuration file to a network fault configuration file when a fault is detected in the leased network; wherein, the network fault configuration file is used to indicate that one of the two servers is a read-write server; The second update module is used to update the current configuration file to a network-normal configuration file when the leased network is detected to have returned to normal. The network-normal configuration file indicates that both servers are read-write servers, enabling data synchronization between the first and second servers. Data synchronization between the first and second servers includes: when the first server is the read-write server during the leased network failure, recording a first update time and a second update time during the process of reading the configuration file from the configuration center; where the first update time is the time when the configuration file is updated from the network-normal configuration file to the network-failure configuration file; and the second update time is the time when the configuration file is updated from the network-failure configuration file to the network-normal configuration file; copying the first incremental data generated in the first database between the first and second update times, and sending the first incremental data to the second server through the leased network between the first and second servers, so that the second server can use the first incremental data to update the data in the second database; when the first server is not the read-write server during the leased network failure, receiving the second incremental data from the second server through the leased network between the first and second servers, and using the second incremental data to update the data in the first database.

9. A data synchronization device, characterized in that, The settings on the first server include: A receiving module is used to receive data operation requests and read configuration files from a preset configuration center; wherein the configuration files are used to instruct the read / write server. The identification and processing module is used to identify the operation type corresponding to the data operation request when the configuration file is a network fault configuration file, execute the data operation request of the read operation type on the first server, and execute the data operation request of the write operation type on the read-write server; wherein the read-write server is the first server or a preset second server; A processing and synchronization module is configured to, when the configuration file is updated from a network failure configuration file to a network normal configuration file, execute the data operation request on the first server and perform data synchronization between the first server and the second server via a dedicated network between the first server and the second server; wherein, the data synchronization between the first server and the second server includes: when the first server is the read / write server during the dedicated network failure, recording a first update time and a second update time during the process of reading the configuration file from the configuration center; wherein the first update time is the time when the configuration file is updated from a network normal configuration file to a network failure configuration file; and the second update time is the time when the configuration file is updated from a network failure configuration file to a network normal configuration file; copying the first incremental data generated in the first database between the first update time and the second update time, and sending the first incremental data to the second server via the dedicated network between the first server and the second server so that the second server can use the first incremental data to update the data in the second database; and when the first server is not the read / write server during the dedicated network failure, receiving the second incremental data from the second server via the dedicated network between the first server and the second server, and using the second incremental data to update the data in the first database.

10. A data synchronization device, characterized in that, include: At least one communication interface; At least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; At least one memory connected to the at least one bus, wherein the processor is configured to: execute a data synchronization program stored in the memory to implement the data synchronization method executed in the configuration center according to any one of claims 1-3, or to implement the data synchronization method executed in the first server according to any one of claims 4-6.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that are executed to implement the data synchronization method of any one of claims 1-3 executed in the configuration center, or to implement the data synchronization method of any one of claims 4-6 executed on the first server.

Citation Information

Patent Citations

  • Fault recovery method and monitoring node

    CN107026760A

  • Cluster file synchronization method, cluster file synchronization system, device and storage medium

    CN107908708A