Site switching method, device, computer equipment and storage medium
By receiving the switch command from the slave site and calling the corresponding script file, the switch from the site to the main site is automatically completed, and the problems of low efficiency and high risk of manual switching in the existing technology are solved, and efficient and reliable site switching is achieved.
Patent Information
- Application Number
- CN202310213157.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-28
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2043-02-28
AI Technical Summary
In the prior art, when the data replication delay between the core site and the backup site is too high or the parallel site is abnormal, the data of the backup site is unreliable and requires manual switching, resulting in low switching efficiency and uncontrollable risks.
By receiving the switching instructions sent from the site, calling the script file corresponding to the fault type for automatic switching operations, realizing the route switching of business services from the site to the main site, reducing manual intervention and improving switching efficiency.
Automatic switching between the slave site and the main site is realized, switching efficiency is improved, risks brought by manual operations are reduced, and the sustainability of transactions are ensured.
Smart Images

Figure CN116208472B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network technology, and in particular to a site switching method, device, computer equipment and storage medium. Background Art
[0002] In the architecture of the science and technology network system, a host site in the same city can be established, which includes a core site host and a backup site host. This can effectively share the pressure of the core site host and reasonably use the backup site host resources.
[0003] Currently, the core site host and the backup site host use data replication tools to manually replicate the core site data to the backup site data at the database level. During this replication process, if the replication delay is too high or an exception occurs in the parallel site host, the data provided by the backup site host to the user will no longer be reliable. At this time, the corresponding service of the backup site needs to be switched from the backup site host to the core site host. Currently, the switching operation between the backup site host and the core site host is mainly achieved through manual switching.
[0004] However, the above manual switching method has the problem of low switching efficiency. Summary of the invention
[0005] Based on this, it is necessary to provide a site switching method, device, computer equipment and storage medium that can improve switching efficiency in response to the above technical problems.
[0006] In a first aspect, the present application provides a site switching method. The method comprises:
[0007] receiving a first switching instruction sent by the slave site; the first switching instruction is generated by the slave site according to a fault type of the slave site;
[0008] The script file corresponding to the fault type is called according to the first switching instruction to perform a switching operation.
[0009] In one embodiment, calling a script file corresponding to the fault type according to the first switching instruction to perform a switching operation includes:
[0010] Calling a script file corresponding to the fault type according to the first switching instruction generates a second switching instruction;
[0011] A second switching instruction is sent to the gateway to instruct the gateway to route the business service of the secondary site to the primary site, and return the switching result to the primary site.
[0012] In one embodiment, after receiving the first switching instruction sent from the station, the method further includes:
[0013] Display prompt information; the prompt information is used to inform the user that the main site is performing a site switching operation.
[0014] In one embodiment, the method further comprises:
[0015] Receiving the switching result returned by the gateway; the switching result includes switching success information or switching failure information;
[0016] The switching result will replace the prompt information and display it.
[0017] In a second aspect, the present application provides a site switching method. The method comprises:
[0018] Determine the fault type of the slave site;
[0019] Determine whether to perform site switching according to the fault type. If site switching is performed, send a first switching instruction to the primary site to instruct the primary site to call a script file corresponding to the fault type according to the first switching instruction to perform a switching operation.
[0020] In one of the embodiments, the above-mentioned failure types include: any one of: data replication delay failure, system disk failure, business data response failure, downtime failure, database table failure, and replication component failure.
[0021] In one embodiment, if the fault type is a data replication delay fault or a system disk fault, determining whether to perform a site switch according to the fault type includes:
[0022] Get the number of alarms corresponding to data replication delay failure or system disk failure within a preset time period;
[0023] If the number of alarms is greater than the preset threshold, it is determined to switch the site;
[0024] If the number of alarms is not greater than the preset threshold, it is determined that the site switching will not be performed.
[0025] In one embodiment, if the fault type is a service data response fault, determining whether to perform site switching according to the fault type includes:
[0026] Obtaining business data response characteristics; business data response characteristics include business data response time or business data response success ratio;
[0027] If the data response characteristics meet the preset conditions, it is determined to switch the site;
[0028] If the data response characteristics do not meet the preset conditions, it is determined that the site switching will not be performed.
[0029] In a third aspect, the present application further provides a site switching device. The device comprises:
[0030] A receiving module, configured to receive a first switching instruction sent by a slave station; the first switching instruction is generated by the slave station according to a fault type of the slave station;
[0031] The switching module is used to call a script file corresponding to the fault type to perform a switching operation according to the first switching instruction.
[0032] In a fourth aspect, the present application further provides a site switching device. The device comprises:
[0033] A determination module, used to determine the fault type of the slave site;
[0034] The sending module is used to determine whether to perform site switching according to the fault type. If site switching is performed, a first switching instruction is sent to the primary site to instruct the primary site to call a script file corresponding to the fault type according to the first switching instruction to perform a switching operation.
[0035] In a fifth aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0036] receiving a first switching instruction sent by the slave site; the first switching instruction is generated by the slave site according to a fault type of the slave site;
[0037] The script file corresponding to the fault type is called according to the first switching instruction to perform a switching operation.
[0038] In a sixth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0039] receiving a first switching instruction sent by the slave site; the first switching instruction is generated by the slave site according to a fault type of the slave site;
[0040] The script file corresponding to the fault type is called according to the first switching instruction to perform a switching operation.
[0041] In a seventh aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0042] receiving a first switching instruction sent by the slave site; the first switching instruction is generated by the slave site according to a fault type of the slave site;
[0043] The script file corresponding to the fault type is called according to the first switching instruction to perform a switching operation.
[0044] The site switching method, device, computer equipment and storage medium first receive a first switching instruction sent by the slave site, and then call a script file corresponding to the fault type to perform a switching operation according to the first switching instruction. The method connects the slave site and the master site, and realizes a method for automatically switching the slave site and the master site. Compared with the traditional method of manually switching the slave site and the master site, the entire switching process of this solution does not require manual intervention, and the automatic switching back from the slave site to the master site is completed through the script. The switching efficiency is extremely high, and the uncontrollable risk factors caused by manual operation are reduced, effectively ensuring the sustainability of normal operation of transactions. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 An application environment diagram of a site switching method in an embodiment;
[0046] Figure 2 1 is a flow chart of a site switching method in an embodiment (primary site side);
[0047] Figure 3 A schematic diagram of a flow chart of a step of sending a switching instruction in an embodiment;
[0048] Figure 4 A flowchart showing a prompt information step in an embodiment;
[0049] Figure 5 A schematic diagram of a flow chart of a step of displaying a switching result in an embodiment;
[0050] Figure 6 is a flow chart of a site switching method in an embodiment (from the site side);
[0051] Figure 7 A schematic diagram of a flow chart of a step of determining the number of alarm times in an embodiment;
[0052] Figure 8 A schematic diagram of a flow chart of a step of determining a data response characteristic in an embodiment;
[0053] Fig. 9 A schematic diagram of a site switching process for a whole machine downtime failure in one embodiment;
[0054] Fig.10 A schematic diagram of a site switching process for a partition downtime failure in one embodiment;
[0055] Fig.11 A schematic diagram of a site switching process for a database failure in one embodiment;
[0056] Fig.12 A schematic diagram of a site switching process for a replication component failure in one embodiment;
[0057] Fig.13 A schematic diagram of a site switching process for a replication delay failure in one embodiment;
[0058] Fig.14 A schematic diagram of a site switching process for a system disk failure in one embodiment;
[0059] Fig.15 A schematic diagram of a site switching process for a service data response failure in an embodiment;
[0060] Fig.16 is a structural block diagram of a site switching device in one embodiment;
[0061] Fig.17 is a structural block diagram of a site switching device in one embodiment;
[0062] Fig.18 is a structural block diagram of a site switching device in one embodiment;
[0063] Fig.19 is a structural block diagram of a site switching device in one embodiment;
[0064] Fig. 20 is a structural block diagram of a site switching device in one embodiment;
[0065] Fig.21 is a structural block diagram of a site switching device in one embodiment;
[0066] Fig. 22 is a structural block diagram of a site switching device in one embodiment;
[0067] Fig.23 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0068] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0069] In the network technology system, usually dual active sites are established with hosts in the same city. The dual active sites include core site hosts and parallel site hosts. In the actual application environment, different types of online transaction services are routed to different site hosts through the communication network, providing services for different site hosts at the same time. This can effectively share the pressure of the core site host and reasonably use the resources of the parallel site hosts.
[0070] At present, the replication between the core site host data and the backup site host data at the database level is mainly achieved through the data replication tool QREP. During the replication process, when the replication delay time is too high or an exception occurs in the parallel site, the data provided by the parallel site host to the user will no longer be reliable, resulting in the failure of the user to query such transactions. At this time, it is necessary to route the update transaction data and the data of the separable query transaction from the parallel site host to the core site host to realize the switching of the parallel site host and the core site host for business operations. However, currently, the problem is mainly discovered manually, and it is manually determined whether the parallel site host will have a negative impact on the normal execution of the separable query transaction. If it does, the parallel site host and the core site host are manually switched. In actual applications, the failure of the parallel site host system itself is complex and may occur on different parallel site hosts. It is difficult and inefficient to manually determine whether it may have a negative impact on the separable query transaction and take timely switching operations. There are uncontrollable human risk hazards and a high probability of error, which may lead to production problems. Obviously, the current site switching method is not optimal, and there is still a huge room for improvement in the accuracy and timeliness of site switching.
[0071] After introducing the background technology of the site switching method provided by the embodiment of the present application, the implementation environment involved in the site switching method provided by the embodiment of the present application will be briefly described below. The site switching method provided by the embodiment of the present application can be applied to Figure 1 In the application environment shown. The above-mentioned host active-active site in the same city includes a core site host 101 and a parallel site host 102, and the core site host 101 transmits data with the parallel site host 102 through a communication network. Among them, the core site host 101 is used to undertake core online services and core batch services; the parallel site host 102 is used to undertake a small amount of non-core online services and non-core batch services, mainly undertaking business transactions for updating transaction data and data that can be detached for query transactions. It should be noted that the core site host 101 and the parallel site host 102 are both large hosts / mainframes (Mainframe), which use dedicated operating systems (Z / OS) and application software. In an actual application environment, when a serious failure occurs in the parallel site host 102, the processing of core transactions and batch tasks can be switched to the core site host 101 through a series of operations provided in the following embodiments of the present application, and the core site host 101 takes over the business of the parallel site host 102.
[0072] It should be noted that the “parallel site host” is referred to as the “slave site” in the following embodiments, and the “core site host” is referred to as the “master site” in the following embodiments.
[0073] After introducing the application scenarios of the site switching method provided in the embodiments of the present application, the following focuses on the site switching process.
[0074] In one embodiment, Figure 2 As shown, a site switching method is provided, which is applied to Figure 1 The core site host 101 (primary site) in the example is used for explanation, and the following steps are included:
[0075] S201: Receive a first switching instruction sent from a site.
[0076] Among them, the first switching instruction is generated by the slave site according to the type of failure generated by the slave site. For example, if the failure type of the slave site is a data replication delay failure, the first switching instruction can be generated by the slave site as a "replication delay" instruction based on the data replication delay failure; if the failure type of the slave site is a system disk failure, the first switching instruction can be generated by the slave site as a "disk failure" instruction based on the system disk failure. The first switching instruction is an instruction from the slave site to instruct the master site to perform a switching operation. The failure type may include but is not limited to at least one of a data replication delay failure, a system disk failure, a business data response failure, a downtime failure, a database table failure, a replication component failure, and the like.
[0077] In the embodiment of the present application, the SA system is installed on both the master site and the slave site. The slave site can capture various types of faults of the slave site during the operation of the system in real time through the SA system. If the various types of faults captured include any one or more of the above-mentioned fault types, and the captured fault types meet the preset conditions, the slave site can send a first switching instruction to the master site through the SA system or send the first switching instruction to the master site through other means. Afterwards, the master site can receive the first switching instruction sent by the slave site through its own receiving antenna, or the master site can receive the first switching instruction sent by the slave site through the SA system thereon, and then the corresponding switching operation can be performed according to the first switching instruction.
[0078] S202: Call a script file corresponding to the fault type to perform a switching operation according to the first switching instruction.
[0079] The script file corresponding to the fault type may be a script file automatically generated by the master site according to the fault type of the slave site. For example, if the fault type of the slave site is a data replication delay fault, the master site may generate a corresponding script file according to the fault type (e.g., a script file CALLQSW1 corresponding to the data replication delay fault); if the fault type of the slave site is a system disk fault, the master site may generate a corresponding script file according to the fault type (e.g., a script file CALLQSW2 corresponding to the system disk fault). Different fault types correspond to different script files.
[0080] In an embodiment of the present application, after the master site receives the first switching instruction sent by the slave site, the fault information generated by the slave site can be further extracted from the first switching instruction, and the fault type can be determined by analyzing the fault information, and then the master site can automatically generate a script file corresponding to the fault type according to the fault type or call the script file corresponding to the fault type from the database. Exemplarily, if the master site receives a "replication delay" instruction sent by the slave site, the master site can automatically generate a corresponding script file (for example, a script file CALLQSW1 corresponding to the data replication delay failure corresponding to the "replication delay" instruction), and then the master site calls the script file to instruct the slave site and the master site to perform a switching operation. Another exemplary embodiment, if the master site receives a "disk failure" instruction sent by the slave site, the master site can automatically generate a corresponding script file (for example, a script file CALLQSW2 corresponding to the system disk failure) according to the "disk failure" instruction. Then, the master site calls the script file to instruct the slave site and the master site to perform a switching operation.
[0081] The site switching method provided in the embodiment of the present application first receives a first switching instruction sent by the slave site, and then calls a script file corresponding to the fault type to perform a switching operation according to the first switching instruction. The above method connects the slave site and the master site, and realizes a method for automatically switching the slave site and the master site. Compared with the traditional method of manually switching the slave site and the master site, the entire switching process of this solution does not require manual intervention, and the automatic switching back from the slave site to the master site is completed through the script. The switching efficiency is extremely high, and the uncontrollable risk factors caused by manual operation are reduced, effectively ensuring the sustainability of normal operation of transactions.
[0082] In one embodiment, Figure 2 Based on the embodiment shown, the process of calling the script file corresponding to the fault type according to the first switching instruction to perform the switching operation can be described as follows: Figure 3 As shown, the "calling a script file corresponding to the fault type to perform a switching operation according to the first switching instruction" in the above S202 may include:
[0083] S301: Call a script file corresponding to a fault type according to a first switching instruction to generate a second switching instruction.
[0084] The second switching instruction is used to instruct the gateway connecting the master site and the slave site to route the business services of the slave site to the master site. For example, the gateway instructs the business of updating transaction data and separable query transaction data of the slave site to be routed to the master site.
[0085] In an embodiment of the present application, after receiving the first switching instruction sent by the slave site, the master site can call the script file corresponding to the fault type generated by the slave site, and automatically generate a second switching instruction based on the script file. Optionally, the SA system on the master site can complete the above-mentioned operations of receiving, calling and generating the second switching instruction. Exemplarily, if the master site receives a "replication delay" instruction sent by the slave site, a corresponding script file can be generated according to the data replication delay failure corresponding to the instruction (for example, the script file CALLQSW1 corresponding to the system disk failure), and a second switching instruction can be automatically generated in the SA system to instruct the gateway connecting the master site and the slave site to route the business services of the slave site to the master site.
[0086] S302: Send a second switching instruction to the gateway to instruct the gateway to route the business service of the secondary site to the primary site, and return the switching result to the primary site.
[0087] In the embodiment of the present application, after the master site generates a second switching instruction according to the script file corresponding to the fault type of the slave site, the second switching instruction can be sent to the gateway to instruct the gateway to route the business service of the slave site to the master site. After the gateway executes the switching task of routing the business service of the slave site to the master site, the gateway returns the switching result between the slave site and the master site to the master site to inform the master site that the switching is successful, or to inform the master site that the switching fails. It should be noted that the switching result includes switching success information and switching failure information.
[0088] The method for performing switching operations according to a script file provided in this embodiment links the slave site and the master site, realizes a method for automatically switching the slave site and the master site, generates a switching instruction according to the script corresponding to the fault type, and instructs the gateway to complete the automatic switching back from the slave site to the master site. Compared with the traditional method of manually switching the slave site and the master site, the entire switching process of this solution does not require human intervention, the switching efficiency is extremely high, and the uncontrollable risk factors brought by manual operation are reduced, effectively ensuring the sustainability of normal operation of transactions.
[0089] In one embodiment, Figure 2 Based on the embodiment shown in FIG. 1 , after the master site receives the first switching instruction sent by the slave site, as shown in FIG. Figure 4 As shown, the above method also includes:
[0090] S203, display prompt information.
[0091] The prompt information is used to prompt the user that the main site is performing a site switching operation. The prompt information may be information displayed on the display screen of the main site, and the prompt information may include fault information and switching information, wherein the fault information describes the type of fault, and the switching information describes the operation process currently performed by the main site. For example, the prompt information corresponding to the downtime of the slave site may be SAQH07E B SITE DOWN, START SWITCH TO SITE AAUTOMATICALLY! ).
[0092] In an embodiment of the present application, after the main site receives the first switching instruction sent by the slave site, it indicates that the main site needs to perform a switching operation next. At this time, the main site can first determine the prompt information according to the type of fault occurring at the slave site, and display the prompt information at a corresponding position on the display screen to prompt the user that the main site is performing a site switching operation, as well as to prompt the original site for the switching operation to occur.
[0093] Optionally, a method for updating the prompt information is further provided, such as Figure 5 As shown, in Figure 2 Based on the embodiment, the above method further includes:
[0094] S204: Receive the switching result returned by the gateway.
[0095] The switching result includes switching success information or switching failure information.
[0096] S205: Replace the prompt information with the switching result and display it.
[0097] In an embodiment of the present application, after the gateway routes the business service of the slave site to the main site, the gateway will return the switching result between the slave site and the main site to the main site. After the main site receives the switching result returned by the gateway, if the switching result is a successful switching information, the main site can replace the original prompt information with the successful switching information and display the successful switching information; if the switching result is a failed switching information, the main site can replace the original prompt information with the failed switching information and display the failed switching information.
[0098] The method for displaying prompt information provided in this embodiment connects the slave site and the main site, realizes a method for automatically switching the slave site and the main site, and displays corresponding prompt information during the switching process from the slave site to the main site. After the slave site and the main site complete the switching, the switching result is displayed to prompt the user with the status information of the main site. The switching efficiency is extremely high, and the uncontrollable risk factors brought by manual operation are reduced, effectively ensuring the sustainability of normal operation of transactions.
[0099] Above Figure 2-Figure 5The method described in the embodiment is described based on the main site side. Figure 6-Figure 8 The embodiment will be described from the site side.
[0100] In one embodiment, Figure 6 As shown, a site switching method is provided, which is applied to Figure 1 The following steps are used to illustrate the parallel site host (slave site) in the example:
[0101] S501, determining the fault type of the slave site;
[0102] S502: Determine whether to perform site switching according to the fault type. If site switching is performed, execute step S503;
[0103] S503, sending a first switching instruction to the primary site to instruct the primary site to call a script file corresponding to the fault type to perform a switching operation according to the first switching instruction. If site switching is not performed, executing step S504;
[0104] S504, return to step S501.
[0105] The failure type of the slave site includes any one of a data replication delay failure, a system disk failure, a business data response failure, a downtime failure, a database table failure, and a replication component failure.
[0106] In an embodiment of the present application, when a fault occurs at a slave site, fault information can be collected first, and then the fault type can be determined by analyzing the fault information. When the fault type is determined, it can be determined whether the fault type affects the data service of the detachable query transaction of the slave site. If it does, it means that the detachable query transaction service needs to be switched to the master site so that the master site can then replace the slave site to execute the detachable query transaction service. In this case, the slave site can generate a first switching instruction and send the first switching instruction to the master site to instruct the master site to perform the corresponding switching operation according to the first switching instruction. As for the specific operation method, it is described in the aforementioned Figure 2 Each step in the embodiment is described. For detailed description, please refer to the above Figure 2 In addition, it should be noted that the SA system on the slave site can perform operations such as analyzing the fault information to determine the fault type, generating and sending the first switching instruction, etc., to match with the SA system on the master site to complete the switching operation.
[0107] In one embodiment, if the fault type is a data replication delay fault or a system disk fault, when the slave site performs the above step S502 of "determining whether to perform site switching according to the fault type", as shown in FIG. Figure 7 As shown, the specific steps are as follows:
[0108] S601: Obtain the number of alarms corresponding to data replication delay failure or system disk failure within a preset time period.
[0109] The preset time period may be determined according to actual needs. For example, the preset time period may be 1 minute, 2 minutes, or 5 minutes.
[0110] S602, determine whether the number of alarms is greater than a preset threshold, if so, execute S603; if not, execute S604.
[0111] The preset threshold value may be determined according to actual needs, and is used to determine whether the failure of a slave site is a real failure, or to exclude false alarms.
[0112] S603: Determine to perform site switching.
[0113] S604: Determine not to perform site switching.
[0114] In an embodiment of the present application, after the SA software system installed on the slave site determines that the fault type is a data replication delay fault, the SA software system can obtain the number of alarms corresponding to the data replication delay fault in a preset time period through the SA software system. If the number of alarms corresponding to the data replication delay fault is greater than a preset threshold, it is determined to perform site switching; if the number of alarms corresponding to the data replication delay fault is not greater than the preset threshold, it is determined not to perform site switching. Optionally, after the SA software system installed on the slave site determines that the fault type is a system disk fault, the SA software system can obtain the number of alarms corresponding to the system disk fault in a preset time period through the SA software system. If the number of alarms corresponding to the system disk fault is greater than the preset threshold, it is determined to perform site switching; if the number of alarms corresponding to the system disk fault is not greater than the preset threshold, it is determined not to perform site switching.
[0115] In one embodiment, if the fault type is a service data response fault, when the slave site performs the above step S502 of "determining whether to perform site switching according to the fault type", as shown in FIG. Figure 8 As shown, the specific steps are as follows:
[0116] S701. Obtain business data response characteristics.
[0117] The business data response characteristics include the business data response time or the business data response success ratio.
[0118] S702: Determine whether the data response characteristics meet the preset conditions. If yes, execute S703; if no, execute S704.
[0119] The preset condition can be determined according to actual needs to determine whether the failure of the slave site is a real failure or to exclude false alarms. The preset condition can be that the transaction impact time exceeds the preset threshold for three consecutive times, or that the business data response success ratio suddenly drops to 0, or that the business data response success ratio suddenly drops by more than 50%.
[0120] S703: Determine to perform site switching.
[0121] S704: Determine not to perform site switching.
[0122] The business data response characteristics include the business data response time or the business data response success ratio.
[0123] In an embodiment of the present application, after the host SA software system installed on the slave site determines that the fault type is a business data response failure, the response time of the business data response failure or the business data response success ratio can be obtained through the host SA software system. If the response time of the business data response failure or the business data response success ratio meets the preset conditions, it is determined to perform site switching; if the response time of the business data response failure or the business data response success ratio does not meet the preset conditions, it is determined not to perform site switching.
[0124] The site switching method (from the site side) provided in the embodiment of the present application first determines the fault type of the slave site, and then determines whether to perform site switching according to the fault type. If the site switching is performed, a first switching instruction is sent to the master site to instruct the master site to call the script file corresponding to the fault type according to the first switching instruction to perform the switching operation. The above method connects the slave site and the master site, and realizes a method for automatically switching the slave site and the master site. Compared with the traditional method of manually switching the slave site and the master site, the entire switching process of this solution does not require manual intervention, and the automatic switching back from the slave site to the master site is completed through the script. The switching efficiency is extremely high, and the uncontrollable risk factors caused by manual operation are reduced, effectively ensuring the sustainability of normal operation of transactions.
[0125] Above Figure 2-8 The failure type in the site switching method described in the embodiment includes at least one of a data replication delay failure, a system disk failure, a business data response failure, a downtime failure, a database table failure, and a replication component failure, so that the primary site calls different script files to perform site switching based on different failure types. The following is an exemplary description of a method for calling different script files to perform site switching according to different failure types:
[0126] Example 1: Fig. 9As shown, if a whole-machine downtime occurs at the slave site, the host SA software system installed on the slave site captures the whole-machine downtime fault type (for example, the whole-machine downtime fault information is GEO1714), generates a first switching instruction according to the fault type of the slave site (for example, the first switching instruction corresponding to the whole-machine downtime fault type is a "whole-machine downtime" instruction), and sends the instruction to the master site. After the master site receives the first switching instruction sent by the slave site, it displays a prompt message for prompting the user that the master site is performing a site switching operation (for example, the prompt message corresponding to the whole-machine downtime is SAQH07E B SITE DOWN, START SWITCH TO SITEAUTOMATICALLY!), and calls the script file CALLQSW4 corresponding to the fault type according to the first switching instruction to generate a second switching instruction, and sends the second switching instruction to the gateway to instruct the gateway to route the business service of the slave site to the master site, and return a switching success message (for example, the switching success message corresponding to the whole-machine downtime is SAQH07E B SITE DOWN, SWITCH TO SITEAUTOMATICALLY!). COMPLETE! ) or switching failure information (for example, the switching failure information corresponding to the whole machine downtime is SAQH13E SEPARABLE QUERYTRANSACTION SWITCH FAILED!) to the main site. If the switching success information is returned, the switching is successful. If the switching failure information is returned, it returns to the gateway for re-switching until the switching success information is displayed.
[0127] Example 2: Fig.10As shown, if a whole-machine partition downtime occurs at the slave site (a single LPAR of the host goes down), the host SA software system installed on the slave site captures the whole-machine partition downtime fault type (for example, the whole-machine downtime fault information is GEO112E), generates a first switching instruction according to the fault type of the slave site (for example, the first switching instruction corresponding to the whole-machine partition downtime fault type is a "partition downtime" instruction), and sends the instruction to the master site. After the master site receives the first switching instruction sent by the slave site, it displays a prompt message for prompting the user that the master site is performing a site switching operation (for example, the prompt message corresponding to the whole-machine partition downtime fault is SAQH08E LPAR DOWN, START SWITCH TO SITEAAUTOMATICALLY!), and calls the script file CALLQSW5 corresponding to the fault type according to the first switching instruction to generate a second switching instruction, and sends the second switching instruction to the gateway to instruct the gateway to route the business service of the slave site to the master site and return a switching success message (for example, the switching success message corresponding to the whole-machine partition downtime fault is SAQH08ELPAR DOWN, SWITCH TO SITEAAUTOMATICALLY!). SITEA COMPLETE! ) or switch failure information (for example, the switch failure information corresponding to the whole partition failure is SAQH13E SEPARABLE QUERY TRANSACTION SWITCH FAILED!) to the primary site. If the switch success information is returned, the switch is successful. If the switch failure information is returned, return to the gateway to switch again until the switch success information is displayed.
[0128] Example 3: Fig.11As shown, if a database table failure occurs at the slave site (the database table is in the SOFTFENCE state), the host SA software system installed on the slave site captures the database table failure type (for example, the database table failure information is DSNT501I), generates a first switching instruction according to the failure type of the slave site (for example, the first switching instruction corresponding to the database table failure type is a "database failure" instruction), and sends the instruction to the master site. After receiving the first switching instruction sent by the slave site, the master site displays a prompt message for prompting the user that the master site is performing a site switching operation (for example, the prompt message corresponding to the database table failure is SAQH09E SF OPEN ERROR, START SWITCH TO SITEAUTOMATICALLY!), and calls the script file CALLQSW6 corresponding to the failure type according to the first switching instruction to generate a second switching instruction, and sends the second switching instruction to the gateway to instruct the gateway to route the business service of the slave site to the master site, and return a switching success message (for example, the switching success message corresponding to the database table failure is SAQH09E SF OPEN ERROR, SWITCH TO SITEAUTOMATICALLY!). COMPLETE! ) or switching failure information (for example, the switching failure information corresponding to the database table failure is SAQH13E SEPARABLE QUERY TRANSACTION SWITCH FAILED!) to the primary site. If the switching success information is returned, the switching is successful. If the switching failure information is returned, it returns to the gateway for re-switching until the switching success information is displayed.
[0129] Example 4: Fig.12As shown, if a replication component failure occurs at the slave site (for example, the CAPTURE address space in the Q replication system component is started on the slave site PROXY system, and together with the APPLY address space started on the slave site system, the replication of the table data is realized. If there is a problem on the CAPTURE side, such as the inability to read the log or the CDDS file is damaged, the data replication will also be terminated, and the query transaction cannot be executed normally), the host SA software system installed on the slave site captures the replication component failure type (for example, the replication component failure information is ASN7327W / ASN7336E / ASN7338E / ASN7339E), and then generates a first switching instruction according to the failure type of the slave site (for example, the first switching instruction corresponding to the replication component failure type is a "replication component failure" instruction), and sends the instruction to the master site. After receiving the first switching instruction sent by the slave site, the master site displays a prompt message for prompting the user that the master site is performing a site switching operation (for example, the prompt message corresponding to the replication component failure is SAQH10E CAPTURE ERROR, START SWITCH TO SITEAAUTOMATICALLY! ), and according to the first switching instruction, calls the script file CALLQSW7 corresponding to the fault type to generate a second switching instruction, and sends the second switching instruction to the gateway to instruct the gateway to route the business service of the slave site to the primary site, and returns the switching success information (for example, the switching success information corresponding to the replication component failure is SAQH10E CAPTURE ERROR, SWITCH TOSITEA COMPLETE!) or the switching failure information (for example, the switching failure information corresponding to the replication component failure is SAQH13ESEPARABLE QUERY TRANSACTION SWITCH FAILED!) to the primary site. If the switching success information is returned, the switching is successful. If the switching failure information is returned, it returns to the gateway for re-switching until the switching success information is displayed.
[0130] Example 5: Fig.13As shown, if a data replication delay failure occurs at the slave site (for example, when a large delay occurs in Q replication from the master site database to the slave site database), the host SA software system installed on the slave site captures the data replication delay failure type (for example, the data replication delay failure information is ASN5194W), and the host SA software system can obtain the number of alarms corresponding to the data replication delay failure in a preset time period. If the number of alarms within 1 minute does not exceed 5 times, the switching from the slave site to the master site does not occur. If the number of alarms within 1 minute exceeds 5 times, a first switching instruction is generated according to the failure type of the slave site (for example, the first switching instruction corresponding to the data replication delay failure type is a "replication delay" instruction), and the instruction is sent to the master site. After receiving the first switching instruction sent by the slave site, the master site displays a prompt message for prompting the user that the master site is performing a site switching operation (for example, the prompt message corresponding to the data replication delay failure is SAQH03E QREP LATENCY, START SWITCH TO SITEA AUTOMATICALLY! ), and according to the first switching instruction, calls the script file CALLQSW1 corresponding to the fault type to generate a second switching instruction, and sends the second switching instruction to the gateway to instruct the gateway to route the business service of the slave site to the primary site, and returns a switching success message (for example, the switching success message corresponding to the data replication delay fault is SAQH03E QREP LATENCY, SWITCH TO SITEACOMPLETE!) or a switching failure message (for example, the switching failure message corresponding to the data replication delay fault is SAQH13ESEPARABLE QUERY TRANSACTION SWITCH FAILED!) to the primary site. If the switching success message is returned, the switching is successful. If the switching failure message is returned, it returns to the gateway for re-switching until the switching success message is displayed.
[0131] Example 6: Fig.14As shown, if a system disk failure occurs at the slave site (for example, if a parallel host system disk fails, it will affect the normal operation of its database, so that Q replication may be abnormal, resulting in the inability to execute query transactions or inaccurate data), after the host SA software system installed on the slave site captures the system disk failure type (for example, the system disk failure information is IEA074I), the host SA software system can obtain the number of alarms corresponding to the system disk failure in a preset time period. If the number of alarms within 1 minute does not exceed 10 times, the switching from the slave site to the master site does not occur. If the number of alarms within 1 minute exceeds 10 times, a first switching instruction is generated according to the failure type of the slave site (for example, the first switching instruction corresponding to the system disk failure type is a "disk failure" instruction), and the instruction is sent to the master site. After receiving the first switching instruction sent by the slave site, the master site displays a prompt message for prompting the user that the master site is performing a site switching operation (for example, the prompt message corresponding to the system disk failure is SAQH04E DISK ERROR, START SWITCH TO SITEA AUTOMATICALLY! ), and according to the first switching instruction, calls the script file CALLQSW2 corresponding to the fault type to generate a second switching instruction, and sends the second switching instruction to the gateway to instruct the gateway to route the business service of the slave site to the primary site, and returns a switching success message (for example, the switching success message corresponding to the system disk failure is SAQH04E DISK ERROR, SWITCH TO SITE A COMPLETE!) or a switching failure message (for example, the switching failure message corresponding to the system disk failure is SAQH13E SEPARABLE QUERY TRANSACTION SWITCH FAILED!) to the primary site. If the switching success message is returned, the switching is successful. If the switching failure message is returned, it returns to the gateway for re-switching until the switching success message is displayed.
[0132] Example 7: Fig.15As shown, if a service data response failure occurs at the slave site, after the host SA software system installed on the slave site captures the service data response failure type, the response time of the service data response failure or the service data response success ratio can be obtained through the host SA software system. If the response time of the service data response failure exceeds the preset threshold once or twice in a row, or the service data response success ratio does not drop suddenly to 0, or the service data response success ratio drops suddenly by less than 50%, it is determined not to perform site switching; if the response time of the service data response failure exceeds the preset threshold three times in a row, or the service data response success ratio drops suddenly to 0, or the service data response success ratio drops suddenly by more than 50%, it is determined to perform site switching. At this time, a first switching instruction is generated according to the failure type of the slave site (for example, the first switching instruction corresponding to the service data response failure type is a "response failure" instruction), and the instruction is sent to the master site. After receiving the first switching instruction sent by the slave site, the master site displays a prompt message for prompting the user that the master site is performing a site switching operation (for example, the prompt message corresponding to the service data response failure is SAQH05E TRANS ERROR, START SWITCH TOSITEAAUTOMATICALLY! ), and according to the first switching instruction, calls the script file CALLQSW3 corresponding to the fault type to generate a second switching instruction, and sends the second switching instruction to the gateway to instruct the gateway to route the business service of the slave site to the primary site, and returns the switching success information (for example, the switching success information corresponding to the business data response failure is SAQH05ETRANS ERROR, SWITCH TO SITEA COMPLETE!) or the switching failure information (for example, the switching failure information corresponding to the system disk failure is SAQH13E SEPARABLE QUERY TRANSACTION SWITCH FAILED!) to the primary site. If the switching success information is returned, the switching is successful. If the switching failure information is returned, it returns to the gateway for re-switching until the switching success information is displayed.
[0133] The site switching method provided in this embodiment first determines the fault type of the slave site, determines whether to perform site switching according to the fault type, and if site switching is performed, sends a first switching instruction to the master site to instruct the master site to call a script file corresponding to the fault type according to the first switching instruction to perform a switching operation. The above method links the slave site and the master site, and realizes a method for automatically switching the slave site and the master site. Compared with the traditional method of manually switching the slave site and the master site, the entire switching process of this solution does not require manual intervention, and the automatic switching back from the slave site to the master site is completed through the script. The switching efficiency is extremely high, and the uncontrollable risk factors caused by manual operation are reduced, effectively ensuring the sustainability of normal operation of transactions.
[0134] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0135] Based on the same inventive concept, the embodiment of the present application also provides a site switching device for implementing the site switching method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more site switching device embodiments provided below can refer to the limitations on the site switching method above, and will not be repeated here.
[0136] In one embodiment, Fig.16 As shown, a site switching device is provided, comprising: a receiving module 10 and a switching module 11, wherein:
[0137] The receiving module 10 is used to receive a first switching instruction sent by the slave site; the first switching instruction is generated by the slave site according to the fault type of the slave site;
[0138] The switching module 11 is used to call a script file corresponding to the fault type to perform a switching operation according to a first switching instruction.
[0139] In one embodiment, Fig.17 As shown, the switching module 11 includes: a generating unit 110 and a sending unit 111, wherein:
[0140] The generating unit 110 is specifically configured to generate a second switching instruction by calling a script file corresponding to the fault type according to the first switching instruction;
[0141] The sending unit 111 is specifically configured to send a second switching instruction to the gateway to instruct the gateway to route the business service of the secondary site to the primary site, and return the switching result to the primary site.
[0142] In one embodiment, Fig.18 As shown, the above device also includes:
[0143] The display module 12 is used to display prompt information, where the prompt information is used to prompt the user that the primary site is performing a site switching operation.
[0144] In one embodiment, Fig.19 As shown, the above device further includes: a receiving module 13 and a replacing module 14, wherein:
[0145] The receiving module 13 is used to receive the switching result returned by the gateway; the switching result includes switching success information or switching failure information;
[0146] The replacement module 14 is used to replace the prompt information with the switching result and display it.
[0147] In one embodiment, Fig. 20 As shown, a site switching device is provided, including: a determination module 20, a switching module 21, wherein:
[0148] A determination module 20, used to determine the fault type of the slave site;
[0149] The switching module 21 is used to determine whether to perform site switching according to the fault type. If site switching is performed, a first switching instruction is sent to the primary site to instruct the primary site to call a script file corresponding to the fault type to perform a switching operation according to the first switching instruction.
[0150] In one embodiment, the above-mentioned failure types include: any one of: data replication delay failure, system disk failure, business data response failure, downtime failure, database table failure, and replication component failure.
[0151] In one embodiment, Fig.21 As shown, if the fault type is a data replication delay fault or a system disk fault, the switching module 21 includes: a first acquisition unit 210, a first determination unit 211, and a second determination unit 212, wherein:
[0152] The first acquisition unit 210 is specifically used to acquire the number of alarms corresponding to the data replication delay failure or the system disk failure within a preset time period;
[0153] The first determining unit 211 is specifically configured to determine to perform site switching if the number of alarms is greater than a preset threshold;
[0154] The second determining unit 212 is specifically configured to determine not to perform site switching if the number of alarm times is not greater than a preset threshold.
[0155] In one embodiment, Fig. 22 As shown, if the fault type is a service data response fault, the switching module 21 includes: a second acquisition unit 213, a third determination unit 214, and a fourth determination unit 215, wherein:
[0156] The second acquisition unit 213 is specifically used to acquire the business data response characteristics; the business data response characteristics include the business data response time or the business data response success ratio;
[0157] The third determining unit 214 is specifically configured to determine to perform site switching if the data response characteristic meets a preset condition;
[0158] The fourth determining unit 215 is specifically configured to determine not to perform site switching if the data response characteristic does not meet a preset condition.
[0159] Each module in the above-mentioned site switching device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0160] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.23 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store business data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a site switching method is implemented.
[0161] Those skilled in the art will understand that Fig.23 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0162] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0163] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0164] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0165] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0166] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0167] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A site switching method, characterized in that: The method comprises: receiving a first switching instruction sent by a slave site; the first switching instruction is generated by the slave site according to the fault type generated by the slave site; the first switching instruction corresponds to the fault type generated by the slave site one by one; the fault type includes at least one of a data replication delay fault, a system disk fault, a business data response fault, a whole machine downtime fault, a whole machine partition downtime fault, a database table fault, a replication component fault, etc.; Extract the fault information generated by the slave site from the first switching instruction, and determine the fault type based on the fault information; generate a script file corresponding to the fault type based on the fault type, and call the script file corresponding to the fault type to perform a switching operation; the script file corresponding to the fault type is a script file automatically generated by the master site according to the fault type of the slave site.
2. The method according to claim 1, characterized in that The calling of the script file corresponding to the fault type to perform the switching operation includes: Calling a script file corresponding to the fault type according to the first switching instruction to generate a second switching instruction; The second switching instruction is sent to the gateway to instruct the gateway to route the business service of the slave site to the master site, and return the switching result to the master site.
3. The method according to claim 1 or 2, characterized in that: After receiving the first switching instruction sent from the site, the method further includes: Display prompt information; the prompt information is used to prompt the user that the main site is performing a site switching operation.
4. The method according to claim 3, characterized in that: The method further comprises: receiving a switching result returned by the gateway; the switching result includes switching success information or switching failure information; The prompt information is replaced by the switching result and displayed.
5. A site switching method, characterized in that: The method comprises: Determine the fault type of the slave site; Determine whether to perform site switching according to the fault type. If site switching is to be performed, send a first switching instruction to the master site to instruct the master site to call a script file corresponding to the fault type to perform a switching operation according to the first switching instruction; the first switching instruction is generated by the slave site according to the fault type generated by the slave site; the first switching instruction corresponds one-to-one to the fault type generated by the slave site.
6. The method according to claim 5, characterized in that The failure type includes: at least one of: data replication delay failure, system disk failure, business data response failure, downtime failure, database table failure, and replication component failure.
7. The method according to claim 6, characterized in that If the fault type is a data replication delay fault or a system disk fault, determining whether to perform site switching according to the fault type includes: Obtaining the number of alarms corresponding to the data replication delay failure or the system disk failure within a preset time period; If the alarm number is greater than a preset threshold, determining to switch the site; If the alarm number is not greater than the preset threshold, it is determined not to perform site switching.
8. The method according to claim 6, characterized in that If the fault type is a service data response fault, determining whether to perform site switching according to the fault type includes: Acquire business data response characteristics; the business data response characteristics include business data response time or business data response success ratio; If the data response characteristic meets the preset condition, determining to perform site switching; If the data response characteristic does not meet the preset condition, it is determined not to perform site switching.
9. A site switching device, characterized in that: The device comprises: A receiving module, configured to receive a first switching instruction sent by a slave site; the first switching instruction is generated by the slave site according to a fault type of the slave site; the first switching instruction corresponds to a fault type generated by the slave site in a one-to-one manner; the fault type includes at least one of a data replication delay fault, a system disk fault, a business data response fault, a whole machine downtime fault, a whole machine partition downtime fault, a database table fault, a replication component fault, etc.; A switching module is used to extract the fault information generated by the slave site from the first switching instruction, and determine the fault type according to the fault information; generate a script file corresponding to the fault type according to the fault type, and call the script file corresponding to the fault type to perform a switching operation; the script file corresponding to the fault type is a script file automatically generated by the master site according to the fault type of the slave site.
10. A site switching device, characterized in that: The device comprises: A determination module, used to determine the fault type of the slave site; A sending module is used to determine whether to perform site switching according to the fault type. If site switching is performed, a first switching instruction is sent to the master site to instruct the master site to call a script file corresponding to the fault type according to the first switching instruction to perform a switching operation; the first switching instruction has a one-to-one correspondence with the fault type generated by the slave site; the first switching instruction is generated by the slave site according to the fault type generated by the slave site; the first switching instruction has a one-to-one correspondence with the fault type generated by the slave site.
11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
