Database task disaster recovery method, device and system
By configuring primary and backup data source attributes for subtasks of database tasks, mapping tasks are generated and executed by the backup data center. This solves the problems of wasted computing resources and low execution efficiency of database tasks when nodes fail, and achieves task continuity and efficient execution.
Patent Information
- Application Number
- CN202410903232.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2026-01-09
AI Technical Summary
In existing technologies, when a database task fails due to the failure of one or more physical nodes in a data center, local data becomes unavailable, causing the task to fail. Furthermore, existing measures require the entire task to be re-executed, resulting in wasted computing resources and low execution efficiency.
Configure primary and backup data source properties for each subtask of the database task. If the first data center recorded in the primary data source property fails to execute, a mapping task is generated and executed by the second data center recorded in the backup data source property, thereby realizing the overall execution of the database task.
It eliminates the need to interrupt task execution, avoids wasting computing resources, improves task execution efficiency, ensures the continuity of database system tasks, and reduces the computing pressure on the main execution server.
Smart Images

Figure CN121300920A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of database, in particular to a database task disaster recovery method, device and system. BACKGROUND
[0002] The database-dependent tasks such as reconciliation, clearing and billing are usually composed of multiple sub-tasks, and such tasks are non-real-time tasks and can be implemented by offline data. The general process of such tasks is to start the task, extract data in the corresponding database according to the task, summarize the data, and then execute the corresponding task. That is, such tasks are based on successful data extraction. However, in a data architecture involving a large amount of data and many sub-databases, the failure of a certain or certain physical node of the data center is a high-probability event. Although non-real-time tasks can be completed by offline data, the failure of a certain or certain physical node will make the local data unavailable, and the business data stored in these physical nodes cannot be extracted, further leading to the failure of the task.
[0003] In the prior art, there is no effective rescue measure for the above situation, and the entire task usually needs to be re-executed on the standby database of the data center after the failure of the physical node is ruled out. Since the entire task is usually composed of multiple sub-tasks, this processing method makes the successfully executed sub-tasks need to be re-executed, which not only causes a great waste of computing resources and low efficiency of task execution, but also greatly affects the continuity of the data center in executing tasks. SUMMARY
[0004] The embodiments of the present application provide a database task disaster recovery method, device and system. The method adds a main data source attribute and a backup data source attribute to each sub-task of the database task. In the case that the first data center fails to execute a certain or certain sub-task, the second data center recorded in the backup data source attribute executes the mapping task corresponding to the failed sub-task, so that the other successfully executed sub-tasks do not need to be re-executed, and the execution of the entire database task is realized. The method does not need to interrupt the execution of the task, and overcomes or at least partially overcomes the defects of the prior art.
[0005] In a first aspect, a database task disaster recovery method is provided, which is executed by a task center. The method includes:
[0006] generating a database task of a first data center, wherein the database task includes multiple sub-tasks, and each sub-task includes a main data source attribute and a backup data source attribute;
[0007] making the first data center execute the database task according to the main data source attribute;
[0008] obtaining a mapping task from the first data center, the mapping task being generated by the first data center according to the backup data source attribute of the subtask that fails to be executed;
[0009] determining a second data center corresponding to the mapping task, and causing the second data center to execute the mapping task;
[0010] causing the total execution server to determine a final execution result of the database task according to the execution result of the database task of the first data center and the execution result of the mapping task.
[0011] Optionally, in the method, the database task is a subtask of a database total task, and each subtask of the database total task corresponds to a different data center; and the method further comprises:
[0012] causing the total execution server to determine a final execution result of the database total task according to the final execution result of each database task.
[0013] Optionally, in the method, generating the database task of the first data center comprises:
[0014] determining a plurality of master databases where task data is located, the task data being business data required for executing the database task;
[0015] determining a subtask corresponding to each master database, and determining a master data source attribute of the corresponding subtask according to the attribute of each master database;
[0016] determining a backup data source attribute of the subtask corresponding to each master database according to the attribute of the backup database of each master database.
[0017] Optionally, in the method, determining the second data center corresponding to the mapping task comprises:
[0018] determining the second data center according to the master data source attribute of the mapping task.
[0019] Optionally, the method further comprises:
[0020] obtaining a new mapping task from the second data center, the new mapping task being generated by the second data center according to the backup data source attribute of the mapping task that fails to be executed;
[0021] determining a third data center corresponding to the new mapping task, and causing the third data center to execute the new mapping task;
[0022] causing the total execution server to determine a final execution result of the database task according to the execution result of the database task of the first data center and the execution result of the new mapping task.
[0023] Optionally, in the method, the database corresponding to the standby data source attribute of the subtask is a local backup of the database corresponding to the main data source attribute of the subtask.
[0024] The database corresponding to the standby data source attribute of the mapping task is a remote backup of the database corresponding to the main data source attribute of the subtask.
[0025] In a second aspect, a disaster recovery method of a database task is provided, which is executed by a data center, and the method comprises:
[0026] Obtaining a database task from a task center, wherein the database task comprises a plurality of subtasks, each subtask comprising a main data source attribute and a standby data source attribute;
[0027] Executing each subtask according to the main data source attribute;
[0028] If there is a failed subtask, generating a mapping task according to the standby data source attribute of the failed subtask;
[0029] Returning the mapping task to the task center, so that the task center determines a data center corresponding to the mapping task and makes the data center execute the mapping task;
[0030] Returning a database task execution result to a total execution server, so that the total execution server determines a final execution result of the database task according to the database task execution result and an execution result of the mapping task.
[0031] Optionally, the method further comprises:
[0032] Obtaining a mapping task from the task center and returning an execution result of the mapping task to the task center.
[0033] Optionally, in the method, the mapping task comprises a main data source attribute and a standby data source attribute, and the method further comprises:
[0034] If the mapping task fails, generating a new mapping task according to the standby data source attribute of the mapping task;
[0035] Returning the generated new mapping task to the total execution server, so that the task center determines a new data center corresponding to the new mapping task and makes the new data center execute the new mapping task.
[0036] Optionally, in the method, obtaining a mapping task from the task center comprises:
[0037] Determining whether there is a mapping task of the data center in the task center at the end of a period, and if there is, pulling the mapping task from the task center.
[0038] Optionally, in the method, performing each subtask according to the master data source attribute comprises:
[0039] determining a database corresponding to each subtask according to the master data source attribute;
[0040] extracting data required by each subtask from the database respectively, and performing the corresponding subtask according to the extracted data;
[0041] if the data extraction from the database fails or the corresponding subtask execution according to the extracted data fails, determining the subtask as a failed subtask.
[0042] In a third aspect, a disaster recovery server of a database task is provided, which is applied to a task center, and the disaster recovery server is configured to perform any of the methods performed by the task center.
[0043] In a fourth aspect, a disaster recovery device of a database task is provided, which is applied to a data center, and the disaster recovery device is configured to perform any of the methods performed by the data center.
[0044] In a fifth aspect, a disaster recovery system of a database task is provided, which includes a task center, a plurality of data centers, and a total execution server, the task center is communicatively connected to the total execution server and each data center;
[0045] The task center is deployed with the disaster recovery server of the database task, and each data center is deployed with the disaster recovery device of the database task.
[0046] The total execution server is configured to determine a final execution result of the database task according to the database task execution result of the first data center and the execution result of the mapping task.
[0047] In a sixth aspect, the embodiments of the present application further provide an electronic device, which includes a processor and a memory arranged to store computer executable instructions, the executable instructions, when executed, causing the processor to perform any of the methods.
[0048] In a seventh aspect, the embodiments of the present application further provide a computer readable storage medium, which stores one or more programs, the one or more programs, when executed by an electronic device including a plurality of application programs, causing the electronic device to perform any of the methods.
[0049] The above at least one technical scheme adopted by the embodiments of the present application can achieve the following beneficial effects:
[0050] The application configures a main data source attribute and a backup data source attribute through each subtask of a database task, in the case that a certain subtask recorded in the main data source attribute fails in a first data center, receives a mapping task generated by the first data center according to the subtask and the backup data source attribute corresponding to the subtask, and makes a second data center execute the mapping task, so as to realize the execution of the whole database task. In the case that a certain or some subtasks of the database task fail, the application only needs to make the backup database executing the mapping task of the subtask to realize the execution of the whole database task, without interrupting the execution of the task in the whole process, ensuring the continuity of the execution of the database system, and the efficiency of the task execution is high; the subtasks that have been successfully executed do not need to be re-executed, and the waste of computing resources is avoided, and the utilization rate of computing resources is high; the disaster recovery capability of the data center is significantly improved, the process of summarizing and reporting the data between the databases of all the database tasks is saved, the task execution time is reduced, the task execution time is saved, and each subtask is executed by each data center, reducing the computing pressure of the total execution server. BRIEF DESCRIPTION OF DRAWINGS
[0051] The drawings described herein are used to provide further understanding of the application, and form a part of the application. The illustrative embodiments of the application and their descriptions are used to explain the application, and do not constitute an improper limitation on the application. In the drawings:
[0052] Figure 1 A business process schematic diagram of a reconciliation task according to the prior art is shown;
[0053] Figure 2 A schematic diagram of extracting data from multiple data centers according to the prior art is shown;
[0054] Figure 3 A flowchart of a disaster recovery method of a database task according to an embodiment of the application is shown;
[0055] Figure 4 A flowchart of a disaster recovery method of a database task according to another embodiment of the application is shown;
[0056] Figure 5 A structural schematic diagram of a disaster recovery server of a database task according to an embodiment of the application is shown;
[0057] Figure 6 A structural schematic diagram of a disaster recovery method of a database task according to another embodiment of the application is shown;
[0058] Figure 7 A structural schematic diagram of a disaster recovery device of a database task according to an embodiment of the application is shown;
[0059] Figure 8 Fig. 1 shows a structure diagram of a disaster recovery system of a database task according to an embodiment of the present application;
[0060] Figure 9 Fig. 2 shows a structure diagram of an electronic device according to an embodiment of the present application.
[0061] Figure 10 Fig. 3 shows a structure diagram of an electronic device according to another embodiment of the present application. DETAILED DESCRIPTION
[0062] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be described clearly and completely below with reference to the embodiments of the present application and corresponding drawings. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0063] The technical solutions provided by the embodiments of the present application will be described in detail below with reference to the drawings.
[0064] In the prior art, some database-dependent tasks can be completed by offline data, such as clearing, reconciliation, settlement and the like. Taking the reconciliation task as an example, the process of such non-real-time tasks will be briefly described as follows. Figure 1 As shown in Fig. 1, Figure 1 Fig. 1 shows a business process diagram of a reconciliation task according to the prior art. As can be seen from Figure 1 After the clearing is completed, the reconciliation task is started, and the reconciliation data corresponding to the reconciliation task is extracted from the database (here, the database is a general concept, and does not refer to a specific database). After the corresponding reconciliation data is obtained, the subsequent steps are performed, such as executing the reconciliation task by using an application capable of batch executing tasks. That is, the success of data extraction is the basis for the success of such tasks.
[0065] All data of a reconciliation task is usually not stored in the same database (a narrow concept) or the same physical node (the database server hardware of a data center can be referred to as a physical node, and one or more databases can be deployed in a physical node, and usually one database). Even not stored in the same data center, such as part of the data of a database task is stored in data center IDC10 and part of the data is stored in data center IDC20. Therefore, the data extraction performed here is not from one physical node or one database of a data center, but from multiple physical nodes or multiple databases or even multiple data centers.
[0066] The existing data center is usually a multi-site multi-center architecture, such as two sites and three centers or three sites and six centers. Taking two sites and three centers as an example, three data centers are set up in two cities, two data centers in the same city, and three data centers interconnected to form a data center cluster. Taking data center IDC10 in A site as an example, in addition to itself, another data center IDC11 is set up in A site, and data center IDC20 is set up in B site. The three are backup libraries, that is, the data of IDC10, IDC11 and IDC20 are consistent.
[0067] Taking three sites and six centers as an example, data center IDC10 and data center IDC11 are set up in A site, data center IDC20 and data center IDC21 are set up in B site, and data center IDC30 and data center IDC31 are set up in C site. Among the six data centers, the six centers can be backup libraries, or three can be backup libraries, and the other three can be backup libraries. It should be noted that the backup relationship between data centers is not limited to the above examples.
[0068] Figure 2 A schematic diagram of extracting data from multiple data centers according to the prior art is shown, from Figure 2 It can be seen that data is extracted from each physical node of each data center first, and then the data is collected at the library level, that is, the data of a data center is collected together, and then the data is sent to the data server connected to the entire data center cluster; the data server collects the data uploaded by multiple data centers between libraries, that is, the data of each data center is collected together, and then sent to the total execution server, and the total execution server executes the corresponding task according to the collected data. It can be seen that the successfully collected data set is the basis for executing the task.
[0069] If a data center or a physical node has a downtime event, data extraction from the data center or the physical node will fail or data errors will occur, resulting in overall data extraction failure or failure of sub-tasks dependent on the physical node, further causing overall database task execution failure.
[0070] In the prior art, in this case, the whole database task can only be interrupted, if the database task is to be continued, the database task can only be re-executed after the failure of the physical node is eliminated; or the database task can be re-executed on the standby database of the data center (local standby database or remote standby database) where the database task is executed. No matter which way is taken, the execution of the database task must be interrupted and re-executed. A task is usually composed of multiple sub-tasks, and the failure of the whole task is usually caused by the failure of one or more sub-tasks. In the prior art, the whole task is re-executed, and some sub-tasks that have been successfully executed still need to be re-run, which causes a great waste of computing resources. On the other hand, the database task is interrupted, which seriously affects the progress and continuity of the execution of the database task, and causes low efficiency of task execution.
[0071] In view of the defects of the prior art, the present application provides a database task disaster recovery method. When a database task is generated, a main data source attribute and a standby data source attribute are configured in each sub-task of the database task. First, the first data center recorded in the main data source attribute executes the database task. If the execution fails, the first data center generates a mapping task corresponding to the failed sub-task according to the failed sub-task and the standby data source attribute of the sub-task, so that the second data center recorded in the standby data source attribute can execute the mapping task, thereby realizing the successful execution of the whole database task. This method avoids the waste of computing resources, low efficiency of task execution, and low continuity caused by interrupting and re-executing the database task. On the other hand, it is not necessary to perform inter-database aggregation of data of multiple data centers, which saves the task execution time, and each sub-task is executed by each data center, which reduces the computing pressure of the total execution server.
[0072] Figure 3 A flowchart of a database task disaster recovery method according to an embodiment of the present application is shown. The method is executed by a task center, from Figure 3 It can be seen that the present application at least includes steps S310-S350:
[0073] Step S310: generating a database task of a first data center, wherein the database task includes multiple sub-tasks, and each sub-task includes a main data source attribute and a standby data source attribute.
[0074] This embodiment describes the present application from the task center side. It should be noted that in the present application, the task center is in communication connection with the total execution server of the inter-database, the task center is used to manage various tasks, and the total execution service is used to execute the inter-database task; a library-level center execution server is also provided in each data center, which is used to execute the library-level task; a node-level node execution server is also provided in the physical node of the data center, which is used to execute the task of the corresponding physical node.
[0075] The main application object of the present application is a non-real-time database task that can be completed by using offline data, including but not limited to clearing, reconciliation, billing and other tasks. When the present application is executed, data extraction is required. Since the data of the online database is constantly changing, the extracted data may have changed when data extraction is performed, resulting in that it does not completely match the database task. Therefore, the present application is mainly applicable to non-real-time tasks.
[0076] Taking a two-site three-center data center architecture as an example, the three data centers are denoted as data center A, data center B and data center C. In a normal case, the three data centers are backup to each other, and all data of the database task is stored in one data center. In this case, a database task of any one of the three data centers is generated first, such as the database task of data center A. Data center A includes multiple database servers, which are referred to as physical nodes. One or more databases can be deployed on one physical node.
[0077] The database task includes multiple subtasks. In a normal case, one subtask corresponds to one physical node or one database of the data center. It is assumed that one database is deployed in one physical node, that is, one subtask corresponds to one physical node, and the data of one subtask is stored in the physical node corresponding to the subtask.
[0078] The main data source attribute and the backup data source attribute are configured for each subtask. In the embodiment, the main data source attribute includes the information of data center A, the information of the physical node corresponding to each subtask, and the information of the database where the data of the subtask is stored, and the like, such as the access address and port of data center A, the serial number of the physical node, the address and name of the database, and the like. Through these information, the physical node corresponding to one subtask and the database where the required data is stored can be exactly known. In the embodiment, it is assumed that the database task T includes subtask a, subtask b and subtask c. In the main data source attribute, subtask a corresponds to physical node Aa of data center A, subtask b corresponds to physical node Ab of data center A, and subtask c corresponds to physical node Ac of data center A.
[0079] The standby data source attribute also includes the above information, and for a subtask, the standby data source attribute usually includes information of at least one data center, at least one physical node in the data center, and a database in the physical node. In this embodiment, taking the subtask a as an example, in the standby data source attribute, it is assumed that the subtask a corresponds to the physical node Ba of the data center B, the subtask a also corresponds to the physical node Ca of the data center C; the subtask b corresponds to the physical node Bb of the data center B, the subtask b also corresponds to the physical node Cb of the data center C; and the subtask c corresponds to the physical node Bc of the data center B, and the subtask c also corresponds to the physical node Cc of the data center C. The physical node Aa, the physical node Ba and the physical node Ca are mutual standby databases; the physical node Ab, the physical node Bb and the physical node Cb are mutual standby databases; and the physical node Ac, the physical node Bc and the physical node Cc are mutual standby databases.
[0080] Step S320: causing the first data center to execute the database task according to the master data source attribute.
[0081] In the prior art, if the database task is in the first data center, the data extracted from each physical node of the first data center needs to be summarized, and then subsequent steps such as reconciliation according to the data are uniformly executed.
[0082] Different from the prior art, in the present application, only the data of each physical node needs to be summarized, or the data of each physical node needs to be summarized at the database level. The execution of the database task can be executed by the center execution server arranged in the data center, or can be executed by the node execution server arranged in the physical node.
[0083] Taking the execution of each subtask in the corresponding physical node as an example, in each physical node, a database and a node execution server are arranged in communication connection, the database stores data required for executing the subtask, and the node execution server is used to execute the task pushed down or actively pulled to the physical node. Specifically, the node execution server pulls corresponding business data from the database according to the subtask, and then executes the subtask according to the business data.
[0084] In this embodiment, the node execution server of the physical node Aa of the data center A executes the subtask a, and the node execution server of the physical node Ab of the data center A executes the subtask b, and the node execution server of the physical node Ac of the data center A executes the subtask c.
[0085] If each subtask is successfully executed, the data center A returns the execution result of each subtask to the total execution server. After the total execution server obtains the execution result of each task, the total execution server summarizes the results together to form the final execution result of the database task.
[0086] It should be noted that in the present application, the total execution server is used to determine the final execution of the database task according to the execution result of the subtask, which can be set in the task center or independent of the task center, and the present application does not make any limitation.
[0087] The specific logic of the database task execution is the same as the prior art, and the specific execution method can refer to the prior art.
[0088] If there is a subtask or several subtasks that fail to execute, the data center where the subtask is located, specifically the node execution server of the physical node, generates a mapping task for the subtask according to the subtask and its backup data source attribute, and sends the mapping task to the task center. The physical nodes where the other subtasks are executed successfully report the execution results to the task center.
[0089] In the present embodiment, it is assumed that the subtask a fails to execute, and the subtasks b and c are successfully executed. In this case, the physical node Aa can generate a mapping task for the subtask a according to the backup data source attribute of the subtask a. Specifically, since the physical node Aa has two backup databases, it can generate one mapping task or two mapping tasks. Taking the generation of one mapping task as an example, the mapping task contains the data source attribute. Specifically, the data source attribute contains the primary data source attribute and the backup primary data source attribute. The primary data source attribute records one backup database of the physical node Aa, and the backup primary data source attribute records the other backup database of the physical node Aa.
[0090] Taking the generation of two mapping tasks as an example, the two mapping tasks are parallel and are denoted as the first mapping task a1 and the second mapping task a2. The first mapping task a1 and the second mapping task a2 both contain the data source attribute. Specifically, the first mapping task a1 and the second mapping task a2 both only have the primary data source attribute. The primary data source attribute of the first mapping task a1 records one backup database of the physical node Aa, and the primary data source attribute of the second mapping task a2 records the other backup database of the physical node Aa. In the present embodiment, the following describes the generation of two parallel mapping tasks at the same time as an example.
[0091] Taking the execution of each subtask by the center execution server as an example, in this case, the data can be aggregated or not. If an application capable of batch executing tasks is used, the data needs to be aggregated. In the case of not aggregating, each subtask can be executed in parallel.
[0092] When each subtask is executed by the center execution server, the generation of the above mapping task can also be executed by the center execution server.
[0093] Step S330: obtaining the mapping task from the first data center, the mapping task being generated by the first data center according to the backup data source attribute of the subtask whose execution fails.
[0094] As mentioned above, the task center obtains the first mapping task a1 and the second mapping task a2 sent by the first data center, and the obtaining process can be that the task center actively pulls in the first data center, or that the first data center actively sends to the task center.
[0095] It should be noted here that the first mapping task and the second mapping task are independent of each other, but the first mapping task and the second mapping task do not need to be parallel, and therefore a trigger condition or a sending condition can be set for the first mapping task and the second mapping task to avoid the first mapping task and the second mapping task being executed at the same time. The trigger condition and the sending condition are not limited by the present application, and can be set at the task center end or at the data center end.
[0096] For example, the first data center sends the first mapping task to the task center first, and the task center actively pulls in the first data center to obtain the second mapping task in the case that the first mapping task also fails to be executed; or the task center notifies the first data center of the message that the first mapping task fails to be executed, so that the first data center sends the second mapping task.
[0097] For another example, the first data center sends the first mapping task and the second mapping task to the task center together, but the task center only issues the first mapping task first, and issues the second mapping task in the case that the first mapping task also fails to be executed.
[0098] Step S340: determining the second data center corresponding to the mapping task, so that the second data center executes the mapping task. Taking the first mapping task a1 as an example, the task center determines the second data center according to the information in the first mapping task after receiving the first mapping task, and in this embodiment, specifically, according to the data source attribute of the first mapping task a1, it is determined that the execution subject of the first mapping task a1 is the data center B, specifically, the physical node Ba of the data center B, and then the physical node Ba of the data center B is caused to execute the first mapping task a1.
[0099] Specifically, the task center can directly send the first mapping task a1 to the physical node Ba of the data center B to make it execute the first mapping task a1, or can issue an instruction to make the data center B actively pull the task from the task center.
[0100] The physical node Ba of the data center B returns the execution result to the total execution server after executing the first mapping task a1.
[0101] Step S350: The total execution server determines the final execution result of the database task according to the database task execution result of the first data center and the execution result of the mapping task.
[0102] Finally, the total execution server determines the final execution result of the database task according to the database task execution result of the first data center and the execution result of the mapping task.
[0103] The total execution server respectively acquires the execution results of the subtask b and the subtask c reported by the data center A, and the execution result of the first mapping task a1 reported by the data center B.
[0104] If the execution result of the first mapping task a1 is also successful, the execution results of the first mapping task a1, the subtask b and the subtask c are summarized as the final execution result of the database task.
[0105] If the execution result of the first mapping task a1 is failure, if there is no second mapping task, it is determined that the database task is executed in failure; in the case that there is a second mapping task, the task center can issue the second mapping task to the third data center, in this embodiment, the task center can issue the second mapping task a2 to the physical node Ca of the data center C, so that the physical node Ca executes the second mapping task a2, and returns the execution result to the total execution server.
[0106] The total execution server respectively acquires the execution results of the subtask b and the subtask c reported by the data center A, and the execution result of the first mapping task a2 reported by the data center C.
[0107] If the execution result of the second mapping task a2 is successful, the execution results of the second mapping task a2, the subtask b and the subtask c are summarized as the final execution result of the database task; if the execution result of the second mapping task a2 is failure, it is determined that the database task is executed in failure. It should be noted that the probability of all standby databases of a master database being simultaneously down is very small, and the scenario that all mapping tasks are executed in failure is extremely rare, therefore, the database task will be executed successfully in most cases.
[0108] From Figure 3The method shown can be seen that the application configures the master data source attribute and the backup data source attribute by each subtask of the database task, in the case that the execution of a certain subtask in the first data center recorded in the master data source attribute fails, receives the mapping task generated by the first data center according to the subtask and the backup data source attribute corresponding to the subtask, and makes the second data center execute the mapping task, to realize the execution of the whole database task. In the case that the execution of a certain or some subtasks of the database task fails, the application only needs to make the backup database executing the mapping task of the subtask to realize the execution of the whole database task, without interrupting the execution of the task in the whole process, ensuring the continuity of the execution of the database system, and the efficiency of the task execution is high; and the subtasks that have been executed successfully do not need to be executed again, and the waste of computing resources is avoided, and the utilization rate of computing resources is high; the disaster recovery capability of the data center is significantly improved, the process of inter-database aggregation and reporting of all data of the database task is saved, the task execution time is reduced, the task execution time is saved, and each subtask is executed by each data center, reducing the computing pressure of the total execution server.
[0109] The above case is the scenario of the database task in the same data center. In actual scenarios, most of them are the above cases. However, there is also a scenario that the data of the database total task is in multiple data centers. Taking a three-place six-center data architecture as an example, it is assumed that data center IDC10 and data center IDC11 are provided in A place, data center IDC20 and data center IDC21 are provided in B place, and data center IDC30 and data center IDC31 are provided in C place. Among the six data centers, IDC10, IDC11 and IDC20 are backup databases of each other, and IDC21, IDC30 and IDC31 are backup databases of each other. It should be noted that the backup relationship between data centers is not limited to the above example.
[0110] In some embodiments of the application, in the above method, the database task is a subtask of the database total task, and each subtask of the database total task corresponds to a different data center; the method further comprises: making the total execution server determine the final execution result of the database total task according to the final execution result of each database task.
[0111] The data of the database total task is partially stored in data center IDC10 and partially stored in data center IDC21. In this case, the task center first performs one-level decomposition on the database total task to decompose the database task into database tasks of different data centers. It is assumed that the database task T is decomposed into the database task A1 of data center IDC10 and the database task A2 of data center IDC21. Each database task contains one or more subtasks, and each subtask contains a master data source attribute and a backup data source attribute.
[0112] After receiving the database task Al, the data center IDC 10 executes according to the foregoing method, and obtains the final execution result of the database task Al. If the subtask in the database task Al fails, the backup database of the data center IDC 10, such as the data center IDC 11, can be determined according to the backup data source attribute of the subtask, and the subtask is executed. The foregoing has been described in detail, and will not be described here.
[0113] Similarly, after receiving the database task A2, the data center IDC 21 executes according to the foregoing method, and obtains the final execution result of the database task A2.
[0114] Finally, the total execution server collects the execution results of the database tasks of each data center, and takes the collected result as the final execution result of the database total task. In this embodiment, the final execution result of the database task Al and the final execution result of the database task A2 are collected to obtain the final execution result of the database total task T.
[0115] In some embodiments of the present application, generating the database task of the first data center includes: determining a plurality of master databases where the task data is located, the task data being business data required for executing the database task; determining a subtask corresponding to each master database, determining the master data source attribute of the corresponding subtask according to the attribute of each master database; and determining the backup data source attribute of the subtask corresponding to each master database according to the attribute of the backup database of each master database.
[0116] In some embodiments of the present application, when generating the database task, the master database where the business data of the data task is located can be directly generated. Specifically, first, it is determined that the business data of the database task is stored in which master databases, such as master database a, master database b and master database c. Then, the task related to the business data in one master database is determined as a subtask, that is, one subtask corresponds to one master database, such as three subtasks, subtask a, subtask b and subtask c, are generated. Subtask a corresponds to master database a, and the business data required for executing subtask a is stored in master database a. Similarly, subtask b corresponds to master database b, and the business data required for executing subtask b is stored in master database b. Subtask c corresponds to master database b, and the business data required for executing subtask b is stored in master database c.
[0117] In each subtask, the master data source attribute and the backup data source attribute are recorded. As the name implies, the master data source attribute represents the information of the master database where the business data of the subtask is located, and the master data source attribute is determined according to the attribute of the master database corresponding to the subtask. The attribute of the database includes the database name and address, the physical node serial number where the database is located and the like.
[0118] Then, the standby data source attribute of the subtask is configured. First, at least one standby database of the main database corresponding to the subtask and the information of the standby database are determined, and then the standby database attribute of the subtask is determined according to the information of the standby database. In the case where the main database has multiple standby databases, it is preferred that all the standby database information is recorded in the standby database attribute, so as to avoid the case where the mapping task fails to be executed due to the failure of the standby database.
[0119] That is, if the main database recorded in the main data source attribute of a subtask has only one standby database, the standby database recorded in the standby data source attribute of the subtask is consistent with the database recorded in the main data source attribute of the mapping task; if the main database has multiple standby databases, the database recorded in the main data source attribute of the mapping task is one of the standby databases recorded in the standby data source attribute of the subtask corresponding to the mapping task.
[0120] In the case where multiple standby databases are recorded in the standby data source attribute, multiple mapping tasks can be generated as in the foregoing case, another mapping task is issued in the case where one mapping task fails to be executed; or the information of a secondary mapping task can be recorded in the mapping task, that is, the foregoing case where one mapping task is generated in the case where the standby database has multiple standby databases. For example, a subtask a corresponding to a main database a has two standby databases, standby database b and standby database c, in the standby data source attribute thereof, a first mapping task a1 is generated according to the information of one of the standby databases, for example, the information of the standby database b, the first mapping task a1 also includes a main data source attribute and a standby database attribute, the main data source attribute is generated according to the information of the standby database b, and the standby database attribute is generated according to the information of the standby database c.
[0121] If the first mapping task a1 also fails to be executed, the node server where the standby database b is located can generate a mapping task of the first mapping task a1 according to the standby database attribute in the first mapping task a1, which is recorded as a second mapping task a2, and return the second mapping task a2 to the task center. This task generation method does not need to generate the second mapping task a2 in the case where the first mapping task a1 is successfully executed, and avoids the setting of the issuing time or the sending time, and therefore, the calculation resource is further saved compared with the foregoing method.
[0122] In this case, the method further comprises: obtaining a new mapping task from the second data center, the new mapping task being generated by the second data center according to the backup data source attribute of the failed mapping task; determining a third data center corresponding to the new mapping task, and causing the third data center to execute the new mapping task; and causing the task execution server to determine a final execution result of the database task according to the database task execution result of the first data center and an execution result of the new mapping task.
[0123] That is, after receiving the second mapping task a2, the task center determines a third data center corresponding to the second mapping task a2, and in this embodiment, the third data center is the data center where the backup database c is located, and causes the data center where the backup database c is located to execute the second mapping task a2; finally, the total execution server aggregates the execution result of the second mapping task a2 and the execution results of other subtasks to determine the final execution result of the database task.
[0124] In the determination of the second data center corresponding to the mapping task, the second data center can be directly determined according to the primary data source attribute of the mapping task, that is, the data center where the primary database recorded by the primary data source attribute of the mapping task is located is the second data center.
[0125] In some embodiments of the present application, the database corresponding to the backup data source attribute of the subtask is a local backup of the database corresponding to the primary data source attribute of the subtask; and the database corresponding to the backup data source attribute of the mapping task is a remote backup of the database corresponding to the primary data source attribute of the subtask.
[0126] That is, in the case of a failed subtask, the local backup is preferred as the second data center to execute the mapping task of the subtask, and the remote backup is the second choice as the second data center or the third data center to execute the mapping task of the subtask or the secondary mapping task of the mapping task. The local backup is closer to the first data center in geographical position, has better communication quality, and requires less time for data transmission, so the local backup is preferred to execute the mapping task.
[0127] Figure 4 A flowchart of a database task disaster recovery method according to another embodiment of the present application is shown in FIG. 3. As shown in FIG. 3, the embodiment comprises: Figure 4
[0128] generating a database task of a first data center, wherein the database task comprises a plurality of subtasks, each subtask comprises a primary data source attribute and a backup data source attribute, and causing the first data center to execute each subtask according to the primary data source attribute.
[0129] determining whether there is a failed subtask, and if not, causing the total execution server to determine a final execution result of the database task according to a database task execution result of the first data center.
[0130] If the first mapping task exists, the first mapping task is obtained from the first data center, and the first mapping task is generated by the first data center according to the backup data source attribute of the subtask of the execution failure. The second data center corresponding to the first mapping task is determined, the first mapping task is assigned to the second data center, and the second data center is caused to execute the mapping task.
[0131] If the first mapping task is successful, the total execution server is caused to determine the final execution result of the database task according to the database task execution result of the first data center and the execution result of the first mapping task of the second data center.
[0132] If the first mapping task is not successful, the second mapping task is obtained from the second data center, and the second new mapping task is generated by the second data center according to the backup data source attribute of the mapping task of the execution failure. The third data center corresponding to the second mapping task is determined, the second mapping task is assigned to the third data center, and the third data center is caused to execute the mapping task.
[0133] The total execution server is caused to determine the final execution result of the database task according to the database task execution result of the first data center, the execution result of the first mapping task of the second data center, and the execution result of the second mapping task of the third data center.
[0134] Figure 5 A database task disaster recovery device server according to an embodiment of the application is shown, which is applied to a task center, and the disaster recovery service is applied to a database task. Figure 5 It can be seen that the device 500 comprises:
[0135] The original task generation unit 510 is configured to generate a database task of a first data center, wherein the database task comprises a plurality of subtasks, and each subtask comprises a main data source attribute and a backup data source attribute.
[0136] This embodiment is described from the task center end, and it should be noted that in the present application, the task center is in communication connection with the total execution server of the library, the task center is used for managing various tasks, and the total execution service is used for executing the task between the libraries; In each data center, a library-level center execution server is also provided, which is used for executing a library-level task; A node-level node execution server is also provided in the physical node of the data center, which is used for executing the task of the corresponding physical node.
[0137] The main application object of the present application is a non-real-time database task which can be completed by offline data, including but not limited to clearing, reconciliation, billing and other tasks. When the present application is executed, data extraction is required. Since the data of the online database is constantly changing, the extracted data may have changed when data extraction is performed, resulting in that it does not completely match the database task. Therefore, the present application is mainly applicable to non-real-time tasks.
[0138] Taking a two-site three-center data center architecture as an example, the three data centers are denoted as data center A, data center B and data center C. In general, the three data centers are backup libraries of each other, and all data of the database task is stored in one data center. In this case, a database task of any one of the three data centers is generated first, such as the database task of data center A. Data center A includes multiple database servers, which are referred to as physical nodes. One or more databases can be deployed on one physical node.
[0139] The database task includes multiple subtasks. In general, one subtask corresponds to one physical node or one database of the data center. It is assumed that one database is deployed in one physical node, that is, one subtask corresponds to one physical node, and the data of one subtask is stored in the physical node corresponding to the subtask.
[0140] The master data source attribute and the backup data source attribute are configured for each subtask. In the present embodiment, the master data source attribute includes the information of data center A, the information of the physical node corresponding to each subtask, and the information of the database where the data of the subtask is stored, etc. For example, the access address and port of data center A, the serial number of the physical node, the address and name of the database, etc. Through these information, the physical node corresponding to one subtask and the database where the required data is stored can be exactly known. In the present embodiment, it is assumed that the database task T includes subtask a, subtask b and subtask c. In the master data source attribute, subtask a corresponds to physical node Aa of data center A, subtask b corresponds to physical node Ab of data center A, and subtask c corresponds to physical node Ac of data center A.
[0141] The backup data source attribute also includes the above information, and for a subtask, the backup data source attribute usually includes information of at least one data center, at least one physical node in the data center, and a database in the physical node. In this embodiment, taking the subtask a as an example, in the backup data source attribute, it is assumed that the subtask a corresponds to the physical node Ba of the data center B, and the subtask a also corresponds to the physical node Ca of the data center C; the subtask b corresponds to the physical node Bb of the data center B, and the subtask b also corresponds to the physical node Cb of the data center C; the subtask c corresponds to the physical node Bc of the data center B, and the subtask c also corresponds to the physical node Cc of the data center C. The physical node Aa, the physical node Ba and the physical node Ca are backup databases of each other; the physical node Ab, the physical node Bb and the physical node Cb are backup databases of each other; and the physical node Ac, the physical node Bc and the physical node Cc are backup databases of each other.
[0142] The enabling unit 520 is configured to enable the first data center to execute the database task according to the master data source attribute.
[0143] In the prior art, if the database task is in the first data center, the data extracted from each physical node of the first data center needs to be summarized, and then subsequent steps such as reconciliation according to the data are uniformly executed.
[0144] Different from the prior art, in the present application, only the data of each physical node needs to be summarized, or the data of each physical node needs to be summarized at the database level. The execution of the database task can be executed by the center execution server arranged in the data center, or can be executed by the node execution server arranged in the physical node.
[0145] Taking the execution of each subtask in the corresponding physical node as an example, in each physical node, a database and a node execution server are arranged in communication connection, the database stores data required for executing the subtask, and the node execution server is used to execute the task pushed down or actively pulled to the physical node. Specifically, the node execution server pulls corresponding business data from the database according to the subtask, and then executes the subtask according to the business data.
[0146] In this embodiment, the node execution server of the physical node Aa of the data center A executes the subtask a, and the node execution server of the physical node Ab of the data center A executes the subtask b, and the node execution server of the physical node Ac of the data center A executes the subtask c.
[0147] If each subtask is executed successfully, the data center A returns the execution result of each subtask to the total execution server. After the total execution server obtains the execution result of each task, the total execution server aggregates the results together to form the final execution result of the database task.
[0148] It should be noted that in the present application, the total execution server is used to determine the final execution of the database task according to the execution result of the subtask, which can be set in the task center or independent of the task center, and the present application does not make any limitation.
[0149] The specific logic of the database task execution is the same as the prior art, and the specific execution method can refer to the prior art.
[0150] If there is a subtask or several subtasks that fail to execute, the data center where the subtask is located, specifically, the node execution server of the physical node, generates a mapping task of the subtask according to the subtask and the backup data source attribute, and sends the mapping task to the task center. The physical nodes where the other subtasks are executed successfully report the execution result to the task center.
[0151] In the present embodiment, it is assumed that the subtask a fails to execute, and the subtask b and the subtask c are executed successfully. In this case, the physical node Aa can generate a mapping task of the subtask a according to the backup data source attribute of the subtask a. Specifically, since the physical node Aa has two backup databases, one mapping task can be generated or two mapping tasks can be generated. Taking the generation of one mapping task as an example, the mapping task contains the data source attribute. Specifically, the data source attribute contains the primary data source attribute and the backup primary data source attribute. The primary data source attribute records one backup database of the physical node Aa, and the backup primary data source attribute records another backup database of the physical node Aa.
[0152] Taking the generation of two mapping tasks as an example, the two mapping tasks are parallel and are denoted as the first mapping task a1 and the second mapping task a2. The first mapping task a1 and the second mapping task a2 both contain the data source attribute. Specifically, the first mapping task a1 and the second mapping task a2 both only have the primary data source attribute. The primary data source attribute of the first mapping task a1 records one backup database of the physical node Aa, and the primary data source attribute of the second mapping task a2 records another backup database of the physical node Aa. In the present embodiment, the following describes the generation of two parallel mapping tasks at the same time as an example.
[0153] Taking the execution of each subtask in the center execution server as an example, in this case, the data can be aggregated or not aggregated. For example, if an application capable of batch execution of tasks is used, the data needs to be aggregated. In the case of no aggregation, each subtask can be executed in parallel.
[0154] The generation of the mapping task can also be performed by the central execution server when each subtask is executed by the central execution server.
[0155] The first obtaining unit 530 is configured to obtain a mapping task from the first data center, wherein the mapping task is generated by the first data center according to the backup data source attribute of the failed subtask.
[0156] As described above, the task center obtains the first mapping task a1 and the second mapping task a2 sent by the first data center, and the obtaining process can be that the task center actively pulls from the first data center or that the first data center actively sends to the task center.
[0157] It should be noted that the first mapping task and the second mapping task are independent of each other, but the first mapping task and the second mapping task do not need to be executed in parallel, and therefore a trigger condition or a sending condition can be set for the first mapping task and the second mapping task to avoid the first mapping task and the second mapping task being executed simultaneously. The trigger condition and the sending condition are not limited in the present application, and can be set on the task center side or on the data center side.
[0158] For example, the first data center sends the first mapping task to the task center first, and the task center actively pulls the second mapping task from the first data center in the case where the first mapping task also fails to be executed; or the task center notifies the first data center of the message that the first mapping task fails to be executed, so that the first data center sends the second mapping task.
[0159] For another example, the first data center sends the first mapping task and the second mapping task to the task center together, but the task center only issues the first mapping task first, and issues the second mapping task in the case where the first mapping task also fails to be executed.
[0160] The enabling unit 520 is configured to determine a second data center corresponding to the mapping task, and enable the second data center to execute the mapping task.
[0161] Here, the first mapping task a1 is taken as an example. After receiving the first mapping task, the task center determines the second data center according to the information in the first mapping task. In this embodiment, specifically, according to the data source attribute of the first mapping task a1, it is determined that the execution subject of the first mapping task a1 is the data center B, specifically, the physical node Ba of the data center B, and then the physical node Ba of the data center B is enabled to execute the first mapping task a1.
[0162] Specifically, the task center can directly send the first mapping task a1 to the physical node Ba of the data center B to enable the physical node Ba to execute the first mapping task a1, or can issue an instruction to enable the data center B to actively pull the task from the task center.
[0163] The physical node Ba of the data center B returns the execution result to the total execution server after executing the first mapping task a1.
[0164] The enabling unit 520 is configured to enable the total execution server to determine a final execution result of the database task according to the database task execution result of the first data center and the execution result of the mapping task.
[0165] Finally, the total execution server determines the final execution result of the database task according to the database task execution result of the first data center and the execution result of the mapping task.
[0166] The total execution server respectively acquires the execution results of the subtask b and the subtask c reported by the data center A and the execution result of the first mapping task a1 reported by the data center B.
[0167] If the execution result of the first mapping task a1 is also successful, the execution results of the first mapping task a1, the subtask b and the subtask c are summarized as the final execution result of the database task.
[0168] If the execution result of the first mapping task a1 is failure, if there is no second mapping task, it is determined that the database task is executed in failure; in the case where the second mapping task exists, the task center can issue the second mapping task to the third data center, in this embodiment, the task center can issue the second mapping task a2 to the physical node Ca of the data center C, so that the physical node Ca executes the second mapping task a2 and returns the execution result to the task center.
[0169] The total execution server respectively acquires the execution results of the subtask b and the subtask c reported by the data center A and the execution result of the first mapping task a2 reported by the data center C.
[0170] If the execution result of the second mapping task a2 is successful, the execution results of the second mapping task a2, the subtask b and the subtask c are summarized as the final execution result of the database task; if the execution result of the second mapping task a2 is failure, it is determined that the database task is executed in failure. It should be noted that the probability of all standby databases of a master database being simultaneously down is very small, and the scenario where all mapping tasks are executed in failure is extremely rare, therefore, the database task will be executed successfully in most cases.
[0171] In some embodiments of the present application, in the disaster recovery server, the database task is a subtask of a database total task, and the subtasks of the database total task correspond to different data centers; the enabling unit 520 is further configured to enable the total execution server to determine a final execution result of the database total task according to the final execution results of the database tasks.
[0172] In some embodiments of this application, in the disaster recovery server, the original task generation unit 510 is used to determine multiple master databases where task data is located, wherein the task data is business data required to execute the database task; determine sub-tasks corresponding to each master database, determine the master data source attributes of the corresponding sub-tasks according to the attributes of each master database; and determine the backup data source attributes of the corresponding sub-tasks of each master database according to the attributes of the backup databases of each master database.
[0173] In some embodiments of this application, in the disaster recovery server, the enabling unit 520 is used to determine the second data center based on the primary data source attribute of the mapping task.
[0174] In some embodiments of this application, in the disaster recovery server, the first acquisition unit 530 is further configured to acquire a new mapping task from the second data center, the new mapping task being generated by the second data center based on the backup data source attributes of the failed mapping task; the enabling unit 520 is further configured to determine the third data center corresponding to the new mapping task, and enable the third data center to execute the new mapping task; and enable the main execution server to determine the final execution result of the database task based on the database task execution result of the first data center and the execution result of the new mapping task.
[0175] In some embodiments of this application, in the disaster recovery server, the database corresponding to the backup data source attribute of the subtask is the same-city backup database of the database corresponding to the main data source attribute of the subtask.
[0176] The database corresponding to the backup data source attribute of the mapping task is a remote backup database of the database corresponding to the main data source attribute of the subtask.
[0177] It is understood that the disaster recovery server for the aforementioned database task can implement each step of the disaster recovery method for the database task executed by the task center provided in the foregoing embodiments. The relevant explanations of the disaster recovery method for the database task are applicable to the disaster recovery server and will not be repeated here.
[0178] The above provides a detailed description of this application from the task center perspective. The following section elaborates on this application from the data center perspective, such as... Figure 6 This diagram illustrates a disaster recovery method for a database task according to another embodiment of the present application. The method is executed by a data center. Since the present application has been described in detail above, only a brief introduction is given here. The method includes at least steps S610 to S640:
[0179] Step S610: Obtain the database task from the task center. The database task contains multiple subtasks, and each subtask contains the main data source attribute and the backup data source attribute.
[0180] The "acquiring" here can be waiting for the task center to issue, or can be actively acquiring from the task center, such as logging in the task center at the end of a preset period, determining whether there is a mapping task of the data center in the task center, and if so, pulling the mapping task from the task center.
[0181] The database task includes multiple sub-tasks, and each sub-task includes a main data source attribute and a backup data source attribute. Each sub-task corresponds to a physical node of a data center.
[0182] The data center that executes the method is referred to as a first data center.
[0183] Step S620: Each sub-task is executed according to the main data source attribute.
[0184] Each physical node in the data center executes a respective sub-task, and if the execution is successful, the execution result is returned to the task center.
[0185] Step S630: If there is a sub-task that fails to execute, a mapping task is generated according to the backup data source attribute of the sub-task that fails to execute.
[0186] If a sub-task fails to execute in a certain physical node, a mapping task of the sub-task is generated according to the backup data source attribute of the sub-task, and the mapping task includes a data source attribute, the data source attribute includes a main data source attribute, and in some embodiments, also includes a backup data source attribute.
[0187] Step S640: The mapping task is returned to the task center, so that the task center determines the data center corresponding to the mapping task, and makes the data center corresponding to the mapping task execute the mapping task.
[0188] The mapping task is returned to the task center, and after receiving the mapping task, the task center determines a second data center according to the mapping task, more specifically, determines the second data center according to the main data source attribute of the mapping task. The second data center is made to execute the mapping task, and the task execution server determines the final execution result of the database task according to the execution result of the mapping task.
[0189] Step S650: The database task execution result is returned to the total execution server, so that the total execution server determines the final execution result of the database task according to the database task execution result and the execution result of the mapping task.
[0190] The data center returns the database task execution result to the total execution server after executing the task, and the total execution server aggregates the execution results returned by each data center, including the execution results of each sub-task and the mapping task, to obtain the final execution result of the database task.
[0191] In some embodiments of the present embodiment, the method further comprises: obtaining a mapping task from the task center, and returning the execution result of the mapping task to the task center. The data center is also responsible for the execution of the mapping task and returns the execution result of the mapping task to the task center.
[0192] In some embodiments of the present application, in the case where there are multiple backup libraries in the first data center, the mapping task contains the master data source attribute and the backup data source attribute, and the method further comprises: if the mapping task fails, generating a new mapping task according to the backup data source attribute of the mapping task; returning the generated new mapping task to the task center, so that the task center determines the new data center corresponding to the new mapping task, makes the new data center execute the new mapping task, and makes the task execution server determine the final execution result of the database task according to the execution result of the new mapping task.
[0193] If the mapping task fails, the data center executing the mapping task can generate a secondary mapping task, i.e. a new mapping task, according to the backup data source attribute of the mapping task, and then return the new mapping task to the task center. The task center determines the new data center corresponding to the new mapping task, and makes the new data center execute the new mapping task.
[0194] In some embodiments of the present application, executing each subtask according to the master data source attribute comprises: determining the database corresponding to each subtask according to the master data source attribute; extracting the data required by each subtask from each database respectively, and executing the corresponding subtask according to the extracted data; if the data extraction from one database fails, or the execution of the corresponding subtask according to the extracted data fails, the subtask is determined as a failed subtask.
[0195] In some embodiments of the present application, when the data center executes the subtask, each data center can set a unified center execution server, or set a node execution server on each physical node. For example, when the center execution server is used to execute the database task, first, the database corresponding to each subtask is determined according to the master data source attribute, or the data required by each subtask is extracted from each database respectively. The data can be aggregated or not aggregated, and only the data of each subtask is aggregated. Then, the corresponding subtask is executed according to the extracted data. If the data is aggregated, batch running application can be used to execute the subtask to save time.
[0196] If the data extraction from one database fails, or the execution of the corresponding subtask according to the extracted data fails, the subtask is determined as a failed subtask. Successful data extraction is the basis for successful task execution. If the data extraction from one database fails, it means that the subtask fails. It is also possible that the subtask fails due to data changes or other reasons. In both cases, the subtask fails.
[0197] Figure 7 Fig. 7 shows a disaster recovery device of a database task according to an embodiment of the present application, which is applied to a data center, from Figure 7 As can be seen, the disaster recovery device 700 comprises a second acquisition unit 710 configured to acquire a database task from a task center, wherein the database task comprises a plurality of subtasks, and each subtask comprises a primary data source attribute and a backup data source attribute.
[0198] Here, the acquisition can be waiting for the task center to issue, or can be actively acquiring from the task center, such as logging into the task center at the end of a preset period to determine whether there is a mapping task of the data center in the task center, and if so, pulling the mapping task from the task center.
[0199] The database task comprises a plurality of subtasks, and each subtask comprises a primary data source attribute and a backup data source attribute. Each subtask corresponds to a physical node of a data center.
[0200] The data center that will execute the method is referred to as a first data center.
[0201] The execution unit 720 is configured to execute each subtask according to the primary data source attribute.
[0202] Each physical node in the data center executes its own subtask, and if the execution is successful, the execution result is returned to the task center.
[0203] The mapping task generation unit 730 is configured to, if there is a failed subtask, generate a mapping task according to the backup data source attribute of the failed subtask.
[0204] If a physical node fails to execute a subtask, a mapping task of the subtask is generated according to the backup data source attribute of the subtask, and the mapping task comprises a data source attribute, and the data source attribute comprises a primary data source attribute, and in some embodiments, also comprises a backup data source attribute.
[0205] The sending unit 740 is configured to return the mapping task to the task center, so that the task center determines the data center corresponding to the mapping task, makes the data center corresponding to the mapping task execute the mapping task, and determines the final execution result of the database task according to the execution result of the mapping task.
[0206] The mapping task is returned to the task center, and after receiving the mapping task, the task center determines a second data center according to the mapping task, and more specifically, determines the second data center according to the primary data source attribute of the mapping task. The second data center is made to execute the mapping task.
[0207] The result returning unit 750 returns the database task execution result to the total execution server, so that the total execution server determines the final execution result of the database task according to the database task execution result and the execution result of the mapping task.
[0208] The data center returns the database task execution result to the total execution server after executing the task, and the total execution server aggregates the execution results returned by the data centers, including the execution results of the subtasks and the mapping task, to obtain the final execution result of the database task.
[0209] In some embodiments of the present application, in the disaster recovery device, the second obtaining unit 710 is further configured to obtain the mapping task from the task center; and the sending unit 740 is further configured to return the execution result of the mapping task to the task center.
[0210] In some embodiments of the present application, in the disaster recovery device, the mapping task contains the master data source attribute and the backup data source attribute, the mapping task generating unit 730 generates a new mapping task according to the backup data source attribute of the mapping task if the execution of the mapping task fails; and the sending unit 740 is further configured to return the generated new mapping task to the task center, so that the task center determines a new data center corresponding to the new mapping task, makes the new data center execute the new mapping task, and determines the final execution result of the database task according to the execution result of the new mapping task.
[0211] In some embodiments of the present application, in the disaster recovery device, the second obtaining unit 710 is configured to determine whether there is a mapping task of the data center in the task center at the end of a preset period, and to pull the mapping task from the task center if there is.
[0212] In some embodiments of the present application, in the disaster recovery device, the execution unit 720 is configured to determine a database corresponding to each subtask according to the master data source attribute, to extract data required by each subtask from each database respectively, to execute the corresponding subtask according to the extracted data, and to determine that the subtask is a failed subtask if the data extraction from one database fails or the execution of the corresponding subtask according to the extracted data fails.
[0213] It can be understood that the above-mentioned disaster recovery device of the database task can implement each step of the disaster recovery method of the database task executed by the data center provided in the foregoing embodiments, and the related explanations about the disaster recovery method of the database task are all applicable to the disaster recovery device, which will not be described herein again.
[0214] Figure 8 A disaster recovery system of a database task according to an embodiment of the present application is shown, which comprises a task center and a plurality of data centers. Figure 8As can be seen, the system 800 comprises a task center 810, a plurality of data centers 820 and a total execution server 830, the task center being communicatively connected to the total execution server and each data center respectively.
[0215] The task center 810 is deployed with the aforementioned disaster recovery server 500 of the database task, and each data center is deployed with the aforementioned disaster recovery device 700 of the database task.
[0216] The total execution server is configured to determine a final execution result of the database task according to the execution result of the database task of the first data center and the execution result of the mapping task.
[0217] Figure 9 and Figure 10 are structural schematic diagrams of an electronic device according to an embodiment of the present application. Please refer to Figure 9 and Figure 10 At the hardware level, the electronic device comprises a processor, and optionally further comprises an internal bus, a network interface and a memory. The memory can include a memory such as a random-access memory (RAM), and can also include a non-volatile memory such as at least one disk memory. Of course, the electronic device can also include other hardware required by the business.
[0218] The processor, the network interface and the memory can be connected to each other through the internal bus, which can be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus and a control bus. For ease of representation, Figure 9 and Figure 10 In the above-mentioned figure, only one bidirectional arrow is used to represent the bus, but it does not mean that there is only one bus or only one type of bus.
[0219] The memory is used to store a program. Specifically, the program can include program code, and the program code includes computer operation instructions. The memory can include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0220] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs, and at the logical level, the disaster recovery server or device of the database task. The processor executes the program stored in the memory, and is specifically configured to perform the following operations:
[0221] generating a database task of a first data center, wherein the database task contains a plurality of subtasks, each subtask contains a primary data source attribute and a backup data source attribute; causing the first data center to execute the database task according to the primary data source attribute; obtaining a mapping task from the first data center, the mapping task is generated by the first data center according to the backup data source attribute of the failed subtask; determining a second data center corresponding to the mapping task, causing the second data center to execute the mapping task; causing a total execution server to determine a final execution result of the database task according to the execution result of the database task of the first data center and the execution result of the mapping task.
[0222] or;
[0223] obtaining a database task from a task center, wherein the database task contains a plurality of subtasks, each subtask contains a primary data source attribute and a backup data source attribute; executing each subtask according to the primary data source attribute; if there is a failed subtask, generating a mapping task according to the backup data source attribute of the failed subtask; returning the mapping task to the task center, so that the task center determines a data center corresponding to the mapping task, causes the data center corresponding to the mapping task to execute the mapping task, and determines a final execution result of the database task according to the execution result of the mapping task.
[0224] The above as claimed in the present application Figure 5The method performed by the disaster recovery server or the disaster recovery device disclosed in the embodiment of the application of the first aspect or the second aspect can be applied to a processor or implemented by the processor. The processor can be an integrated circuit chip with processing capability. In the implementation process, each step of the above method can be completed by integrated logic circuits in hardware or instructions in software form in the processor. The processor can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; or a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. Each method, step and logic block disclosed in the embodiments of the application can be implemented or executed. The general processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of the application can be directly embodied as a hardware code processor for execution, or a combination of hardware and software modules in the code processor for execution. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register or other mature storage medium in the art. The storage medium is located in the memory, and the processor reads the information in the memory and combines the hardware to complete the steps of the above method.
[0225] The electronic device can further execute Figure 5 the method performed by the disaster recovery server or the disaster recovery device in the embodiments of the first aspect or the second aspect, and implement the functions of the disaster recovery server or the disaster recovery device in the embodiments of the first aspect or the second aspect. The embodiments of the application will not be repeated here. Figure 5
[0226] The embodiments of the application further provide a computer readable storage medium storing one or more programs, the one or more programs including instructions, which when executed by an electronic device including a plurality of application programs, can enable the electronic device to execute Figure 5 the method performed by the disaster recovery server or the disaster recovery device in the embodiments of the first aspect or the second aspect, and specifically for executing
[0227] generating a database task of a first data center, wherein the database task comprises a plurality of subtasks, each of the subtasks comprises a primary data source attribute and a backup data source attribute; causing the first data center to execute the database task according to the primary data source attribute; obtaining a mapping task from the first data center, the mapping task is generated by the first data center according to the backup data source attribute of a failed subtask; determining a second data center corresponding to the mapping task, and causing the second data center to execute the mapping task; and causing a total execution server to determine a final execution result of the database task according to an execution result of the database task of the first data center and an execution result of the mapping task.
[0228] or;
[0229] obtaining a database task from a task center, wherein the database task comprises a plurality of subtasks, each of the subtasks comprises a primary data source attribute and a backup data source attribute; executing each of the subtasks according to the primary data source attribute; if there is a failed subtask, generating a mapping task according to the backup data source attribute of the failed subtask; returning the mapping task to the task center, so that the task center determines a data center corresponding to the mapping task, causes the data center corresponding to the mapping task to execute the mapping task, and determines a final execution result of the database task according to an execution result of the mapping task.
[0230] Those skilled in the art understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.
[0231] The present application is described with reference to flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the computer or other programmable data processing apparatus produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that carries out the functions specified in one or more flows and / or blocks.
[0232] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the Figure 1 function specified in the flow or flows and / or blocks Figure 1 of the block or blocks.
[0233] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the Figure 1 function specified in the flow or flows and / or blocks Figure 1 of the block or blocks.
[0234] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0235] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) and / or cache memory, non-volatile memory, such as read-only memory (ROM), EPROM, and / or flash memory, etc. The memory is an example of computer readable media.
[0236] Computer readable media includes permanent and non-permanent, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile discs (DVDs) or other optical storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer readable media does not include transitory media, such as modulated data signals and carrier waves.
[0237] It is also to be noted that the terms "comprising", "including", and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises a... " does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the recited element.
[0238] Those skilled in the art will appreciate that embodiments of the present application can be devised for a method, a system, or a computer program product. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) embodying computer-readable program code.
[0239] The embodiments of the present application described above are only used to explain the technical solutions of the present application and not to limit the present application. Although the present application has been described in detail, those skilled in the art will understand that the present application can make various modifications and changes without departing from the spirit and scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the scope of the claims of the present application.
Claims
1. A method for disaster recovery of a database task, the method being performed by a task center, wherein, The method includes: Generate a database task for the first data center, wherein the database task includes multiple subtasks, and each subtask includes primary data source attributes and backup data source attributes; The first data center executes the database task based on the attributes of the primary data source; Obtain a mapping task from a first data center, which is generated by the first data center based on the backup data source attributes of the failed subtasks; Determine the second data center corresponding to the mapping task, and have the second data center execute the mapping task; The main execution server determines the final execution result of the database task based on the execution results of the database task in the first data center and the execution results of the mapping task.
2. The method of claim 1, wherein, The database task is a sub-task of the overall database task, and each sub-task of the overall database task corresponds to a different data center; the method further includes: The overall execution server determines the final execution result of the overall database task based on the final execution results of each database task.
3. The method of claim 1, wherein, The database task for generating the first data center includes: Identify multiple master databases where the task data resides, where the task data is the business data required to execute the tasks in the databases; Identify the subtasks corresponding to each master database, and determine the main data source attributes of the corresponding subtasks based on the attributes of each master database; Based on the attributes of the backup databases of each primary database, determine the backup data source attributes for the corresponding subtasks of each primary database.
4. The method of claim 1, wherein, Determining the second data center corresponding to the mapping task includes: The second data center is determined based on the primary data source attribute of the mapping task.
5. The method of claim 4, wherein, The method further includes: Obtain a new mapping task from the second data center, which is generated by the second data center based on the backup data source attributes of the failed mapping task; Determine the third data center corresponding to the new mapping task, and have the third data center execute the new mapping task; The main execution server determines the final execution result of the database task based on the execution results of the database task in the first data center and the execution results of the new mapping task.
6. The method of claim 5, wherein, The database corresponding to the backup data source attribute of the subtask is the same-city backup database of the database corresponding to the main data source attribute of the subtask. The database corresponding to the backup data source attribute of the mapping task is a remote backup database of the database corresponding to the main data source attribute of the subtask.
7. A method of disaster recovery of a database task, the method being performed by a data center, wherein, The method includes: Obtain a database task from the task center, wherein the database task contains multiple subtasks, and each subtask contains a main data source attribute and a backup data source attribute; Execute each subtask according to the main data source attributes; If there are subtasks that fail to execute, a mapping task is generated based on the backup data source attribute of the failed subtask. The mapping task is returned to the task center so that the task center can determine the data center corresponding to the mapping task and have the data center corresponding to the mapping task execute the mapping task. The database task execution result is returned to the total execution server, so that the total execution server determines a final execution result of the database task according to the database task execution result and an execution result of a mapping task.
8. The method of claim 7, wherein, The method further comprises: obtaining a mapping task from the task center and returning an execution result of the mapping task to the total execution server.
9. The method of claim 8, wherein, The mapping task comprises a primary data source attribute and a backup data source attribute, and the method further comprises: if the mapping task fails, generating a new mapping task according to the backup data source attribute of the mapping task; returning the generated new mapping task to the task center, so that the task center determines a new data center corresponding to the new mapping task and makes the new data center execute the new mapping task.
10. The method of claim 8, wherein, Obtaining a mapping task from the task center comprises: determining whether there is a mapping task of the data center in the task center in a preset period, and if there is, pulling the mapping task from the task center.
11. The method of claim 6, wherein, The execution of each subtask according to the primary data source attribute comprises: determining a database corresponding to each subtask according to the primary data source attribute; extracting data required by each subtask from each database respectively and executing the corresponding subtask according to the extracted data; if the data extraction from a database fails or the execution of the corresponding subtask according to the extracted data fails, the subtask is determined as a failed subtask.
12. A disaster recovery server of a database task, the disaster recovery server being applied to a task center, wherein, The disaster recovery server is configured to execute the method of any one of claims 1-6.
13. A disaster recovery apparatus of a database task, the disaster recovery apparatus being applied to a data center, wherein, The disaster recovery device is configured to execute the method of any one of claims 7-11.
14. A disaster recovery system for database tasks, wherein, The system comprises a task center, a plurality of data centers and a total execution server, and the task center is respectively communicatively connected to the total execution server and each data center. The task center is provided with the disaster recovery server of the database task of claim 12, and each data center is respectively provided with the disaster recovery device of the database task of claim 13. The total execution server is configured to determine a final execution result of the database task according to an execution result of the database task of the first data center and an execution result of a mapping task. 15.An electronic device comprising: a processor; and a memory arranged to store computer executable instructions that, when executed, cause the processor to perform the method of any one of claims 1-6 or 7-11. 16.A computer readable storage medium storing one or more programs, the one or more programs, when executed by an electronic device comprising multiple applications, causing the electronic device to perform the method of any one of claims 1-6 or 7-11.