Data disaster recovery method and system

By deploying different types of data centers in different geographical locations and using disaster recovery service modules and data synchronization mechanisms, the problem of insufficient disaster resilience in existing disaster recovery systems is solved, efficient and reliable data synchronization and system stability are achieved, and the risks of manual intervention and data loss are reduced.

CN120407280APending Publication Date: 2025-08-01TONGCHENG NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510364948.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-26
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

The existing disaster recovery system lacks disaster resistance when facing disasters, and data synchronization relies on manual operations, which poses a risk of system crash in data inconsistency and high concurrency scenarios.

Method used

Deploy different types of first and second data centers in different geographical locations, use the disaster recovery service module to monitor abnormalities in real time and automatically perform data source switching, and realize data synchronization through message queues and consumer clusters to ensure data consistency and high availability.

Benefits of technology

It improves the system's disaster resilience, reduces manual intervention, ensures data consistency and system stability, reduces the risk of simultaneous damage to dual data centers caused by the failure of the same hardware or software, and achieves efficient and reliable data synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120407280A_ABST
    Figure CN120407280A_ABST
Patent Text Reader

Abstract

The invention provides a data disaster recovery method and system, and relates to the technical field of computers.The method comprises the steps that a first data center and a second data center are deployed at different geographic positions respectively, and the first data center and the second data center are provided with different types of storage components respectively; when no disaster occurs in the first data center, the application service accesses the first data center through the disaster recovery service module, and the disaster recovery service module counts an abnormal number of accessing the first data center and synchronizes read-write operation data to the second data center; when a disaster occurs in the first data center, the disaster recovery service module automatically executes a data source switching operation; and during the recovery period of the first data center with the disaster, performing data synchronization through the disaster recovery service module until the data of the two data centers are consistent. By implementing the technical scheme provided by the invention, the effect of improving the anti-disaster capability is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technologies, and particularly to a data disaster recovery method and system. Background Art

[0002] Currently, any software system depends on a database system at the bottom layer for fast access to data. The software and the database system communicate through a network connection. There are many types of databases, which can be Sql and NoSql. When a disaster occurs to the underlying primary data source on which a system depends, such as an exception in the data source system or a network exception, generally, we will switch to the backup data source. Moreover, the primary and backup data sources have the same software and hardware, such as both being Mysql databases, both being message queues, etc. And within a period of time after the disaster, the backup data source is always used. Then, after the primary data source system recovers, the backup data is manually synchronized to the primary data source to complete disaster recovery through the two systems. It can be seen that the disaster recovery systems and methods in the related technologies have the problem of insufficient disaster resistance. Therefore, there is an urgent need for a disaster recovery method that can improve disaster resistance and achieve automated data synchronization to cope with the risk of system crashes in high-concurrency scenarios and ensure data consistency and high availability. Summary of the Invention

[0003] To solve the above technical problems, this application provides a data disaster recovery method and system.

[0004] In a first aspect, this application provides a data disaster recovery method, including: deploying a first data center and a second data center at different geographical locations, where the first data center is provided with a first storage component, and the second data center is provided with a second storage component of a different type from the first storage component; in the case that no disaster occurs in the first data center, the application service accesses the first data center through the disaster recovery service module, the disaster recovery service module counts the number of exceptions for accessing the first data center, and synchronizes the read and write operation data of the first data center to the second data center; when a disaster occurs in the first data center, the disaster recovery service module automatically performs a data source switching operation, where the data source switching operation is used to indicate switching the read and write operation data of the first data center to the second data center; during the recovery period of the first data center where the disaster has occurred, data synchronization is performed through the disaster recovery service module until the data in the two data centers is consistent.

[0005] By adopting the above technical solution, under normal circumstances, while the application service accesses the first data center, the disaster recovery service module real-time counts the number of exceptions and synchronizes the read and write operation data of the first data center to the second data center, ensuring data security and consistency; when a disaster occurs in the first data center, the disaster recovery service module can automatically detect and perform the data source switching operation, seamlessly transfer the service traffic to the second data center, reduce the system interruption time, and improve the high availability of the system; during the recovery period of the first data center, the disaster recovery service module is used to complete the data synchronization between the two data centers, further ensuring data integrity, reducing the manual intervention cost, and enhancing the stability and reliability of the entire system. Most existing disaster recovery systems have the same primary and backup data sources. Once the primary data source suffers a disaster due to hardware failures, software vulnerabilities, etc., the backup data source may also face the same risks. However, the method of this technical solution uses data centers with different types of storage components, which can effectively reduce such risks. By deploying the first data center and the second data center with different types of storage components in different geographical locations, the purpose of improving the disaster resistance ability of the system is achieved.

[0006] Optionally, the disaster recovery service module includes a data synchronizer. Data synchronization through the disaster recovery service module includes: the data synchronizer stores the data to be synchronized in the message queue, where the data in the message queue includes the first incremental data during the disaster period and the second incremental data generated during the disaster recovery period; the consumer cluster sequentially consumes the data to be synchronized in the message queue to achieve data synchronization, where the data synchronizer includes the message queue and the consumer cluster.

[0007] By adopting the above technical solution, the data to be synchronized is stored in the message queue, including the first incremental data during the disaster period and the second incremental data generated during the disaster recovery period, thereby ensuring that all incremental data is recorded and temporarily stored in an orderly manner, avoiding data loss or chaos; the consumer cluster sequentially consumes the data to be synchronized in the message queue, ensuring a high degree of consistency and reliability in the data synchronization process, and effectively preventing data conflicts or overwriting problems. This technical solution can achieve efficient and reliable data synchronization during the disaster recovery process.

[0008] Optionally, the above method further includes: judging whether the first data center and the second data center are consistent by whether there is data accumulation in the data synchronizer.

[0009] By adopting the above technical solution, using the data accumulation situation in the data synchronizer as the judgment basis, the data status of the two data centers can be monitored in real time, so as to accurately judge whether they are consistent. This technical means not only improves the reliability of the disaster recovery system, but also simplifies the process of data consistency detection, reduces the need for manual intervention, and further improves the automation level and operation and maintenance efficiency of the entire system. This technical solution can achieve efficient data consistency verification between the first data center and the second data center.

[0010] Optionally, the above method further includes: after a disaster occurs in the first data center, determining whether the data service of the first data center is normal through an anomaly statistic. Among them, the disaster recovery service module includes an anomaly statistic, and the anomaly statistic is used to count the number of anomalies accessing the first data center.

[0011] By adopting the above technical solution, the anomaly statistic can timely count the number of anomalies accessing the first data center, so as to quickly judge whether the data service is running normally; this mechanism improves the response speed and reliability of the system, ensures that measures can be taken quickly when a disaster occurs, and avoids service interruption caused by misjudgment; combined with the subsequent data source switching operation, this solution further improves the automation degree and stability of the entire disaster recovery system. By setting an anomaly statistic in the disaster recovery service module to automatically judge the data service status of the first data center after a disaster occurs, it solves the problem of inaccurate and untimely judgment of the main data source recovery status in the prior art, enabling the disaster recovery system to respond more intelligently and accurately to the disaster and recovery of the main data source.

[0012] Optionally, when a disaster occurs in the first data center, the disaster recovery service module automatically performs a data source switching operation, including: when the number of anomalies is greater than or equal to the first preset threshold, it is determined that a disaster has occurred in the first data center, and the data source switching operation is automatically triggered.

[0013] By adopting the above technical solution, when a disaster occurs in the first data center, through monitoring and judging the number of anomalies, the data source switching operation can be automatically triggered when the number of anomalies reaches or exceeds the first preset threshold. This mechanism effectively improves the disaster resistance of the system, reduces the time delay caused by manual intervention, and ensures the continuity and stability of the business. At the same time, this solution improves the accuracy and reliability of disaster recovery decision-making by quantifying the number of anomalies as the disaster determination criterion, thus ensuring the high availability of data.

[0014] Optionally, the first storage component is a MySQL cluster, and the second storage component is an ElasticSearch cluster.

[0015] By adopting the above technical solutions, by setting the storage components of the first data center as a MySQL cluster, the advantages of MySQL as a relational database in structured data management and transaction support are fully utilized, ensuring the stability and reliability of the primary data source; setting the storage components of the second data center as an ElasticSearch cluster, and leveraging the high-performance characteristics of ElasticSearch in unstructured data processing, full-text retrieval, etc., the functional scalability and query efficiency of the backup data source are improved. Different types of storage components reduce the risks brought by the same technical architecture. Even if the MySQL cluster fails (such as database software crashes, hardware damage, etc.), the ElasticSearch cluster may still operate normally due to its different technical architecture and operating mechanism, thus ensuring that there is an available data source for the system in the event of a disaster, enhancing the reliability and stability of the disaster recovery system.

[0016] In the second aspect of the present application, there is also provided a data disaster recovery system for performing the data disaster recovery method described in any one of the foregoing, including: a first data center provided with a first storage component; a second data center provided with a second storage component different in type from the first storage component, where the first data center and the second data center are two data centers located in different geographical locations; a disaster tolerance service module for counting the abnormal data accessing the first data center and performing a data source switching operation when it is determined that a disaster has occurred in the first data center, where the data source switching operation is used to instruct to switch the read and write operation data for the first data center to the second data center; during the recovery period of the first data center where a disaster has occurred, the disaster tolerance service module is also used for data synchronization until the data of the two data centers is consistent; where, in the case where no disaster has occurred in the first data center, the application service accesses the first data center through the disaster tolerance service module, and the disaster tolerance service module synchronizes the read and write operation data for the first data center to the second data center.

[0017] By adopting the above technical solutions, it is possible to quickly switch to the standby data center (such as the second data center) when a disaster (or failure) occurs in the primary data center (such as the first data center), ensuring the high availability of the system. At the same time, after the primary data center is restored, the disaster tolerance service module is used for data synchronization to ensure the data consistency of the two data centers. The system further improves the disaster resistance ability and data redundancy of the system by deploying different types of first storage components and second storage components at different geographical locations, effectively reducing the risks that may be brought by a single type of storage component. In addition, the operation of continuously synchronizing the read and write operation data to the standby data center under normal circumstances can minimize the data loss problem after the disaster recovery switch.

[0018] Optionally, the disaster recovery service module includes: an exception statistician for counting the number of access exceptions in the first data center; and a data synchronizer for synchronizing data between the first data center and the second data center.

[0019] By adopting the above technical solution, the introduction of the exception statistician can monitor the access exception situation of the first data center in real time, discover potential disaster risks in a timely manner, thereby improving the reliability of the system; the data synchronizer realizes the data synchronization function between the first data center and the second data center, ensuring the data consistency before and after the disaster recovery switch, and avoiding data loss or damage. This technical solution can quickly switch to the standby data center when the main data center fails, ensuring the high availability of the system.

[0020] Optionally, the disaster recovery service module is used to judge whether a disaster has occurred in the first data center based on the number of exceptions counted by the exception statistician, and the disaster recovery service module is also used to judge whether the data of the first data center and the second data center is consistent by whether there is data accumulation in the data synchronizer.

[0021] By adopting the above technical solution, when a disaster occurs in the first data center, the number of exceptions counted by the exception statistician can be used to accurately judge the occurrence of the disaster, and the data consistency between the two data centers can be efficiently evaluated by whether there is data accumulation in the data synchronizer. This not only improves the automation level of the system, but also can monitor the data synchronization status in real time during the disaster recovery process, reducing the risk of data loss, thereby enhancing the stability and reliability of the entire system.

[0022] Optionally, the data synchronizer includes: a message queue and a consumer cluster. Among them, the message queue is used to store the first incremental data generated by the first data center during the disaster period and the second incremental data generated by the first data center during the recovery period; the consumer cluster is used to sequentially consume the data in the message queue to achieve data synchronization.

[0023] By adopting the above technical solution, the message queue is used to store the first incremental data and the second incremental data, which can effectively avoid data loss and support asynchronous processing, improving the throughput capacity and stability of the system; the consumer cluster sequentially consumes the data in the message queue, ensuring data consistency, and at the same time using the cooperation of multiple consumers to improve the speed and efficiency of data synchronization. An efficient and reliable data synchronization mechanism in the disaster recovery scenario is realized.

[0024] In the third aspect of the present application, an electronic device is further provided, including a memory and a processor. A computer program is stored on the memory, and when the processor executes the program, the method steps of any one of the above are implemented.

[0025] In the fourth aspect of the present application, a computer-readable storage medium is further provided. The computer-readable storage medium stores instructions, and when the instructions are executed, the method steps of any one of the above are performed.

[0026] In summary, one or more technical solutions provided in the present application have at least the following technical effects or advantages: 1. For a data center adopting different types of storage components, this risk can be effectively reduced. By deploying a first data center and a second data center with different types of storage components at different geographical locations, the purpose of enhancing the disaster tolerance ability of the system is achieved; 2. The data to be synchronized is stored in a message queue, including the first incremental data during a disaster and the second incremental data generated during disaster recovery, thereby ensuring that all incremental data is orderly recorded and temporarily stored, avoiding data loss or chaos; using a consumer cluster to sequentially consume the data to be synchronized in the message queue ensures a high degree of consistency and reliability in the data synchronization process, effectively preventing data conflicts or overwriting problems, and enabling efficient and reliable data synchronization during the disaster recovery process; 3. By setting an exception statistic in the disaster tolerance service module, the data service status of the first data center is automatically judged after a disaster occurs, solving the problem in the prior art that the judgment of the recovery status of the main data source is inaccurate and untimely, enabling the disaster recovery system to more intelligently and accurately respond to the disaster and recovery situations of the main data source; 4. Different types of storage components reduce the risk brought by the same technical architecture, ensuring that there is an available data source for the system in the event of a disaster, and enhancing the reliability and stability of the disaster recovery system; 5. While ensuring data consistency, it is possible to promptly restore the first data center with better performance, reducing resource waste and performance loss caused by disaster recovery switching, and further improving the stability and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 is a flowchart of a data disaster recovery method provided by an embodiment of the present application; Figure 2 is a framework diagram of a data disaster recovery system provided by an embodiment of the present application; Figure 3 is an example of a data source disaster recovery system provided by an embodiment of the present application Figure 1 ; Figure 4 is an example of a data source disaster recovery system provided by an embodiment of the present application Figure 2 ; Figure 5 is a schematic structural diagram of a data synchronizer provided by an embodiment of the present application; Figure 6It is a schematic structural diagram of an electronic device disclosed in an embodiment of the present application.

[0028] Explanation of reference numerals in the drawings: 600 - electronic device; 601 - processor; 602 - communication bus; 603 - user interface; 604 - network interface; 605 - memory. Specific embodiments

[0029] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments.

[0030] In the description of the embodiments of the present application, words such as "for example" or "for illustration" are used to represent examples, illustrations or explanations. Any embodiment or design solution described as "for example" or "for illustration" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Exactly speaking, the use of words such as "for example" or "for illustration" is intended to present relevant concepts in a specific manner.

[0031] In the description of the embodiments of the present application, the meaning of the term "a plurality" refers to two or more. In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly indicating the technical features indicated. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. The terms "include", "comprise", "have" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0032] The following is combined with the attached Figures 1-6 to illustrate the embodiments of the present application.

[0033] The present application provides a data disaster recovery method. Refer to Figure 1 , Figure 1 is a flowchart of a data disaster recovery method provided by an embodiment of the present application. The method includes: Step S101: Deploy a first data center and a second data center at different geographical locations. Among them, the first data center is provided with a first storage component, and the second data center is provided with a second storage component of a different type from the first storage component; Step S102: In the case where no disaster occurs in the first data center, the application service accesses the first data center through the disaster recovery service module. The disaster recovery service module counts the number of exceptions for accessing the first data center and synchronizes the read and write operation data of the first data center to the second data center; Step S103: When a disaster occurs in the first data center, the disaster recovery service module automatically performs a data source switching operation, where the data source switching operation is used to indicate switching the read and write operation data for the first data center to the second data center; Step S104: During the recovery period of the first data center where the disaster occurred, data synchronization is performed through the disaster recovery service module until the data in the two data centers is consistent.

[0034] Through the above steps, under normal circumstances, while the application service accesses the first data center, the disaster recovery service module real-time counts the number of anomalies and synchronizes the read and write operation data for the first data center to the second data center, ensuring data security and consistency; when a disaster occurs in the first data center, the disaster recovery service module can automatically detect and perform a data source switching operation, seamlessly transferring the service traffic to the second data center, reducing the system interruption time, and improving the high availability of the system; during the recovery period of the first data center, the disaster recovery service module is used to complete data synchronization between the two data centers, further ensuring data integrity, reducing the manual intervention cost, and enhancing the stability and reliability of the entire system. In existing disaster recovery systems, the primary and backup data sources are mostly the same. Once a disaster occurs in the primary data source due to hardware failures, software vulnerabilities, etc., the backup data source may also face the same risks. However, the method of this embodiment uses data centers with different types of storage components, which can effectively reduce such risks. By deploying the first data center and the second data center with different types of storage components at different geographical locations, the purpose of improving the disaster resistance ability of the system is achieved.

[0035] In this embodiment, data centers with different types of storage components are deployed at different geographical locations, that is, the above-mentioned first data center and the second data center are heterogeneous data sources for mutual backup in a dual-center configuration, which can reduce the risk of both data centers being damaged simultaneously due to the same hardware failures or software vulnerabilities. Most existing disaster recovery systems have the same primary and backup data sources. Once a disaster occurs to the primary data source due to hardware failures, software vulnerabilities, etc., the backup data source may also face the same risks. Under normal circumstances, the read and write operation data of the first data center is synchronized to the second data center, which can ensure the timeliness of the backup data. During a disaster, the data source is automatically switched, and data is automatically synchronized during the recovery period, reducing manual intervention and improving the disaster recovery efficiency. Traditional disaster recovery systems require manual data synchronization after a disaster, which is time-consuming and error-prone. The method of this embodiment ensures the timeliness and accuracy of data through the disaster tolerance service module for real-time data synchronization; in a high-concurrency scenario, an existing system may experience service interruption due to the collapse of the primary data source. The disaster tolerance service module is responsible for monitoring, statistical anomalies, data synchronization, and automatic switching. By automatically switching to the backup data source, this method can quickly restore the service and reduce the risk of system collapse in a high-concurrency scenario. In this embodiment, through real-time data synchronization and automatic switching, the consistency of data and the high availability of the system during disaster recovery are ensured; using different types of storage components (such as SQL and NoSQL) can enhance the flexibility and disaster resistance of the system because different types of storage systems may have different resistances to different types of failures; through continuous data synchronization, it is possible to ensure the ultimate consistency of data in the two data centers and quickly switch to an available data center in the event of a disaster, ensuring the data consistency and high availability of the system and being able to better cope with the risk of system collapse in a high-concurrency scenario; automated data synchronization and switching reduce manual intervention and improve the disaster recovery efficiency. The disasters in this embodiment can be database software leaks, hardware failures, network failures, etc. The data disaster recovery method of this embodiment is applicable to the order processing system of an e-commerce platform, the core trading system of the financial industry, the user data management system of a telecommunications operator, etc.

[0036] In an alternative embodiment, the disaster tolerance service module includes a data synchronizer. Data synchronization through the disaster tolerance service module includes: the data synchronizer stores the data to be synchronized in a message queue, where the data in the message queue includes the first incremental data during a disaster and the second incremental data generated during disaster recovery; the consumer cluster sequentially consumes the data to be synchronized in the message queue to achieve data synchronization, where the data synchronizer includes a message queue and a consumer cluster.

[0037] In the above embodiments, the data to be synchronized is stored in the message queue, including the first incremental data during the disaster and the second incremental data generated during the disaster recovery, so as to ensure that all incremental data is recorded and temporarily stored in an orderly manner, avoiding data loss or chaos; the consumer cluster is used to sequentially consume the data to be synchronized in the message queue, ensuring a high degree of consistency and reliability in the data synchronization process, and effectively preventing data conflicts or overwriting problems. This embodiment can achieve efficient and reliable data synchronization during the disaster recovery process.

[0038] First, the data to be synchronized is stored in the message queue, and then the data in the message queue is sequentially consumed by the consumer cluster to achieve data synchronization. The data to be synchronized includes the first incremental data during the disaster and the second incremental data generated during the disaster recovery. The message queue has high concurrent processing capabilities and a fault tolerance mechanism, and can effectively meet the data synchronization requirements in high-concurrency scenarios. By storing the first incremental data during the disaster and the second incremental data generated during the disaster recovery in the message queue, the synchronization of incremental data is achieved, improving the efficiency of data synchronization. In this embodiment, data synchronization is achieved by storing the data to be synchronized in the message queue and using the consumer cluster for sequential consumption, solving the possible chaos and inconsistency problems in the data synchronization process. The message queue can cache the data to be synchronized to ensure that the data is not lost, and the sequential consumption mechanism of the consumer cluster can ensure that the data is synchronized in the correct order, thereby improving the accuracy and reliability of data synchronization and ensuring that the data in the two data centers is accurately consistent; the architecture of the message queue and the consumer cluster can achieve asynchronous processing of data, and during the occurrence and recovery of disasters, the incremental data can be synchronized in a timely manner, improving the efficiency of data synchronization, reducing the time for data synchronization, and achieving data consistency between the two data centers faster.

[0039] In an alternative embodiment, the above method further includes: determining whether the first data center and the second data center are consistent by checking whether there is data accumulation in the data synchronizer.

[0040] In the above embodiments, based on the data accumulation situation in the data synchronizer as the judgment basis, the data status of the two data centers can be monitored in real time, so as to accurately judge whether they are consistent. This technical means not only improves the reliability of the disaster recovery system, but also simplifies the process of data consistency detection, reduces the need for manual intervention, and further improves the automation level and operation and maintenance efficiency of the entire system. This embodiment can achieve efficient data consistency verification between the first data center and the second data center.

[0041] The main function of the data synchronizer is to achieve data synchronization between the first data center and the second data center, and the data accumulation situation is closely related to the status of data synchronization. If the data in the two data centers is consistent, then during the normal synchronization process, the speed at which the data synchronizer processes data and the speed at which data is generated should be relatively balanced, and there will be no large amount of data accumulation; on the contrary, if there are problems with data synchronization, resulting in inconsistent data in the two data centers, there may be a phenomenon of data accumulation in the data synchronizer. Data accumulation usually means that the data fails to be synchronized in a timely manner. Therefore, it is possible to infer whether the two data centers are consistent by judging whether there is data accumulation in the data synchronizer. For the message queue in the data synchronizer, it is usually possible to judge whether there is data accumulation by monitoring indicators such as its queue length. For example, in common message queue systems, corresponding management tools or APIs are provided to obtain the status information of the queue, including the number of messages to be processed in the queue, etc. By setting a reasonable threshold, when the queue length exceeds the threshold, it can be judged that there is data accumulation, and then it can be inferred that there may be an inconsistent situation between the two data centers. Through this embodiment, it is possible to monitor the data consistency status of the two data centers in real time through the data accumulation situation of the data synchronizer. Once data accumulation occurs, it is possible to quickly discover that there may be problems with data synchronization and deal with them in a timely manner to avoid the continuous expansion of the data inconsistency situation.

[0042] In an alternative embodiment, the above method further includes: after a disaster occurs in the first data center, determining whether the data service of the first data center is normal through an anomaly statistic, where the disaster recovery service module includes an anomaly statistic for counting the number of anomalies accessing the first data center.

[0043] In the above embodiment, the anomaly statistic can timely count the number of anomalies accessing the first data center, so as to quickly determine whether the data service is running normally; this mechanism improves the response speed and reliability of the system, ensuring that measures can be taken quickly in case of a disaster and avoiding service interruption caused by misjudgment; combined with the subsequent data source switching operation, this embodiment further improves the automation degree and stability of the entire disaster recovery system. By setting an anomaly statistic in the disaster recovery service module to automatically judge the data service status after a disaster occurs in the first data center, the problem in the prior art that the recovery status of the main data source is judged inaccurately and untimely is solved, enabling the disaster recovery system to respond more intelligently and accurately to the disaster and recovery situation of the main data source.

[0044] The disaster recovery service module includes an exception statistician, which is itself used to count the number of exceptions accessing the first data center. After a disaster occurs, the exception statistician is used to determine whether the data service of the first data center is normal. By counting and analyzing the number of exceptions, the status of the data service can be determined, thereby providing a basis for whether to continue using the backup data source (the second data center) subsequently and when to consider restoring the use of the primary data source (the first data center). This judgment mechanism helps to more accurately grasp the actual situation of the first data center, avoiding blindly switching back to the primary data source when the data service has not really returned to normal, or continuing to use the backup data source when the data service has already returned to normal, improving the rationality and scientific nature of the disaster recovery system. In the related technology, after a disaster occurs in the primary data source, there is a lack of an accurate and effective judgment mechanism for when the primary data source returns to normal. Usually, the backup data source is used for a period of time after the disaster, and then after the primary data source system recovers, it is judged manually whether it is possible to switch back to the primary data source. This method is inefficient and highly subjective, and may lead to inaccurate timing of switching back to the primary data source. Either switch back to the primary data source that has not fully recovered normal too early, affecting the stability of the system and the consistency of data; or switch too late, resulting in unnecessary long-term use of the backup data source and increasing resource consumption. Through this embodiment, the exception statistician can be used to judge in real time and accurately whether the data service of the first data center is normal, providing a reliable basis for the data source switching of the disaster recovery system, avoiding blindly switching the data source, and improving the stability and reliability of the system; realizing the automatic judgment of the recovery status of the primary data source, reducing manual intervention, improving the automation level of the disaster recovery system, and making the disaster recovery process more efficient and intelligent; by accurately judging the recovery status of the primary data source, the data source can be switched back to the primary data source in time, avoiding unnecessary long-term use of the backup data source, thereby optimizing the utilization of system resources, reducing resource consumption, and improving the overall performance of the system.

[0045] In an optional embodiment, when a disaster occurs in the first data center, the disaster recovery service module automatically performs a data source switching operation, including: when the number of exceptions is greater than or equal to a first preset threshold, it is determined that a disaster has occurred in the first data center, and the data source switching operation is automatically triggered.

[0046] In the above embodiment, when a disaster occurs in the first data center, by monitoring and judging the number of exceptions, the data source switching operation can be automatically triggered when the number of exceptions reaches or exceeds the first preset threshold. This mechanism effectively improves the disaster resistance of the system, reduces the time delay caused by human intervention, and ensures the continuity and stability of the business. At the same time, this embodiment improves the accuracy and reliability of the disaster recovery decision by quantifying the number of exceptions as the disaster determination criterion, thereby ensuring the high availability of the data.

[0047] By setting the comparison between the number of exceptions and the first preset threshold to determine whether a disaster has occurred in the first data center. Specifically, when the number of exceptions is greater than or equal to the first preset threshold, it indicates that the abnormal situation in the first data center is relatively serious and a disaster is likely to have occurred. At this time, the data source switching operation is automatically triggered to switch the read and write operation data to the second data center to ensure the normal operation of the system. For example, it is determined whether a disaster has occurred in the first data center based on whether the number of exceptions counted per second is greater than or equal to the first preset threshold (such as 1000, or other values). This solves the problems of unclear and inaccurate disaster change judgment and data source switching decision-making in the prior art, enabling the disaster recovery system to make a switching decision more accurately and timely in the face of the failure of the primary data source. Through this embodiment, it is possible to accurately determine whether a disaster has occurred in the first data center based on the comparison between the number of exceptions and the first preset threshold, and automatically trigger the data source switching operation in a timely manner, improving the response speed and accuracy of the disaster recovery system to disasters, and ensuring the availability of the system in the event of a disaster; avoiding unreasonable data source switching, reducing unnecessary resource waste. For example, it will not switch to the backup data source when the primary data source has a minor abnormality, thus saving the resource consumption of the backup data source and reducing the workload of data synchronization at the same time; timely and accurate data source switching can ensure that when a disaster occurs, the read and write operations of the data can be quickly transferred to the normal data center, reducing the risk of data loss and inconsistency, and improving the integrity and consistency of the data.

[0048] In an alternative embodiment, the first storage component is a MySQL cluster and the second storage component is an ElasticSearch cluster.

[0049] In the above embodiment, by setting the storage component of the first data center as a MySQL cluster, the advantages of MySQL as a relational database in structured data management and transaction support are fully utilized, ensuring the stability and reliability of the primary data source; setting the storage component of the second data center as an ElasticSearch cluster, taking advantage of the high-performance characteristics of ElasticSearch in unstructured data processing, full-text retrieval, etc., enhancing the functional scalability and query efficiency of the backup data source. Different types of storage components reduce the risks brought by the same technical architecture. Even if the MySQL cluster fails (such as database software crashes, hardware damage, etc.), the ElasticSearch cluster may still operate normally due to its different technical architecture and operating mechanism, thus ensuring that there is an available data source for the system in the event of a disaster and enhancing the reliability and stability of the disaster recovery system.

[0050] In the related art, the primary and standby data sources are usually the same software and hardware. For example, they are both MySQL databases. When there are some problems that affect the commonality of this type of database (such as specific database software vulnerabilities, failures caused by improper database configurations, etc.), the primary and standby data sources may be affected simultaneously, and effective disaster recovery switching cannot be achieved. In this embodiment, the first storage component is a MySQL cluster, and the second storage component is an ElasticSearch cluster. Different types of storage components are adopted, reducing the risks brought by homogeneous data sources and solving the problem that homogeneous data sources may fail simultaneously when facing common problems. A single type of data source may not be able to meet diverse data storage and query requirements. For example, MySQL is mainly suitable for the storage and processing of relational data and has relatively weak processing capabilities for some unstructured or semi-structured data; while ElasticSearch is good at processing massive amounts of unstructured data and full-text search scenarios. In practical applications, there may be storage and query requirements for both relational data and unstructured data at the same time. A single type of primary and standby data source in the prior art cannot well meet such diverse requirements. By adopting different types of storage components in this embodiment, it is possible to better handle the storage and processing of different types of data, solving the limitation problem of a single data source in data type processing. By using different types of storage components, the disaster recovery system can better adapt to different application scenarios. Through this embodiment, when a disaster occurs in the primary data source, it is possible to smoothly switch between different types of data storage systems, enhancing the disaster resistance and flexibility of the system, while ensuring data consistency and high availability.

[0051] In an optional embodiment, the above method further includes: when the number of exceptions is less than a second preset threshold and there is no data accumulation in the data synchronizer, the disaster tolerance service module automatically performs a data source switch-back operation, where the data source switch-back operation is used to indicate switching the read and write operation data from the second data center to the first data center.

[0052] In the above embodiment, when the number of exceptions in the first data center is lower than the second preset threshold and there is no data accumulation in the data synchronizer, the disaster tolerance service module can automatically perform a data source switch-back operation, thereby switching the read and write operation data back from the second data center to the first data center. This embodiment can, while ensuring data consistency, promptly resume using the first data center with better performance, reducing resource waste and performance loss caused by disaster recovery switching, and further improving the stability and reliability of the system. Among them, judging that the number of exceptions is lower than the second preset threshold ensures that the first data center has restored its normal service ability, and confirming that there is no data accumulation in the data synchronizer guarantees the complete consistency of data between the two data centers, avoiding the risk of data loss or chaos.

[0053] In the entire data disaster recovery process, when a disaster occurs in the first data center, the system switches to the second data center. When the first data center resumes normal operation, it is necessary to switch back to the primary data source to maintain the normal architecture and operation efficiency of the system. This embodiment clarifies the specific conditions for switching back to the primary data source (the first data center), that is, the number of anomalies is less than the second preset threshold (such as 200, or 100, or others), and there is no data backlog in the data synchronizer (or the amount of data backlog in the data synchronizer is less than the third preset threshold). The number of anomalies being less than the second preset threshold indicates that the access anomaly situation in the first data center has been effectively improved and the data service has basically resumed normal. The absence of data backlog in the data synchronizer indicates that the data in the two data centers has been basically synchronized. When both of these conditions are met, the data source switch-back operation is automatically executed to switch the read and write operation data from the second data center to the first data center. This embodiment can accurately determine whether the first data center has resumed normal operation according to the set conditions and automatically execute the data source switch-back operation in a timely manner, enabling the system to quickly resume operation in the normal primary and backup architecture state, improving the recovery efficiency and stability of the system. It avoids the problem of resource waste caused by switching back to the primary data source too early or too late, does not blindly switch back when the primary data source has not fully recovered, reducing the additional resource consumption that may be caused by the instability of the primary data source; nor does it switch back too late, keeping the backup data source in a high-load operation state for a long time, reasonably allocating the resource usage of the primary and backup data sources, and optimizing the resource utilization of the system.

[0054] This application also provides a data disaster recovery system for performing the data disaster recovery method of any of the foregoing embodiments, such as Figure 2 shown Figure 2 is a framework diagram of a data disaster recovery system provided by an embodiment of this application. The system includes: The first data center 201, which is provided with a first storage component; The second data center 202, which is provided with a second storage component of a different type from the first storage component. The first data center 201 and the second data center 202 are two data centers located in different geographical locations; The disaster tolerance service module 203 is used to count the number of anomalies in accessing the first data center 201 and perform a data source switching operation when it is determined that a disaster has occurred in the first data center 201. Among them, the data source switching operation is used to instruct to switch the read and write operation data for the first data center 201 to the second data center 202; during the recovery period of the first data center 201 where a disaster has occurred, the disaster tolerance service module 203 is also used to perform data synchronization until the data in the two data centers is consistent; among them, when no disaster has occurred in the first data center 201, the application service accesses the first data center 201 through the disaster tolerance service module 203, and the disaster tolerance service module 203 synchronizes the read and write operation data for the first data center 201 to the second data center 202.

[0055] Through the data disaster recovery system of the above embodiments, it is possible to quickly switch to the standby data center (such as the second data center 202) when a disaster (or failure) occurs in the primary data center (such as the first data center 201), ensuring the high availability of the system. At the same time, after the primary data center is restored, the disaster recovery service module 203 is used to synchronize data to ensure data consistency between the two data centers. By deploying different types of first storage components and second storage components at different geographical locations, the disaster resistance ability and data redundancy of the system are further improved, effectively reducing the risks that may be brought by a single type of storage component. In addition, the operation of continuously synchronizing read and write operation data to the standby data center under normal circumstances can minimize data loss problems after disaster recovery switching.

[0056] The data disaster recovery system consists of the first data center 201, the second data center 202, and the disaster recovery service module 203. The differences in geographical location and storage component types between the first data center 201 and the second data center 202 provide a basis for disaster recovery switching, and the disaster recovery service module 203 plays a key role in monitoring, switching, and data synchronization. Under normal circumstances, the application service accesses the first data center 201 through the disaster recovery service module 203 and synchronizes data to the second data center 202 to establish the initial consistency of the data; the disaster recovery service module 203 determines whether a disaster has occurred in the first data center based on the statistics of abnormal data. When a disaster occurs in the first data center 201, it performs a data source switching operation; during the recovery period of the first data center 201, the disaster recovery service module 203 synchronizes data until the data is consistent, ensuring the final consistency and availability of the system. The two data centers with different types of storage components and geographical locations reduce the risk of the entire system being paralyzed due to a single failure and improve the disaster resistance ability of the system; when one data center has problems, the other data center can continue to provide services to ensure the continuity of the system. Through continuous data synchronization and accurate judgment of the recovery status of the first data center 201, the data of the two data centers is finally ensured to be consistent, improving data consistency; at the same time, during the disaster and recovery process, the system can quickly switch to an available data center, ensuring the high availability of the system and meeting the business requirements for the continuity of data and services.

[0057] In an optional embodiment, the disaster recovery service module 203 includes: an abnormal statistician for counting the number of access abnormalities in the first data center 201; a data synchronizer for synchronizing data between the first data center 201 and the second data center 202.

[0058] In the above embodiments, the introduction of the anomaly statistics device can monitor the access anomalies of the first data center 201 in real time, discover potential disaster risks in a timely manner, and thus improve the reliability of the system; the data synchronizer realizes the data synchronization function between the first data center 201 and the second data center 202, ensuring the data consistency is maintained before and after the disaster recovery switch, and avoiding data loss or damage. This embodiment can quickly switch to the standby data center when the primary data center fails, ensuring the high availability of the system.

[0059] The anomaly statistics device is responsible for counting the access anomalies of the first data center 201, providing a basis for judging whether a disaster has occurred in the first data center 201; the data synchronizer is used to synchronize data between the two data centers, ensuring data consistency under normal circumstances and data synchronization during the recovery process after a disaster, matching the functional requirements of the disaster recovery service module 203 at different stages. Through this embodiment, the anomaly statistics device can count the access anomalies of the first data center 201 in real time and accurately, providing a quantitative basis for judging whether a disaster has occurred in the first data center 201, enabling the disaster recovery system to more accurately perceive the state changes of the primary data source, make corresponding disaster response in a timely manner, and avoid system failures or data losses caused by inaccurate disaster judgment. The data synchronizer is responsible for synchronizing data between the two data centers. Whether it is synchronizing the read and write operation data of the first data center to the second data center 202 during normal operation or synchronizing data until the data of the two data centers is consistent during the recovery period of the first data center 201, it effectively ensures data consistency. This is crucial for ensuring business continuity and data integrity, and improves the data reliability of the system.

[0060] In an alternative embodiment, the disaster recovery service module 203 is used to judge whether a disaster has occurred in the first data center 201 based on the number of anomalies counted by the anomaly statistics device, and the disaster recovery service module 203 is also used to judge whether the data of the first data center 201 and the second data center 202 is consistent by whether there is data accumulation in the data synchronizer.

[0061] In the above embodiments, when a disaster occurs in the first data center 201, it is possible to accurately judge the occurrence of the disaster using the number of anomalies counted by the anomaly statistics device, and efficiently evaluate the data consistency between the two data centers by whether there is data accumulation in the data synchronizer. This not only improves the automation level of the system, but also enables real-time monitoring of the data synchronization status during the disaster recovery process, reducing the risk of data loss, thereby enhancing the stability and reliability of the entire system.

[0062] The anomaly statistics module can trigger the disaster recovery mechanism in a timely manner when the number of access anomalies reaches a certain threshold by monitoring the number of access anomalies, avoiding service interruption caused by misjudgment. The status check function of the data synchronizer (i.e., whether there is data accumulation) can reflect the data synchronization progress and consistency, ensuring that the data between the primary and standby data centers is always up-to-date. This embodiment realizes the automation of disaster judgment and data consistency judgment, reduces manual intervention, and improves the response speed and efficiency of the disaster recovery system. The disaster recovery service module can monitor relevant indicators in real time and make automatic judgments, quickly trigger disaster recovery switching when a disaster occurs, and adjust data synchronization in a timely manner when data is inconsistent, ensuring that the system is always in a good running state.

[0063] In an alternative embodiment, the data synchronizer includes: a message queue and a consumer cluster. The message queue is used to store the first incremental data generated by the first data center 201 during a disaster and the second incremental data generated by the first data center during recovery; the consumer cluster is used to sequentially consume the data in the message queue to achieve data synchronization.

[0064] In the above embodiment, the message queue is used to store the first incremental data and the second incremental data, which can effectively avoid data loss and support asynchronous processing, improving the throughput and stability of the system; the consumer cluster sequentially consumes the data in the message queue, ensuring data consistency, and at the same time improving the speed and efficiency of data synchronization by using the method of multi-consumer collaborative work. An efficient and reliable data synchronization mechanism in the disaster recovery scenario is realized.

[0065] The message queue is used to store the incremental data generated by the first data center 201 during a disaster and during recovery, providing a data caching function for data synchronization to ensure that data will not be lost during the synchronization process; the message queue stores the incremental data generated by the first data center 201 during a disaster and during recovery, providing a reliable data cache for data synchronization. Even if there are short-term anomalies or delays during the synchronization process, the data will not be lost, guaranteeing the integrity of the data. The consumer cluster sequentially consumes the data in the message queue, ensuring that the data is synchronized to the second data center 202 in the order of generation, avoiding out-of-order or chaotic data, thereby improving the accuracy of data synchronization and ensuring the consistency of data between the two data centers. The reliable data synchronization mechanism improves the stability and reliability of the entire data disaster recovery system. During the occurrence and recovery of a disaster, it can ensure the accurate synchronization of data, reduce the risk of system failures caused by inconsistent or lost data, and ensure that the system can run continuously and stably, providing reliable support for the business.

[0066] In an alternative embodiment, a consumer cluster includes multiple consumers. By setting a unique and identical field in the message content to enter a topic, multiple consumers can consume the data in the message queue in sequence.

[0067] In the above embodiment, by setting a unique and identical field in the message content to enter a topic, it is ensured that messages with the same topic are assigned to the same consumer for processing, thus avoiding the problem of out-of-order messages; multiple consumers can work collaboratively, improving the efficiency and reliability of data synchronization, and at the same time ensuring data consistency. The ordered consumption of data in the message queue by multiple consumers is achieved.

[0068] By setting a unique and identical field in the message content to enter a topic, relevant messages can be classified. In this way, when multiple consumers process messages, since these messages all belong to the same topic, they can be consumed in a specific order, ensuring the orderliness of data processing. This method is in line with the working principles of the message queue and the consumer cluster, using the characteristics of the topic to organize and manage messages, enabling multiple consumers to work in coordination, achieving the ordered consumption of data in the message queue, avoiding the chaos of data processing caused by unordered consumption by consumers, and ensuring the accuracy and consistency of data during the data synchronization process.

[0069] It should be noted that: when the device provided in the above embodiment realizes its functions, only the above-mentioned division of each functional module is used for illustration. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process can be seen in the method embodiment, which will not be elaborated here.

[0070] Obviously, the above-described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The present application will be specifically described below with reference to specific embodiments.

[0071] The embodiments of the present application provide a data source disaster recovery and data restoration method to solve the problems of insufficient disaster resistance of homogeneous data sources in the disaster recovery system in the related art, and the need for manual intervention for data restoration before and after a disaster and the risk of data loss. The embodiments of the present application adopt mutual backup of heterogeneous data sources in two centers. A data center 1 (corresponding to the aforementioned first data center) in place A builds a Mysql cluster, and a data center 2 (corresponding to the aforementioned second data center) in place B builds an ElasticSearch cluster. Two data sources are used to prevent and resist disasters. Before and after a disaster, the data source is switched through an exception statistic in the disaster recovery service, and the data synchronizer performs automatic data synchronization.

[0072] The technical solutions of the embodiments of the present application will be elaborated in detail below.

[0073] (1) Heterogeneous data sources in multiple locations Deploy two data centers in different places respectively, and deploy different storage components in different data centers. For example, deploy a set of MySql clusters in Province A and a set of ElasticSearch clusters in Province B. The normal application service accesses Data Center 1 in Location A through the disaster recovery service, and the disaster recovery service will count the number of exceptions accessing Data Center 1. The data is synchronized to Data Center 2 in Location B through the data synchronizer. As Figure 3 shown. Figure 3 In it, Node1 - Node3 represent nodes, Master represents the main server, Slaver1 and Slaver2 represent slave servers, and Es Shard1 - Es Shard3 represent ES shards.

[0074] When a disaster occurs in Data Center 1 in Location A, such as hardware failure, spiky traffic crashing the database service, network anomaly, etc. The disaster recovery service senses the anomaly of Data Center 1 through statistics, immediately and automatically switches the read and write data to Data Center 2 in Location B, and temporarily stores the data in the data synchronizer, and then synchronizes the data to Data Center 1 when it recovers. As Figure 4 shown.

[0075] (2) Abnormal switching of data sources During the disaster, Data Center 1 in Location A is unavailable, and the data synchronizer cannot synchronize data in, and the anomaly statistics calculator can always calculate the anomalies of Data Center 1 within a period of time. After Data Center 1 in Location A becomes available, the data synchronizer synchronizes data normally.

[0076] We can observe whether the data service of Data Center 1 in Location A is normal according to the anomaly statistics, and judge whether the data of the two clusters is consistent by whether there is data accumulation in the data synchronizer. One of the advantages of this system is that we don't need to do any operations. Automatic disaster recovery switching and data synchronization. Figure 5 is the internal structure of the data synchronizer.

[0077] (3) Data recovery As Figure 5 shown, the data synchronizer internally includes the following components: message queue, consumer cluster.

[0078] There are two parts of data in the message queue. One part is the incremental data during the disaster, and the other part is the incremental data that is still appended to the queue after Data Center 1 in Location A recovers. Due to the structure of the queue, first in first out, as long as we synchronize all the data in the queue. The data of the two clusters in the two places must be exactly the same.

[0079] There are multiple consumers. To improve the efficiency of consumption, by setting a unique and identical field in the message content into a topic, it is ensured that multiple consumers can also consume in sequence.

[0080] In the above embodiment, a deployment scheme of two - place dual - center different - medium data sources is adopted to flexibly improve the availability of the system; through the disaster - tolerance service for automatic anomaly monitoring and automatic data - source switching, the availability of the system is greatly improved; and before and after a disaster, through the data synchronizer, accurate and automated data synchronization is performed, improving the availability of the system and liberating the data error of manual operation.

[0081] Compared with the prior art, the embodiment of the present application innovatively realizes a disaster - recovery and fast synchronization - recovery method for two - place heterogeneous data sources. Utilizing the elasticity of different storage components and combining with the self - developed disaster - tolerance service, the system can be quickly switched in case of a disaster, and accurate and automated data synchronization can be performed, improving the high availability of the system. It is original in the field of the automated method for data - source disaster - recovery and data recovery before and after disaster - recovery in software architecture design.

[0082] The present application also provides a computer - readable storage medium. Instructions are stored in the computer - readable storage medium, and when the instructions are executed, the method steps described in any one of the above are performed.

[0083] In an exemplary embodiment, the above - mentioned computer - readable storage medium may include, but is not limited to: USB flash drive, read - only memory (ROM for short), random - access memory (RAM for short), mobile hard disk, magnetic disk or optical disc, etc., all kinds of media that can store computer programs.

[0084] The present application also discloses an electronic device. As Figure 6 shown, Figure 6 is a schematic structural diagram of an electronic device disclosed in the embodiment of the present application. The electronic device 600 may include: at least one processor 601, at least one communication bus 602, a user interface 603, at least one network interface 604, and a memory 605.

[0085] Among them, the communication bus 602 is used to realize the connection and communication between these components.

[0086] Among them, the user interface 603 may include a display screen (Display), a camera (Camera). Optionally, the user interface 603 may further include a standard wired interface and a wireless interface.

[0087] Among them, the network interface 604 may optionally include a standard wired interface and a wireless interface (such as a WI - FI interface).

[0088] Among them, the processor 601 may include one or more processing cores. The processor 601 uses various interfaces and circuits to connect various parts within the entire electronic device (such as a server). By running or executing instructions, programs, code sets, or instruction sets stored in the memory 605, and by calling the data stored in the memory 605, it executes various functions of the server and processes data. Optionally, the processor 601 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 601 may integrate a combination of one or several of a central processing unit (CPU), a graphics processing unit (GPU), and a modem, etc. Among them, the CPU mainly processes the operating system, user interface, application programs, etc.; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 601 and may be implemented separately by a single chip.

[0089] Among them, the memory 605 may include random access memory (RAM) and may also include read-only memory. Optionally, the memory 605 includes a non-transitory computer-readable storage medium. The memory 605 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 605 may include a program storage area and a data storage area. Among them, the program storage area can store instructions for implementing the operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area can store the data involved in the above-mentioned various method embodiments. Optionally, the memory 605 may also be at least one storage device located far from the aforementioned processor 601. Refer to Figure 6 , the memory 605, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for a data disaster recovery method.

[0090] In Figure 6In the electronic device 600 shown, the user interface 603 is mainly used to provide an interface for the user to input and obtain the data input by the user; and the processor 601 can be used to call an application program of a data disaster recovery method stored in the memory 605. When executed by one or more processors 601, the electronic device 600 is caused to execute one or more of the methods as described in the foregoing embodiments. It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that this application is not limited by the described action sequence, because according to this application, some steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0091] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0092] The foregoing are only exemplary embodiments of the present disclosure and should not be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made in accordance with the teachings of the present disclosure still fall within the scope covered by the present disclosure. After considering the disclosure of the specification, those skilled in the art will readily think of other implementation schemes of the present disclosure.

[0093] This application aims to cover any variations, uses, or adaptive changes of the present disclosure that follow the general principles of the present disclosure and include common general knowledge or conventional technical means in the technical field not recorded in the present disclosure.

Claims

1. A data disaster recovery method, characterized in that, Including: Deploying a first data center and a second data center at different geographical locations, where the first data center is provided with a first storage component, and the second data center is provided with a second storage component of a different type from the first storage component; When no disaster occurs in the first data center, the application service accesses the first data center through the disaster recovery service module. The disaster recovery service module counts the number of exceptions for accessing the first data center and synchronizes the read and write operation data of the first data center to the second data center; When a disaster occurs in the first data center, the disaster recovery service module automatically performs a data source switching operation, where the data source switching operation is used to indicate switching the read and write operation data of the first data center to the second data center; During the recovery period of the first data center where a disaster has occurred, data synchronization is performed through the disaster recovery service module until the data in the two data centers is consistent.

2. The method according to claim 1, characterized in that The disaster recovery service module includes a data synchronizer. Performing data synchronization through the disaster recovery service module includes: The data synchronizer stores the data to be synchronized in a message queue, where the data in the message queue includes first incremental data during the disaster period and second incremental data generated during the disaster recovery period; The consumer cluster sequentially consumes the data to be synchronized in the message queue to achieve data synchronization, where the data synchronizer includes the message queue and the consumer cluster.

3. The method according to claim 2, wherein The method further includes: Judging whether the first data center and the second data center are consistent by whether there is data accumulation in the data synchronizer.

4. The method according to claim 1, characterized in that The method further includes: After a disaster occurs in the first data center, judging whether the data service of the first data center is normal through an exception statistic. The disaster recovery service module includes the exception statistic, and the exception statistic is used to count the number of exceptions for accessing the first data center.

5. The method according to claim 1, wherein When a disaster occurs in the first data center, the disaster recovery service module automatically performs a data source switching operation, including: When the number of exceptions is greater than or equal to a first preset threshold, it is determined that a disaster has occurred in the first data center, and the data source switching operation is automatically triggered.

6. The method according to claim 1, characterized in that, The first storage component is a MySQL cluster, and the second storage component is an ElasticSearch cluster.

7. A data disaster recovery system, characterized in that, For executing the method according to any one of claims 1 to 6, including: A first data center, provided with a first storage component; A second data center, provided with a second storage component of a different type from the first storage component. The first data center and the second data center are two data centers located at different geographical locations; The disaster recovery service module is used to count the number of anomalies in accessing the first data center and perform a data source switching operation when it is determined that a disaster has occurred in the first data center. The data source switching operation is used to indicate switching the read and write operation data for the first data center to the second data center; during the recovery period of the first data center where a disaster has occurred, the disaster recovery service module is also used to perform data synchronization until the data in the two data centers is consistent; Among them, in the case where no disaster has occurred in the first data center, the application service accesses the first data center through the disaster recovery service module, and the disaster recovery service module synchronizes the read and write operation data for the first data center to the second data center.

8. The system according to claim 7, characterized in that, The disaster recovery service module includes: An anomaly statistician for counting the number of access anomalies in the first data center; A data synchronizer for synchronizing data between the first data center and the second data center.

9. The system according to claim 8, wherein The disaster recovery service module is used to determine whether a disaster has occurred in the first data center based on the number of anomalies counted by the anomaly statistician. The disaster recovery service module is also used to determine whether the data in the first data center and the second data center is consistent based on whether there is data accumulation in the data synchronizer.

10. The system according to claim 8, characterized in that The data synchronizer includes: a message queue and a consumer cluster, where The message queue is used to store the first incremental data generated by the first data center during a disaster and the second incremental data generated by the first data center during the recovery period; The consumer cluster is used to sequentially consume the data in the message queue to achieve data synchronization.