A data synchronization method and apparatus for a dual-active system
By monitoring the backup system to capture abnormal information, determining data synchronization needs, and identifying strategies, the problem of data non-synchronization during dual-active system switching was solved, thus achieving business continuity and stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2023-08-09
- Publication Date
- 2026-06-30
AI Technical Summary
During the switchover between active-active systems, data synchronization issues can disrupt business operations, a problem that current technologies cannot effectively address.
By monitoring the backup system to capture abnormal information, determining the data table and conditions where the abnormal information is located, judging whether data synchronization is needed, and determining the data synchronization strategy based on the partitioning of the data table, data synchronization between the core system and the backup system is achieved.
The system switch ensured normal business operations and improved the efficiency and reliability of data synchronization.
Smart Images

Figure CN116821249B_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification relate to the financial field, and in particular, to a data synchronization method and apparatus for a dual-active system. Background Technology
[0002] With the rapid development of fintech, customers have increasingly higher requirements for the continuity and stability of banking services. More and more commercial banks are establishing active-active or even multi-active systems to ensure stable operation. In the event of a core system failure, the system can quickly switch to a backup system to provide services. Therefore, data synchronization is crucial for active-active architectures. If data is not synchronized between the active-active systems during certain failure scenarios, system switching cannot occur, resulting in business disruptions.
[0003] Therefore, there is an urgent need for a data synchronization method for active-active systems that can ensure normal business operations even after system switching. Summary of the Invention
[0004] The purpose of the embodiments in this specification is to provide a data synchronization method and apparatus for a dual-active system, which can be used in the financial field or any field outside the financial field. The application field of the method and apparatus in the embodiments of this specification is not limited, so as to ensure that business can continue normally after system switching.
[0005] To achieve the above objectives, in one aspect, embodiments of this specification provide a data synchronization method for a dual-active system, including:
[0006] Monitor the backup system and capture abnormal information;
[0007] Based on the anomaly information, determine the data table containing the anomaly information and the data conditions of the anomaly information;
[0008] Based on the data table and data conditions, determine whether data synchronization between the core system and the backup system is necessary;
[0009] When data synchronization is required, the corresponding data synchronization strategy is determined based on the partitioning of the data table.
[0010] According to the data synchronization strategy, the data table is synchronized from the core system to the backup system.
[0011] Preferably, determining whether data synchronization between the core system and the backup system is needed based on the data table and data conditions further includes:
[0012] Based on the data table and data conditions, query the records of the core system and the backup system regarding the data table and data conditions;
[0013] Determine if the records of the two systems are consistent to determine whether data synchronization between the core system and the backup system is necessary.
[0014] Preferably, determining the corresponding data synchronization strategy based on the partitioning of the data table further includes:
[0015] The size of the data table is determined based on the number of partitions and the amount of data in the data table;
[0016] Based on the size of the data table and whether the data table contains non-partitioned indexes, a corresponding data synchronization strategy is determined.
[0017] Preferably, determining the appropriate data synchronization strategy based on the size of the data table and whether the data table contains a non-partitioned index further includes:
[0018] If the size of the data table is not greater than the set size, then the corresponding synchronization strategy is determined as follows:
[0019] The core system stores the data table into a full file and writes the full file to a shared volume;
[0020] The backup system reads all files from the shared volume and imports them into a designated table.
[0021] Preferably, determining the appropriate data synchronization strategy based on the size of the data table and whether the data table contains a non-partitioned index further includes:
[0022] If the size of the data table is greater than the set size, and the data table does not contain a non-partitioned index, then the corresponding synchronization strategy is determined as follows:
[0023] In the core system, each partition of the data table stores a portion of the corresponding data table into a designated file in parallel, and then writes the designated file into a shared volume in parallel.
[0024] The backup system reads the specified files from the shared volume in parallel and imports them into the specified table in parallel.
[0025] Preferably, determining the appropriate data synchronization strategy based on the size of the data table and whether the data table contains a non-partitioned index further includes:
[0026] If the size of the data table is greater than the set size, and the data table contains a non-partitioned index, then the corresponding synchronization strategy is determined as follows:
[0027] In the core system, each partition of the data table stores a portion of the corresponding data table into a designated file in parallel, and then writes the designated file into a shared volume in parallel.
[0028] The backup system reads the specified files from the shared volume in parallel and then imports them into the specified table in parallel.
[0029] The backup system reorders the non-partitioned indexes in the specified table.
[0030] Preferably, determining the size of the data table based on the number of partitions and the amount of data in the data table further includes:
[0031] If the number of partitions in the data table is greater than the set number, then the size of the data table is greater than the set size.
[0032] If the number of partitions in the data table is not greater than the set number, then determine whether the data volume of the data table is greater than the set data volume;
[0033] If so, the size of the data table is greater than the set size;
[0034] If not, the size of the data table is not greater than the set size.
[0035] Preferred options also include:
[0036] Record the moment when data synchronization between the core system and the backup system begins;
[0037] After data synchronization between the core system and the backup system is completed, the backup system is hot-started before the stated time.
[0038] On the other hand, embodiments of this specification provide a data synchronization device for a dual-active system, the device comprising:
[0039] The monitoring module is used to monitor the backup system and capture abnormal information;
[0040] The determination module is used to determine the data table where the abnormal information is located and the data conditions of the abnormal information based on the abnormal information.
[0041] The judgment module is used to determine whether data synchronization between the core system and the backup system is required based on the data table and data conditions.
[0042] The strategy definition module is used to determine the corresponding data synchronization strategy based on the partitioning of the data table when data synchronization is required.
[0043] The synchronization module is used to synchronize the data table from the core system to the backup system according to the data synchronization strategy.
[0044] In another aspect, embodiments of this specification also provide a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the computer program, when executed by the processor, performs instructions according to any of the methods described above.
[0045] In another aspect, embodiments of this specification also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor of a computer device, performs instructions according to any one of the methods described above.
[0046] In another aspect, embodiments of this specification also provide a computer program product that, when run by a processor of a computer device, executes instructions according to any one of the methods described above.
[0047] In the embodiments of this specification, abnormal information is captured by monitoring the backup system. Then, based on the data table where the abnormal information is located and the data conditions of the abnormal information, it is determined whether data synchronization is required. The data synchronization strategy is determined according to the partitioning of the data table, and then the data synchronization is completed. Through the method of the embodiments of this specification, business can still be guaranteed to continue normally after system switchover.
[0048] To make the above and other objects, features and advantages of this specification more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0049] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0050] Figure 1 A flowchart illustrating a data synchronization method for a dual-active system provided in an embodiment of this specification is shown.
[0051] Figure 2 This document illustrates a flowchart of an embodiment of the process for determining whether data synchronization between the core system and the backup system is necessary.
[0052] Figure 3 This document illustrates a flowchart illustrating the process of determining the appropriate data synchronization strategy based on the partitioning of a data table, as provided in an embodiment of this specification.
[0053] Figure 4This document illustrates a flowchart of an embodiment of the process for determining a corresponding synchronization strategy if the size of the data table is not greater than a set size.
[0054] Figure 5 This document illustrates a flowchart of how to determine the appropriate synchronization strategy if the size of a data table is greater than a set size and the data table does not contain a non-partitioned index, as provided in an embodiment of this specification.
[0055] Figure 6 This document illustrates a flowchart of a process for determining a corresponding synchronization strategy if the size of a data table is greater than a set size and the data table contains a non-partitioned index, as provided in an embodiment of this specification.
[0056] Figure 7 A flowchart illustrating the process of determining the size of a data table, as provided in an embodiment of this specification, is shown.
[0057] Figure 8 A schematic diagram of the standby system hot start process provided in the embodiments of this specification is shown;
[0058] Figure 9 This specification shows a schematic diagram of the structure of a computer device provided in an embodiment.
[0059] Figure 10 A schematic diagram of the module structure of a data synchronization device for a dual-active system provided in an embodiment of this specification is shown.
[0060] Explanation of symbols in the attached drawings:
[0061] 100. Monitoring module;
[0062] 200. Determine the module;
[0063] 300. Judgment Module;
[0064] 400. Clearly defined strategy module;
[0065] 500. Synchronization module;
[0066] 902. Computer equipment;
[0067] 904, Processor;
[0068] 906. Memory;
[0069] 908. Drive mechanism;
[0070] 910. Input / Output Module;
[0071] 912. Input devices;
[0072] 914. Output devices;
[0073] 916. Presentation equipment;
[0074] 918. Graphical User Interface;
[0075] 920. Network interface;
[0076] 922. Communication link;
[0077] 924. Communication bus. Detailed Implementation
[0078] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the embodiments of this specification.
[0079] With the rapid development of fintech, customers have increasingly higher requirements for the continuity and stability of banking services. More and more commercial banks are establishing active-active or even multi-active systems to ensure stable operation. In the event of a core system failure, the system can quickly switch to a backup system to provide services. Therefore, data synchronization is crucial for active-active architectures. If data is not synchronized between the active-active systems during certain failure scenarios, system switching cannot occur, resulting in business disruptions.
[0080] To address the aforementioned issues, this specification provides a data synchronization method for a dual-active system. Figure 1 This is a flowchart illustrating a data synchronization method for a dual-active system provided in an embodiment of this specification. This specification provides the operational steps of the method described in the embodiments or flowchart, but based on conventional or non-inventive methods, more or fewer operational steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only possible execution order. In actual system or device products, the methods shown in the embodiments or drawings can be executed sequentially or in parallel.
[0081] It should be noted that the terms "first," "second," etc., in the description, claims, and accompanying drawings of the embodiments in this specification are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, apparatus, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0082] Reference Figure 1 This specification provides a data synchronization method for a dual-active system, including:
[0083] S101: Monitor the backup system and capture abnormal information;
[0084] S102: Based on the abnormal information, determine the data table where the abnormal information is located and the data conditions of the abnormal information;
[0085] S103: Based on the data table and data conditions, determine whether data synchronization between the core system and the backup system is required;
[0086] S104: When data synchronization is required, determine the corresponding data synchronization strategy based on the partitioning of the data table;
[0087] S105: According to the data synchronization strategy, synchronize the data table from the core system to the backup system.
[0088] In the embodiments described in this specification, the dual-active system includes a core system and a backup system. The core system executes transactions, while the backup system maintains data synchronization with the core system. When the core system fails, it can be switched to the backup system. Automated monitoring software (SA) is deployed on the backup system to monitor it. When SA captures an information header, it indicates that there is abnormal information in the backup system; different information headers correspond to different abnormal information.
[0089] By calling a predefined template, you can query the data table containing the anomaly information and the data conditions for that anomaly. The template records the data table and conditions corresponding to different anomalies. For example, if customer A withdraws 800 yuan, the core system's deposit and withdrawal record table for customer A shows a deposit of 1000 yuan, with the data condition being: when the deposit is 1000 yuan, subtract 800 yuan. However, the backup system's deposit and withdrawal record table for customer A shows a deposit of 500 yuan. Therefore, the anomaly information is located in customer A's deposit and withdrawal record table, and the data condition is a deposit of 1000 yuan.
[0090] Based on the data table and data conditions, determine whether data synchronization between the core system and the backup system is necessary. As shown in the example above, data synchronization is required. According to the corresponding data synchronization strategy, the data table is synchronized from the core system to the backup system.
[0091] In the embodiments of this specification, abnormal information is captured by monitoring the backup system. Then, based on the data table where the abnormal information is located and the data conditions of the abnormal information, it is determined whether data synchronization is required. The data synchronization strategy is determined according to the partitioning of the data table, and then the data synchronization is completed. Through the method of the embodiments of this specification, business can still be guaranteed to continue normally after system switchover.
[0092] In the embodiments described in this specification, reference is made to Figure 2 The step of determining whether data synchronization between the core system and the backup system is needed based on the data table and data conditions further includes:
[0093] S201: Based on the data table and data conditions, query the records of the core system and the backup system regarding the data table and data conditions;
[0094] S202: Determine whether the records of the two systems are consistent in order to determine whether data synchronization between the core system and the backup system is required.
[0095] If the records from both systems are consistent, no data synchronization is needed. If the records are inconsistent, data synchronization is required. Continuing with the example above, the core system and the backup system record inconsistent data conditions. The core system records a deposit of 1000 yuan, while the backup system records a deposit of 500 yuan, which does not meet the requirement of a deposit of 1000 yuan. Therefore, the two records are inconsistent and synchronization is necessary.
[0096] In the embodiments described in this specification, reference is made to Figure 3 The step of determining the corresponding data synchronization strategy based on the partitioning of the data table further includes:
[0097] S301: Determine the size of the data table based on the number of partitions and the amount of data in the data table;
[0098] S302: Determine the corresponding data synchronization strategy based on the size of the data table and whether the data table contains a non-partitioned index.
[0099] The tablespace name can be retrieved based on the table name. The tablespace name is a physical concept stored on the disk, while the table name is a logical concept. Further, the number of partitions and the amount of data in the table can be retrieved based on the tablespace name. Additionally, the table name can be used to determine whether the table includes an NPI (Non-Partitioned Index). Using this information, the appropriate data synchronization strategy can be determined.
[0100] If no anomalies are found within the recent specified time period, data synchronization is performed by calling any of the following steps depending on the table type. If anomalies are found, the process continues to wait until the transaction completes normally. Once no anomalies are found, data synchronization is performed by calling any of the steps described below depending on the table type.
[0101] Specifically, determining the appropriate data synchronization strategy based on the size of the data table and whether the data table contains a non-partitioned index further includes:
[0102] Reference Figure 4 If the size of the data table is not greater than the set size, then the corresponding synchronization strategy is determined as follows:
[0103] S401: The core system stores the data table into a full file and writes the full file to a shared volume;
[0104] S402: The backup system reads all the files in the shared volume and imports them into the specified table.
[0105] Reference Figure 5 If the size of the data table is greater than the set size, and the data table does not contain a non-partitioned index, then the corresponding synchronization strategy is determined as follows:
[0106] S501: In the core system, each partition of the data table stores the corresponding part of the data table into a specified file in parallel, and writes the specified file into the shared volume in parallel.
[0107] S502: The standby system reads the specified files from the shared volume in parallel and imports them into the specified table in parallel.
[0108] Reference Figure 6 If the size of the data table is greater than the set size, and the data table contains a non-partitioned index, then the corresponding synchronization strategy is determined as follows:
[0109] S601: In the core system, each partition of the data table stores the corresponding part of the data table into a specified file in parallel, and writes the specified file into the shared volume in parallel.
[0110] S602: The backup system reads the specified files from the shared volume in parallel and imports them into the specified table in parallel.
[0111] S603: The standby system reorders the non-partitioned indexes in the specified table.
[0112] The designated table in the backup system corresponds to the data table in the core system, and the parallel process can improve the efficiency of data synchronization.
[0113] If there is a non-partitioned index, this parameter can be used to write to the shared volume in parallel. Without this parameter, each job submitted in parallel has to execute the S603 step once, resulting in low efficiency. Using this parameter, the shared volume can be written to in parallel first, and then the S603 step can be executed once at the end, which can greatly improve efficiency.
[0114] In the embodiments described in this specification, reference is made to Figure 7 The step of determining the size of the data table based on the number of partitions and the amount of data in the data table further includes:
[0115] S701: If the number of partitions of the data table is greater than the set number, then the size of the data table is greater than the set size.
[0116] S702: If the number of partitions of the data table is not greater than the set number, then determine whether the data volume of the data table is greater than the set data volume;
[0117] S703: If so, the size of the data table is greater than the set size;
[0118] S704: If not, the size of the data table is not greater than the set size.
[0119] The quantity and scale can be determined according to the actual situation, and this manual does not impose any restrictions on them.
[0120] In the embodiments described in this specification, reference is made to Figure 8 It also includes:
[0121] S801: Record the moment when data synchronization between the core system and the backup system begins;
[0122] S802: After data synchronization between the core system and the backup system is completed, the backup system is hot-started before the stated time.
[0123] The purpose of shutting down the CAPTURE address space based on the anomaly information is to ensure that the data in the core system and the standby system are in a consistent position. Specifically, a CAPTURE address space parses the logs of multiple tablespaces, producing multiple CAPTURE address space names. It is necessary to look up the corresponding CAPTURE address space name based on the tablespace name in the anomaly information, and then shut down the corresponding CAPTURE address space. The timestamp of the shutdown is recorded as the start time for data synchronization between the core system and the standby system. After the data synchronization between the core system and the standby system is completed, the standby system is warm-started before the specified time. The purpose is to retrospectively count incremental data from the standby system based on the core system. The timing before the specified time is to prevent the loss of some incremental data and ensure the integrity of the incremental data.
[0124] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the acquisition, storage, use, and processing of data in the technical solutions described in the embodiments of this application all comply with the relevant provisions of national laws and regulations.
[0125] Based on the data synchronization method for a dual-active system described above, this specification also provides a corresponding data synchronization device for a dual-active system. The device may include a system (including a distributed system), software (application), module, component, server, client, etc., using the method described in this specification, combined with necessary hardware implementation. Based on the same innovative concept, the devices in one or more embodiments provided in this specification are as described in the following embodiments. Since the implementation schemes and methods for solving the problem are similar, the implementation of specific devices in this specification can refer to the implementation of the aforementioned method, and repeated details will not be repeated. As used below, the terms "unit" or "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0126] Specifically, Figure 10 This is a schematic diagram of the module structure of a data synchronization device for a dual-active system according to an embodiment of the present specification. (Refer to...) Figure 10 As shown in the embodiments of this specification, a data synchronization device for a dual-active system includes: a monitoring module 100, a determination module 200, a judgment module 300, a strategy definition module 400, and a synchronization module 500.
[0127] Monitoring module 100 is used to monitor the backup system and capture abnormal information;
[0128] The determination module 200 is used to determine the data table where the abnormal information is located and the data conditions of the abnormal information based on the abnormal information.
[0129] The judgment module 300 is used to determine whether data synchronization between the core system and the backup system is required based on the data table and data conditions.
[0130] The strategy definition module 400 is used to determine the corresponding data synchronization strategy based on the partitioning of the data table when data synchronization is required.
[0131] The synchronization module 500 is used to synchronize the data table from the core system to the backup system according to the data synchronization strategy.
[0132] Reference Figure 9 As shown, based on the data synchronization method for a dual-active system described above, one embodiment of this specification also provides a computer device 902, wherein the above method operates on the computer device 902. The computer device 902 may include one or more processors 904, such as one or more central processing units (CPUs) or graphics processing units (GPUs), each processing unit capable of implementing one or more hardware threads. The computer device 902 may also include any memory 906 for storing any kind of information such as code, settings, data, etc. In one specific embodiment, a computer program is stored on the memory 906 and can run on the processor 904. When the computer program is run by the processor 904, it can execute instructions according to the above method. Non-limitingly, for example, the memory 906 may include any type of RAM, any type of ROM, flash memory, hard disk, optical disk, etc. More generally, any memory can use any technology to store information. Further, any memory can provide volatile or non-volatile retention of information. Further, any memory can represent a fixed or removable component of the computer device 902. In one scenario, when processor 904 executes associated instructions stored in any memory or combination of memories, computer device 902 can perform any operation of the associated instructions. Computer device 902 also includes one or more drive mechanisms 908 for interacting with any memory, such as hard disk drive mechanisms, optical disk drive mechanisms, etc.
[0133] Computer device 902 may also include an input / output module 910 (I / O) for receiving various inputs (via input device 912) and providing various outputs (via output device 914). A specific output mechanism may include a presentation device 916 and an associated graphical user interface 918 (GUI). In other embodiments, the input / output module 910 (I / O), input device 912, and output device 914 may be omitted, and the device may function solely as a computer device within a network. Computer device 902 may also include one or more network interfaces 920 for exchanging data with other devices via one or more communication links 922. One or more communication buses 924 couple the components described above together.
[0134] Communication link 922 can be implemented in any way, such as via a local area network (LAN), a wide area network (WAN) (e.g., the Internet), a point-to-point connection, or any combination thereof. Communication link 922 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.
[0135] Corresponding to Figures 1-8 In addition to the methods described above, embodiments of this specification also provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the methods described above.
[0136] This specification also provides computer-readable instructions, wherein when a processor executes the instructions, the program therein causes the processor to perform the following... Figures 1 to 8 The method shown.
[0137] This specification also provides a computer program product, wherein the computer program product, when run by the processor of a computer device, performs the following... Figures 1 to 8 The method shown.
[0138] It should be understood that in the various embodiments of this specification, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this specification.
[0139] It should also be understood that, in the embodiments of this specification, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the embodiments of this specification, the character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0140] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this specification can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of the embodiments in this specification.
[0141] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0142] In the several embodiments provided in this specification, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the couplings or direct couplings or communication connections shown or discussed may be indirect couplings or communication connections through some interfaces, devices, or units, or they may be electrical, mechanical, or other forms of connection.
[0143] 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 units can be selected to achieve the purpose of the embodiments described in this specification, depending on actual needs.
[0144] Furthermore, the functional units in the various embodiments of this specification can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0145] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this specification, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this specification. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0146] This specification uses specific embodiments to illustrate the principles and implementation methods of the embodiments. The above description of the embodiments is only for the purpose of helping to understand the methods and core ideas of the embodiments in this specification. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the embodiments in this specification. Therefore, the content of this specification should not be construed as a limitation on the embodiments in this specification.
Claims
1. A data synchronization method for a dual-active system, characterized in that, include: Monitor the backup system and capture abnormal information; Based on the anomaly information, determine the data table containing the anomaly information and the data conditions of the anomaly information; Based on the data table and data conditions, determine whether data synchronization between the core system and the backup system is necessary; When data synchronization is required, a corresponding data synchronization strategy is determined based on the partitioning of the data table, including: determining the size of the data table based on the number of partitions and the amount of data; determining a corresponding data synchronization strategy based on the size of the data table and whether the data table contains non-partitioned indexes; if the number of partitions of the data table is greater than a set number, then the size of the data table is greater than the set size; if the number of partitions of the data table is not greater than the set number, then it is determined whether the amount of data in the data table is greater than the set amount of data; if yes, then the size of the data table is greater than the set size; if no, then the size of the data table is not greater than the set size. According to the data synchronization strategy, the data table is synchronized from the core system to the backup system.
2. The data synchronization method for a dual-active system according to claim 1, characterized in that, The step of determining whether data synchronization between the core system and the backup system is needed based on the data table and data conditions further includes: Based on the data table and data conditions, query the records of the core system and the backup system regarding the data table and data conditions; Determine if the records of the two systems are consistent to determine whether data synchronization between the core system and the backup system is necessary.
3. The data synchronization method for a dual-active system according to claim 1, characterized in that, The step of determining the appropriate data synchronization strategy based on the size of the data table and whether the data table contains a non-partitioned index further includes: If the size of the data table is not greater than the set size, then the corresponding synchronization strategy is determined as follows: The core system stores the data table into a full file and writes the full file to a shared volume; The backup system reads all files from the shared volume and imports them into a designated table.
4. The data synchronization method for a dual-active system according to claim 1, characterized in that, The step of determining the appropriate data synchronization strategy based on the size of the data table and whether the data table contains a non-partitioned index further includes: If the size of the data table is greater than the set size, and the data table does not contain a non-partitioned index, then the corresponding synchronization strategy is determined as follows: In the core system, each partition of the data table stores a portion of the corresponding data table into a designated file in parallel, and then writes the designated file into a shared volume in parallel. The backup system reads the specified files from the shared volume in parallel and imports them into the specified table in parallel.
5. The data synchronization method for a dual-active system according to claim 1, characterized in that, The step of determining the appropriate data synchronization strategy based on the size of the data table and whether the data table contains a non-partitioned index further includes: If the size of the data table is greater than the set size, and the data table contains a non-partitioned index, then the corresponding synchronization strategy is determined as follows: In the core system, each partition of the data table stores a portion of the corresponding data table into a designated file in parallel, and then writes the designated file into a shared volume in parallel. The backup system reads the specified files from the shared volume in parallel and then imports them into the specified table in parallel. The backup system reorders the non-partitioned indexes in the specified table.
6. The data synchronization method for a dual-active system according to claim 1, characterized in that, Also includes: Record the moment when data synchronization between the core system and the backup system begins; After data synchronization between the core system and the backup system is completed, the backup system is hot-started before the stated time.
7. A data synchronization device for a dual-active system, characterized in that, The device includes: The monitoring module is used to monitor the backup system and capture abnormal information; The determination module is used to determine the data table where the abnormal information is located and the data conditions of the abnormal information based on the abnormal information. The judgment module is used to determine whether data synchronization between the core system and the backup system is required based on the data table and data conditions. The strategy definition module is used to determine the corresponding data synchronization strategy based on the partitioning of the data table when data synchronization is required. This includes: determining the size of the data table based on the number of partitions and the amount of data; determining the corresponding data synchronization strategy based on the size of the data table and whether the data table contains non-partitioned indexes; if the number of partitions in the data table is greater than a set number, then the size of the data table is greater than the set size; if the number of partitions in the data table is not greater than the set number, then it is determined whether the amount of data in the data table is greater than a set amount of data; if yes, then the size of the data table is greater than the set size; if no, then the size of the data table is not greater than the set size. The synchronization module is used to synchronize the data table from the core system to the backup system according to the data synchronization strategy.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, When the computer program is run by the processor, it executes the instructions of the method according to any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is run by the processor of the computer device, it executes the instructions of the method according to any one of claims 1-6.
10. A computer program product, characterized in that, When the computer program product is run by the processor of a computer device, it executes the instructions of the method according to any one of claims 1-6.