Fault processing method and device of database, electronic equipment and storage medium

By automatically detecting database failures and matching repair strategies, automatic repair of database failures is achieved, solving the problems of inefficiency and consistency difficult to ensure due to manual operations in the existing technology, and improving the efficiency and accuracy of database failure handling.

CN119473777APending Publication Date: 2025-02-18ZUNYI BRANCH OF CHINA MOBILE GRP GUIZHOU COMPANY +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411530930.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In the prior art, database fault processing relies on manual operations, resulting in low fault processing efficiency, difficult data consistency, and inability to ensure the availability of the database in real time.

Method used

By detecting data response time on the to-be-monitor database, the fault is automatically judged and the fault information is sent to the preset terminal, and the fault repair strategy is matched from the preset database based on the fault information, and the fault repair operation is automatically executed.

Benefits of technology

It realizes automatic detection and repair of database failures, improves the efficiency and accuracy of fault handling, and ensures real-time availability of the database and data consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473777A_ABST
    Figure CN119473777A_ABST
Patent Text Reader

Abstract

According to the database fault processing method and device, the electronic equipment and the storage medium provided by the invention, data detection is performed on the to-be-monitored database to obtain the data response time; wherein the to-be-monitored database comprises a master database and a slave database, and the data response time is the time when the data in the slave database responds to the data in the master database; performing fault judgment on the to-be-monitored database according to the data response time to obtain fault information, and sending the fault information to a preset terminal; matching is carried out from a preset database according to the fault information, a fault repair strategy is obtained, fault repair is carried out on the to-be-monitored database according to the fault repair strategy, and the repaired to-be-monitored database is obtained. Compared with the prior art, the method has the advantages that the detected fault is automatically repaired by automatically detecting the fault of the database and matching the corresponding repair strategy in the database according to the obtained fault information, human participation is not needed in the whole process, and the efficiency and accuracy of database fault processing can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a database fault processing method and device, an electronic device, and a storage medium. Background Art

[0002] With the continuous emergence and accelerated maturity of emerging technologies such as cloud native, chaos engineering, artificial intelligence, and observability, the technical level of automated operation and maintenance means is always in a state of technological iteration and accelerated innovation. At the same time, with the increasing requirements for data security, data consistency, and reliability, it is necessary to fully guarantee the stability and reliability of the database and improve data consistency and reliability through self-healing processing. Therefore, automation platforms and platform self-healing are becoming increasingly important.

[0003] In the prior art, when a database fails, the operator will be notified via phone and text message. After receiving the phone and text message notifications, the operator needs to check and analyze the corresponding fault information and manually restore the database failure. However, when manually restoring the database failure, the operator needs to have a certain level of technical proficiency and it takes a long time. At the same time, the data consistency cannot be guaranteed throughout the entire process from fault discovery to fault handling to data repair, and the operator cannot guarantee data consistency 100%. If multiple faults occur at a certain point in time, they cannot be quickly resolved manually and can only be analyzed and viewed one by one, which cannot guarantee the real-time availability of the database. Manual operation has a certain fault tolerance and may cause secondary damage to the database.

[0004] Therefore, how to automatically detect database failures and perform repair operations to improve the efficiency and accuracy of database failure handling is a problem that needs to be solved urgently. Summary of the invention

[0005] The present invention provides a database fault handling method and device, electronic device and storage medium, which mainly aims to solve the problem of how to automatically detect database faults and perform repair operations to improve the efficiency and accuracy of database fault handling.

[0006] According to a first aspect of the present disclosure, a method for handling a database failure is provided, comprising:

[0007] Performing data detection processing on the database to be monitored to obtain the data response time of the database to be monitored; wherein the database to be monitored includes a master database and a slave database, and the data response time is the time it takes for the data in the slave database to respond to the data in the master database;

[0008] Performing fault judgment on the database to be monitored according to the data response time, obtaining fault information of the database to be monitored, and sending the fault information to a preset terminal;

[0009] According to the fault information, matching processing is performed from a preset database to obtain a fault repair strategy, and according to the fault repair strategy, fault repair processing is performed on the database to be monitored to obtain a repaired database to be monitored.

[0010] Optionally, the performing fault judgment on the database to be monitored according to the data response time to obtain fault information of the database to be monitored includes:

[0011] In the case where the data response time is less than a first preset time threshold, setting the preset parameter value corresponding to the database to be monitored to a first value; wherein the preset parameter value is a pre-configured value for marking the database to be monitored;

[0012] When the data response time is greater than or equal to the second preset time threshold and less than or equal to the third preset time threshold, re-perform data detection processing on the database to be monitored; wherein the second preset time threshold is greater than or equal to the first preset time threshold, and the third preset time threshold is greater than the second preset time threshold;

[0013] In the case where the data response time is greater than a fourth preset time threshold, the preset parameter value corresponding to the database to be monitored is set to a second value; wherein the fourth preset time threshold is greater than or equal to the third preset time threshold;

[0014] Performing a numerical detection process on the preset parameter value, and determining that there is no fault in the database to be monitored when detecting that the preset parameter value is set to the first numerical value;

[0015] When it is detected that the preset parameter value is set to the second value, it is determined that a fault exists in the database to be monitored, and information extraction processing is performed on the database to be monitored to obtain the fault information.

[0016] Optionally, sending the fault information to a preset terminal includes:

[0017] Periodically sending the fault information to a first terminal and obtaining response information from the first terminal; wherein the preset terminal includes at least the first terminal and the second terminal;

[0018] When it is determined according to the response information that the first terminal has not responded within a first preset time period, the fault information is periodically sent to the second terminal.

[0019] Optionally, performing matching processing from a preset database according to the fault information to obtain a fault repair strategy includes:

[0020] In the case where a corresponding fault code number is matched from the preset database according to the fault information, a first repair strategy is determined: wherein the fault repair strategy includes the first repair strategy and the second repair strategy;

[0021] In the case that a corresponding fault code number is not matched from the preset database according to the fault information, the second repair strategy is determined.

[0022] Optionally, when a corresponding fault code number is matched from the preset database according to the fault information, determining the first repair strategy includes:

[0023] Extracting the difference data between the master database and the slave database, the log file of the master database and the backup data of the slave database; wherein the backup data includes the backup of all data of the slave database;

[0024] Statement generation processing is performed according to the fault code number, the difference data, the log file, and the backup data to obtain the first repair strategy.

[0025] Optionally, when no corresponding fault code number is matched from the preset database according to the fault information, determining the second repair strategy includes:

[0026] A statement generation process is performed according to the preset code number and the backup data to obtain the second repair strategy.

[0027] Optionally, performing fault repair processing on the database to be monitored according to the fault repair strategy to obtain a repaired database to be monitored includes:

[0028] Extracting difference data between the master database and the slave database, and generating a difference log according to the difference data;

[0029] Data compensation processing is performed on the slave database according to the difference log and the fault repair strategy to obtain the repaired database to be monitored.

[0030] Optionally, after performing fault repair processing on the database to be monitored according to the fault repair strategy to obtain a repaired database to be monitored, the method further includes:

[0031] Acquire first database information of the master database and second database information of the slave database; wherein the first database information at least includes all the data in the master database, and the second database information at least includes all the data in the slave database;

[0032] Processing the first database information into a table to obtain first table data, and processing the second database information into a table to obtain second table data;

[0033] Compare each data in the first table data with each row of data in the second table data using a preset comparison algorithm to obtain a comparison result;

[0034] When the comparison result is a preset result threshold, determining that the repaired database to be monitored has no faults;

[0035] When the comparison result is not equal to the preset result threshold, it is determined that the repaired database to be monitored has a fault, and the database to be monitored is repaired again according to the fault repair strategy.

[0036] According to a second aspect of the present disclosure, a database fault handling device is provided, comprising:

[0037] A detection unit, used for performing data detection processing on a database to be monitored to obtain a data response time of the database to be monitored; wherein the database to be monitored includes a master database and a slave database, and the data response time is the time it takes for data in the slave database to respond to data in the master database;

[0038] A judgment unit, configured to judge a fault of the database to be monitored according to the data response time, and obtain fault information of the database to be monitored;

[0039] A sending unit, used for sending the fault information to a preset terminal;

[0040] A matching unit, configured to perform matching processing from a preset database according to the fault information to obtain a fault repair strategy;

[0041] The repair unit is used to perform fault repair processing on the database to be monitored according to the fault repair strategy to obtain a repaired database to be monitored.

[0042] Optionally, the judging unit includes:

[0043] A setting module, configured to set the preset parameter value corresponding to the database to be monitored to a first value when the data response time is less than a first preset time threshold; wherein the preset parameter value is a pre-configured value for marking the database to be monitored;

[0044] a detection module, configured to re-perform data detection processing on the database to be monitored when the data response time is greater than or equal to the second preset time threshold and less than or equal to a third preset time threshold; wherein the second preset time threshold is greater than or equal to the first preset time threshold, and the third preset time threshold is greater than the second preset time threshold;

[0045] The setting module is also used to set the preset parameter value corresponding to the database to be monitored to a second value when the data response time is greater than a fourth preset time threshold; wherein the fourth preset time threshold is greater than or equal to the third preset time threshold;

[0046] a determination module, configured to perform a numerical detection process on the preset parameter value, and determine that the database to be monitored does not have a fault when detecting that the preset parameter value is set to the first numerical value;

[0047] The determination module is further configured to determine that a fault exists in the database to be monitored when it is detected that the preset parameter value is set to the second value;

[0048] The extraction module is used to extract information from the database to be monitored to obtain the fault information.

[0049] Optionally, the sending unit includes:

[0050] A sending module, used for periodically sending the fault information to the first terminal;

[0051] An acquisition module, configured to acquire response information of the first terminal; wherein the preset terminal includes at least the first terminal and the second terminal;

[0052] The sending module is further configured to periodically send the fault information to the second terminal when it is determined according to the response information that the first terminal has not responded within a first preset time period.

[0053] Optionally, the matching unit is further used for:

[0054] In the case where a corresponding fault code number is matched from the preset database according to the fault information, a first repair strategy is determined: wherein the fault repair strategy includes the first repair strategy and the second repair strategy;

[0055] In the case that a corresponding fault code number is not matched from the preset database according to the fault information, the second repair strategy is determined.

[0056] Optionally, the matching unit is further used for:

[0057] Extracting the difference data between the master database and the slave database, the log file of the master database and the backup data of the slave database; wherein the backup data includes the backup of all data of the slave database;

[0058] Statement generation processing is performed according to the fault code number, the difference data, the log file, and the backup data to obtain the first repair strategy.

[0059] Optionally, the matching unit is further used for:

[0060] A statement generation process is performed according to the preset code number and the backup data to obtain the second repair strategy.

[0061] Optionally, the repair unit includes:

[0062] An extraction module, used for extracting difference data between the master database and the slave database, and generating a difference log according to the difference data;

[0063] A processing module is used to perform data compensation processing on the slave database according to the difference log and the fault repair strategy to obtain the repaired database to be monitored.

[0064] Optionally, the device further comprises:

[0065] An acquisition unit, configured to acquire first database information of the master database and second database information of the slave database; wherein the first database information at least includes all data in the master database, and the second database information at least includes all data in the slave database;

[0066] A processing unit, configured to process the first database information in a tabular form to obtain first tabular data, and to process the second database information in a tabular form to obtain second tabular data;

[0067] a comparison unit, configured to compare each data in the first table data with each row of data in the second table data by using a preset comparison algorithm to obtain a comparison result;

[0068] A determination unit, configured to determine that the repaired database to be monitored has no faults if the comparison result is a preset result threshold;

[0069] The determining unit is further configured to, when the comparison result is not equal to a preset result threshold, determine that the repaired database to be monitored has a fault, and perform fault repair processing on the database to be monitored again according to the fault repair strategy.

[0070] According to a third aspect of the present disclosure, there is provided an electronic device, including:

[0071] at least one processor; and

[0072] a memory communicatively connected to the at least one processor; wherein,

[0073] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.

[0074] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the first aspect.

[0075] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method as described in the first aspect above.

[0076] The database fault handling method and device, electronic device and storage medium provided by the present disclosure perform data detection processing on the monitored database to obtain the data response time of the monitored database; wherein the monitored database includes a master database and a slave database, and the data response time is the time for the data in the slave database to respond to the data in the master database; perform fault judgment on the monitored database according to the data response time, obtain the fault information of the monitored database, and send the fault information to a preset terminal; perform matching processing from the preset database according to the fault information to obtain a fault repair strategy, perform fault repair processing on the monitored database according to the fault repair strategy, and obtain a repaired monitored database. Compared with the related art, the embodiment of the present disclosure automatically detects the fault of the database, matches the corresponding repair strategy in the database according to the acquired fault information, and automatically repairs the detected fault, without human participation in the whole process, which can improve the efficiency and accuracy of database fault handling.

[0077] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0079] Figure 1 A flowchart of a database fault handling method provided by an embodiment of the present disclosure;

[0080] Figure 2 A logical diagram of database fault processing provided by an embodiment of the present disclosure;

[0081] Figure 3 A schematic diagram of a database fault detection and notification process provided by an embodiment of the present disclosure;

[0082] Figure 4 A schematic diagram of a process for obtaining a fault repair strategy provided by an embodiment of the present disclosure;

[0083] Figure 5 A schematic diagram of a data repair process provided by an embodiment of the present disclosure;

[0084] Figure 6 A schematic diagram of the structure of a database fault processing device provided by an embodiment of the present disclosure;

[0085] Figure 7 A schematic diagram of the structure of another database fault processing device provided by an embodiment of the present disclosure;

[0086] Figure 8 A schematic block diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0087] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0088] A database fault handling method provided by the embodiments of the present disclosure can improve efficiency, reduce risks, perform real-time monitoring and response, automate operation and maintenance, and quickly recover from faults. It can greatly improve the stability and reliability of synchronous operation, automatically determine whether master and slave data are consistent, and perform repairs in a timely manner, thereby enhancing the availability of production environment data and business continuity, and ensuring the healthy use of the production environment.

[0089] It should be noted that the method provided by the embodiment of the present disclosure can be implemented through a custom-set automation program, such as a watchdog program, etc., wherein the automation program has the ability to self-heal faults of the host, database, etc., and the supported functions include but are not limited to: script support (shell), python, interface call, host various indicator monitoring, interface secondary development, algorithm call and algorithm type selection, parameter indicator summary, indicator switch implementation, etc. It can achieve the effect of rapid self-healing of faults and reduce the repetitive work of operation and maintenance personnel.

[0090] At the same time, for newly added category disturbance scenarios or sub-operation flow batch tasks, the construction of automated programs covers multiple types of scripting languages ​​and boot configurations, rich interface protocols, and hundreds of resource type extension modules. The watchdog can be directly customized to call, and through built-in rich timing settings and automatic settings of inspection scripts, API interface calls, setting of strict scheduling tasks, alarm upgrades, data verification, data algorithm implementation, data repair selection and other functions, it ensures that when there are problems with the database, the corresponding problems are handled in a timely manner and the corresponding personnel are notified.

[0091] The following describes a database fault handling method, device, electronic device, and storage medium according to an embodiment of the present disclosure with reference to the accompanying drawings.

[0092] Figure 1 A flowchart of a database fault handling method provided by an embodiment of the present disclosure.

[0093] like Figure 1 As shown, the method comprises the following steps:

[0094] Step 101, perform data detection processing on a database to be monitored to obtain a data response time of the database to be monitored; wherein the database to be monitored includes a master database and a slave database, and the data response time is the time it takes for the data in the slave database to respond to the data in the master database.

[0095] In the embodiment of the present disclosure, the database to be monitored is a database that requires fault detection and fault processing, such as a master-slave database, etc. Specifically, the embodiment of the present disclosure does not limit the type of the database to be monitored.

[0096] It should be noted that, in the embodiments of the present disclosure, fault detection and fault repair of the monitored database can be achieved through a custom-set automated program, such as a watchdog program, etc., and the data detection of the monitored database is real-time detection, for example: by periodically or automatically deploying corresponding shell, python and other scripts in the watchdog, the master-slave status detection (data detection) of the monitored database is achieved.

[0097] Step 102: Perform fault judgment on the database to be monitored according to the data response time, obtain fault information of the database to be monitored, and send the fault information to a preset terminal.

[0098] In the disclosed embodiment, when performing fault judgment on the monitored database, it is determined whether the monitored database has a fault by using a pre-set parameter value (preset parameter value). For example, it is determined whether the status of the monitored database is normal by setting a parameter value inside the watchdog program. The watchdog program updates the internally set parameter value according to the data response time. A parameter value (preset parameter value) of 1 indicates that the monitored database is normal, and a parameter value of 0 indicates that the monitored database is abnormal.

[0099] Specifically, the fault judgment of the database to be monitored can be carried out in the following ways, but not limited to: periodically perform data detection processing on the database to be monitored, for example: a total of 5 detections, 2 times per second, etc., and then it can be divided into the following situations:

[0100] 1. If a data response time of millisecond level is detected (i.e., the data response time is in millisecond level), the parameter value set inside the watchdog program is directly updated to 1;

[0101] 2. If the data response time is 1-9 seconds, the watchdog attempts to re-detect the database to be monitored to avoid errors caused by network fluctuations;

[0102] 3. If the data response time is greater than 10 seconds, the parameter value set inside the watchdog program is directly updated to 0. At the same time, when the parameter value is 1, it is determined that the master-slave state is normal (the monitored database has no faults), and when the parameter value is 0, the master-slave state has problems (the monitored database has faults).

[0103] Among them, the preset terminal is a custom-set terminal, such as a mobile phone, computer, etc. When the fault information is sent to the preset terminal, it needs to be sent in stages. For example, the watchdog program calls the corresponding API interface to transmit the fault information to the alarm program, and triggers the alarm program to send the fault information to the corresponding operation and maintenance personnel. At the same time, it is set that if the first-level operation and maintenance personnel does not respond within 5 minutes (notify 5 times, once per minute) (such as: the phone is not answered), the alarm program will upgrade the alarm level and send the fault information to the second-level operation and maintenance personnel.

[0104] Step 103 , matching processing is performed from a preset database according to the fault information to obtain a fault repair strategy, and fault repair processing is performed on the database to be monitored according to the fault repair strategy to obtain a repaired database to be monitored.

[0105] In the disclosed embodiment, when repairing the data of the database to be monitored, it is necessary to implement it according to the warehouse domain (preset database) of the watchdog program. There are multiple algorithm structures in the warehouse domain (preset database). There are certain interface pipelines between each algorithm. There is a one-to-one correspondence between the algorithm and the interface. Enter the fault information in the warehouse domain to match the corresponding error code information (error code information: common error code number of master-slave replication). At this time, it will be divided into 2 situations: the first one: the error code information can be matched in the warehouse domain, and the second one: the error code information is not matched in the warehouse domain. Among them, different situations correspond to different fault repair strategies.

[0106] When performing fault repair, data compensation can be performed on the difference logs existing in the slave database according to the fault repair strategy, and recovery statements are formed and executed in sequence in the slave database to eventually achieve the data compensation effect. When the database compensation is completed, the repaired database to be monitored can be obtained.

[0107] Regarding the specific logic description of the embodiment of the present disclosure, the embodiment of the present disclosure provides a logical diagram of database fault processing, such as Figure 2 As shown, informing the operation and maintenance personnel is the process of sending the fault information; the synchronous recovery instruction is the process of data repair; the parameter switch and parameter summary are the process of fault judgment.

[0108] The database fault handling method provided by the present disclosure performs data detection processing on the monitored database to obtain the data response time of the monitored database; wherein the monitored database includes a master database and a slave database, and the data response time is the time for the data in the slave database to respond to the data in the master database; the database to be monitored is judged for faults according to the data response time to obtain fault information of the monitored database, and the fault information is sent to a preset terminal; matching processing is performed from the preset database according to the fault information to obtain a fault repair strategy, and the database to be monitored is repaired according to the fault repair strategy to obtain a repaired database to be monitored. Compared with the related art, the embodiment of the present disclosure automatically detects database faults, matches the corresponding repair strategy in the database according to the acquired fault information, and automatically repairs the detected faults, without requiring human intervention throughout the process, which can improve the efficiency and accuracy of database fault handling.

[0109] In an implementable manner of the embodiment of the present disclosure, the fault judgment of the database to be monitored can be implemented in the following manner but is not limited to: when the data response time is less than the first preset time threshold, the preset parameter value corresponding to the database to be monitored is set to a first value; wherein the preset parameter value is a pre-configured value for marking the database to be monitored; when the data response time is greater than or equal to the second preset time threshold and less than or equal to the third preset time threshold, the database to be monitored is re-performed with data detection processing; wherein the second preset time threshold is greater than or equal to the first preset time threshold, and the third preset time threshold is greater than the second preset time threshold; when the data response time is greater than the fourth preset time threshold, the preset parameter value corresponding to the database to be monitored is set to a second value; wherein the fourth preset time threshold is greater than or equal to the third preset time threshold; the preset parameter value is value-detected, and when it is detected that the preset parameter value is set to the first value, it is determined that the database to be monitored does not have a fault; when it is detected that the preset parameter value is set to the second value, it is determined that the database to be monitored has a fault, and information extraction processing is performed on the database to be monitored to obtain the fault information.

[0110] In the embodiment of the present disclosure, the first preset time threshold, the second preset time threshold, the third preset time threshold and the fourth preset time threshold are time thresholds set by custom settings, for example: 1 second, 9 seconds, 10 seconds, etc. Specifically, the embodiment of the present disclosure does not limit the settings of the first preset time threshold, the second preset time threshold, the third preset time threshold and the fourth preset time threshold.

[0111] The first value is a custom value, for example, 1, and the second value is also a custom value, for example, 0. Meanwhile, the first value is different from the second value.

[0112] When performing fault judgment on the database to be monitored, the following method can be adopted: start a watchdog program between the master database and the slave database of the database to be monitored, deploy a heartbeat detection mechanism in the watchdog program, and the watchdog converts the heartbeat detection database accordingly, and determines that the total detection is 5 times, 2 times per second.

[0113] It is divided into the following situations: when the data response time is less than 1 second (the first preset time threshold), the preset parameter value is updated to 1; when the data response time is greater than 1 second (the second preset time threshold) and less than 9 seconds (the third preset time threshold), the watchdog program attempts to retry (i.e., re-detect the data on the database to be monitored) to avoid errors caused by network fluctuations; when the data response time is greater than 10 seconds (the fourth preset time threshold), the preset parameter value is updated to 0. When the preset parameter value is 1, it is determined that the master-slave state is normal (the database to be monitored has no faults), and when the preset parameter value is 0, there is a problem with the master-slave state (the database to be monitored has faults).

[0114] Furthermore, the updating of the preset parameters may be performed by, but not limited to, the following algorithm:

[0115] X=(Ωsum(T[a][b]Θhash(x[b])O(1))) / (O(log n))

[0116] Among them, a is the initial time, b is the end time, n is a constant, X is the updated preset parameter value (displayed as 0 or 1 according to the algorithm result), the initial time is the start time of the data response time, and the end time is the end time of the data response time, that is, [a][b] is the data response time.

[0117] In one implementable manner of the embodiment of the present disclosure, sending the fault information to a preset terminal can be implemented in the following manner but is not limited to: periodically sending the fault information to a first terminal and obtaining response information of the first terminal; wherein the preset terminal includes at least the first terminal and a second terminal; and when it is determined according to the response information that the first terminal has not responded within a first preset time period, periodically sending the fault information to the second terminal.

[0118] In the disclosed embodiment, in order to ensure that the operation and maintenance personnel can receive fault information, it is necessary to perform hierarchical processing when sending faults, that is, send the fault information to the operation and maintenance personnel (for example, telephone). If the operation and maintenance personnel does not respond (missed the call), that is, the platform does not receive the feedback information package, it will be directly upgraded to another operation and maintenance personnel (send the fault information to another operation and maintenance personnel) to ensure that the operation and maintenance personnel know the fault information as soon as possible.

[0119] The first terminal and the second terminal respectively represent terminal devices carried by different operation and maintenance personnel. The logic for sending fault information may be implemented by, but is not limited to, the following algorithm:

[0120] First-level notification algorithm: X((T2-T1) / hash(T))maxοN1*T*p

[0121] Second level notification algorithm: X((T2-T1) / hash(T))maxωN2*T*p

[0122] Among them, T1: is the time when the database failure is first detected, T2: is the time when the database failure is second detected, N1: first-level notification person (first terminal), N2 second-level notification person (second terminal) T: timestamp, p: connection preset terminal data (such as: telephone number, etc.) X: is the fixed parameter value of the alarm output (updated preset parameter value).

[0123] Regarding the above-mentioned data detection of the monitored database and notification to the operation and maintenance personnel, the embodiment of the present disclosure provides a flowchart of database fault detection and notification, such as Figure 3 As shown, database detection and algorithm determination are the database fault detection process; alarm upgrade and upgrade algorithm are the process of notifying operation and maintenance personnel.

[0124] In an implementable manner of the embodiment of the present disclosure, because there are two situations when matching from a preset database according to the fault information, namely, the first situation: the error code information can be matched in the warehouse domain, and the second situation: the error code information is not matched in the warehouse domain. Therefore, regarding the acquisition of the fault repair strategy, the embodiment of the present disclosure provides a flow chart of the acquisition of the fault repair strategy, as shown in FIG. Figure 4 As shown, including:

[0125] Step 401, when a corresponding fault code number is matched from the preset database according to the fault information, a first repair strategy is determined: wherein the fault repair strategy includes the first repair strategy and the second repair strategy.

[0126] In the embodiment of the present disclosure, if the error code information can be matched in the warehouse domain, it is necessary to obtain the first repair strategy, and perform data repair processing through the first repair strategy. In the process of obtaining the first repair strategy, it is necessary to obtain the program statement (such as: SQL statement) corresponding to the first repair strategy. The acquisition of the program statement corresponding to the first repair strategy can be implemented by but not limited to the following algorithm:

[0127] Sql=X(gtd1-gtdN)logωB

[0128] Wherein, N is a positive integer, Gtd1: the site information currently executed by the slave database, gtdN: the site information currently executed by the master database, log: the binary log file of the master database (the log file), X: represents the common master-slave fault error code number (fault code number), B: the most recent full backup data (the backup data of the slave database), Sql: the formed sql statement (the program statement corresponding to the first repair strategy), gtd1 and gtdN are used to determine the difference data, and (gtd1-gtdN) is the difference data.

[0129] Step 402: When no corresponding fault code number is matched from the preset database according to the fault information, determine the second repair strategy.

[0130] In the disclosed embodiment, if the error code information is not matched in the warehouse domain, it is necessary to obtain the second repair strategy and perform data repair processing through the second repair strategy. In the process of obtaining the second repair strategy, it is necessary to obtain the program statement corresponding to the second repair strategy (such as: SQL statement).

[0131] Specifically, it can be implemented in the following manner, but not limited to: if the error code information is not matched, the database will be restored through the most recent full backup data (the backup data), and the program statement corresponding to the second repair strategy can be:

[0132] SQL = X(gtd1-gtdN)log

[0133] N is a positive integer, and X=0 is set. (gtd1-gtdN)log is directly uncallable. At this time, the program statement corresponding to the second repair strategy can be obtained from the latest full backup data of the database to perform data repair.

[0134] In an implementable manner of the embodiment of the present disclosure, related to the above-mentioned embodiment, a specific method for determining the first repair strategy can be implemented by but not limited to the following method: extracting the difference data between the master database and the slave database, the log file of the master database, and the backup data of the slave database; wherein the backup data includes a backup of all data of the slave database; and performing statement generation processing according to the fault code number, the difference data, the log file, and the backup data to obtain the first repair strategy.

[0135] In the disclosed embodiment, the backup data is the most recent full backup data of the slave database.

[0136] In one implementable manner of the disclosed embodiment, related to the above-mentioned embodiment, a specific method for determining the second repair strategy can be implemented by, but not limited to, the following method: statement generation processing is performed according to a preset code number and the backup data to obtain the second repair strategy.

[0137] In one implementable manner of the embodiment of the present disclosure, when performing fault repair processing on the database to be monitored, it can be implemented in but not limited to the following manner: extracting the difference data between the master database and the slave database, and generating a difference log based on the difference data; performing data compensation processing on the slave database based on the difference log and the fault repair strategy to obtain the repaired database to be monitored.

[0138] In the disclosed embodiment, data compensation can be performed on the difference logs existing in the slave database according to the fault repair strategy, and recovery statements are formed and executed in sequence in the slave database to finally achieve the data compensation effect. When the database compensation is completed, the repaired database to be monitored can be obtained.

[0139] In one implementable manner of the embodiment of the present disclosure, after the database to be monitored is repaired, the repaired database to be monitored needs to be verified to determine whether the repaired database to be monitored is a normal database (i.e., to determine whether the repaired database to be monitored has no faults). Therefore, in order to verify the repaired database to be monitored, the following manner may also be adopted but is not limited to: obtaining the first database information of the master database and the second database information of the slave database; wherein the first database information at least includes all the data in the master database, and the second database information at least includes all the data in the slave database; processing the first database information in a tabular form to obtain first table data, and processing the second database information in a tabular form to obtain second table data; comparing each data in the first table data with each row of data in the second table data through a preset comparison algorithm to obtain a comparison result; when the comparison result is a preset result threshold, determining that the repaired database to be monitored has no faults; when the comparison result is not a preset result threshold, determining that the repaired database to be monitored has a fault, and re-performing fault repair processing on the database to be monitored according to the fault repair strategy.

[0140] In the embodiment of the present disclosure, when performing the last step of the relatively important data verification function, the method mainly adopts the method of determining the values ​​of all table data rows of the existing master-slave database (the repaired database to be monitored). Specifically, the verification method can be implemented by but not limited to the following algorithm:

[0141] Co=(A(shema.table)*NB(shema.table)*N)Sql

[0142] Among them, Co: specifies the value size of each row (the comparison result) (the difference is divided into 0 and non-0), Shema: library information, Table: table information, N: natural number, A: main database, B: slave database, the number of data rows and data size in the monitored database are counted, and after the statistics are completed, the counted data are put into the table, and finally compared with the data in the table to obtain the comparison result. According to the comparison result, it can be determined whether the data is consistent.

[0143] Specifically, when Co=0, it means that the data of the master database and the slave database are consistent (that is, the repaired database to be monitored does not have any faults). When Co is non-zero, it means that there are certain differences between the master and slave databases (that is, the repaired database to be monitored still has faults). At this time, the SQL program (the program statement corresponding to the fault repair strategy) will be re-triggered to re-perform data repair processing.

[0144] Regarding the data repair of the above-mentioned database to be monitored, the embodiment of the present disclosure provides a flow chart of data repair, such as Figure 5 shown.

[0145] In summary, the embodiments of the present disclosure can achieve the following effects:

[0146] 1. The disclosed embodiment automatically detects database faults, matches corresponding repair strategies in the database according to the acquired fault information, and automatically repairs the detected faults without human intervention throughout the process, thereby improving the efficiency and accuracy of database fault handling.

[0147] 2. The disclosed embodiment combines a program interface with an automation platform through a watchdog program. By calling the watchdog program interface, when a fault occurs, the fault type is directly determined through the internal source code of the program, and the fault is repaired through the corresponding fault type. After that, the program is called through the interface to detect the consistency status between the master and slave data, and data consistency is guaranteed through a rich selection of algorithms in the automation platform.

[0148] 3. The disclosed embodiment uses the watchdog program to call the interface to judge the missing data, directly generates the corresponding SQL statement, and executes it in the slave table to judge the consistency status of the master and slave data. No human intervention is required throughout the process, which saves time for the operation and maintenance personnel to handle database failures and improves the work efficiency of the operation and maintenance personnel. At the same time, there is no need for manual repair, there is good fault tolerance, and the consistency, availability and reliability of the database are also guaranteed.

[0149] Corresponding to the above-mentioned database fault handling method, the present invention also provides a database fault handling device. Since the device embodiment of the present invention corresponds to the above-mentioned method embodiment, the details not disclosed in the device embodiment can be referred to the above-mentioned method embodiment, and will not be repeated in the present invention.

[0150] Figure 6 A schematic diagram of a database fault handling device provided by an embodiment of the present disclosure is shown in FIG. Figure 6 As shown, including:

[0151] The detection unit 61 is used to perform data detection processing on the database to be monitored to obtain the data response time of the database to be monitored; wherein the database to be monitored includes a master database and a slave database, and the data response time is the time it takes for the data in the slave database to respond to the data in the master database;

[0152] A judgment unit 62, configured to perform a fault judgment on the database to be monitored according to the data response time, and obtain fault information of the database to be monitored;

[0153] The sending unit 63 is used to send the fault information to a preset terminal;

[0154] A matching unit 64 is used to perform matching processing from a preset database according to the fault information to obtain a fault repair strategy;

[0155] The repair unit 65 is used to perform fault repair processing on the database to be monitored according to the fault repair strategy to obtain a repaired database to be monitored.

[0156] The database fault handling device provided by the present disclosure performs data detection processing on the monitored database to obtain the data response time of the monitored database; wherein the monitored database includes a master database and a slave database, and the data response time is the time for the data in the slave database to respond to the data in the master database; performs fault judgment on the monitored database according to the data response time, obtains the fault information of the monitored database, and sends the fault information to a preset terminal; performs matching processing from the preset database according to the fault information to obtain a fault repair strategy, performs fault repair processing on the monitored database according to the fault repair strategy, and obtains a repaired monitored database. Compared with the related art, the embodiment of the present disclosure automatically detects the fault of the database, matches the corresponding repair strategy in the database according to the acquired fault information, and automatically repairs the detected fault, without human participation in the whole process, which can improve the efficiency and accuracy of database fault handling.

[0157] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 7 As shown, the judging unit 62 includes:

[0158] A setting module 621 is used to set the preset parameter value corresponding to the database to be monitored to a first value when the data response time is less than a first preset time threshold; wherein the preset parameter value is a pre-configured value for marking the database to be monitored;

[0159] A detection module 622 is used to re-perform data detection processing on the database to be monitored when the data response time is greater than or equal to the second preset time threshold and less than or equal to a third preset time threshold; wherein the second preset time threshold is greater than or equal to the first preset time threshold, and the third preset time threshold is greater than the second preset time threshold;

[0160] The setting module 621 is also used to set the preset parameter value corresponding to the database to be monitored to a second value when the data response time is greater than a fourth preset time threshold; wherein the fourth preset time threshold is greater than or equal to the third preset time threshold;

[0161] A determination module 623 is used to perform a numerical detection process on the preset parameter value, and determine that there is no fault in the database to be monitored when it is detected that the preset parameter value is set to the first value;

[0162] The determination module 623 is further configured to determine that a fault exists in the database to be monitored when it is detected that the preset parameter value is set to the second value;

[0163] The extraction module 624 is used to extract information from the database to be monitored to obtain the fault information.

[0164] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 7 As shown, the sending unit 63 includes:

[0165] The sending module 631 is used to periodically send the fault information to the first terminal;

[0166] The acquisition module 632 is used to acquire the response information of the first terminal; wherein the preset terminal includes at least the first terminal and the second terminal;

[0167] The sending module 631 is further configured to periodically send the fault information to the second terminal when it is determined according to the response information that the first terminal has not responded within a first preset time period.

[0168] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 7 As shown, the matching unit 64 is also used for:

[0169] In the case where a corresponding fault code number is matched from the preset database according to the fault information, a first repair strategy is determined: wherein the fault repair strategy includes the first repair strategy and the second repair strategy;

[0170] In the case that a corresponding fault code number is not matched from the preset database according to the fault information, the second repair strategy is determined.

[0171] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 7 As shown, the matching unit 64 is also used for:

[0172] Extracting the difference data between the master database and the slave database, the log file of the master database and the backup data of the slave database; wherein the backup data includes the backup of all data of the slave database;

[0173] Statement generation processing is performed according to the fault code number, the difference data, the log file, and the backup data to obtain the first repair strategy.

[0174] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 7 As shown, the matching unit 64 is also used for:

[0175] A statement generation process is performed according to the preset code number and the backup data to obtain the second repair strategy.

[0176] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 7 As shown, the repair unit 65 includes:

[0177] An extraction module 651 is used to extract difference data between the master database and the slave database, and generate a difference log according to the difference data;

[0178] The processing module 652 is used to perform data compensation processing on the slave database according to the difference log and the fault repair strategy to obtain the repaired database to be monitored.

[0179] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 7 As shown, the device also includes:

[0180] An acquisition unit 66 is used to acquire first database information of the master database and second database information of the slave database; wherein the first database information at least includes all the data in the master database, and the second database information at least includes all the data in the slave database;

[0181] The processing unit 67 is used to process the first database information into a table to obtain first table data, and to process the second database information into a table to obtain second table data;

[0182] A comparison unit 68, configured to compare each data in the first table data with each row of data in the second table data by using a preset comparison algorithm to obtain a comparison result;

[0183] A determination unit 69, configured to determine that the repaired database to be monitored has no faults if the comparison result is a preset result threshold;

[0184] The determining unit 69 is further configured to, when the comparison result is not equal to a preset result threshold, determine that the repaired database to be monitored has a fault, and perform fault repair processing on the database to be monitored again according to the fault repair strategy.

[0185] It should be noted that the above explanation of the method embodiment is also applicable to the device of the embodiment of the present disclosure, and the principle is the same, which is no longer limited in the embodiment of the present disclosure.

[0186] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0187] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0188] like Figure 8As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 802 or a computer program loaded from a storage unit 808 to a RAM (Random Access Memory) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An I / O (Input / Output) interface 805 is also connected to the bus 804.

[0189] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0190] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as a fault handling method for a database. For example, in some embodiments, the fault handling method for a database may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to execute the aforementioned database fault handling method in any other appropriate manner (for example, by means of firmware).

[0191] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a special purpose or general purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0192] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0193] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a RAM, a ROM, an EPROM (Electrically Programmable Read-Only-Memory) or a flash memory, an optical fiber, a CD-ROM (Compact Dis sc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0194] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball), through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0195] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.

[0196] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0197] It should be noted that artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), and includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.

[0198] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0199] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A method for handling database failures, characterized in that: include: Performing data detection processing on the database to be monitored to obtain the data response time of the database to be monitored; wherein the database to be monitored includes a master database and a slave database, and the data response time is the time it takes for the data in the slave database to respond to the data in the master database; Performing fault judgment on the database to be monitored according to the data response time, obtaining fault information of the database to be monitored, and sending the fault information to a preset terminal; According to the fault information, matching processing is performed from a preset database to obtain a fault repair strategy, and according to the fault repair strategy, fault repair processing is performed on the database to be monitored to obtain a repaired database to be monitored.

2. The method according to claim 1, characterized in that The step of performing fault judgment on the database to be monitored according to the data response time to obtain fault information of the database to be monitored includes: In the case where the data response time is less than a first preset time threshold, setting the preset parameter value corresponding to the database to be monitored to a first value; wherein the preset parameter value is a pre-configured value for marking the database to be monitored; When the data response time is greater than or equal to the second preset time threshold and less than or equal to the third preset time threshold, re-perform data detection processing on the database to be monitored; wherein the second preset time threshold is greater than or equal to the first preset time threshold, and the third preset time threshold is greater than the second preset time threshold; In the case where the data response time is greater than a fourth preset time threshold, the preset parameter value corresponding to the database to be monitored is set to a second value; wherein the fourth preset time threshold is greater than or equal to the third preset time threshold; Performing a numerical detection process on the preset parameter value, and determining that there is no fault in the database to be monitored when detecting that the preset parameter value is set to the first numerical value; When it is detected that the preset parameter value is set to the second value, it is determined that a fault exists in the database to be monitored, and information extraction processing is performed on the database to be monitored to obtain the fault information.

3. The method according to claim 1, characterized in that The sending the fault information to a preset terminal comprises: Periodically sending the fault information to a first terminal and obtaining response information from the first terminal; wherein the preset terminal includes at least the first terminal and the second terminal; When it is determined according to the response information that the first terminal has not responded within a first preset time period, the fault information is periodically sent to the second terminal.

4. The method according to claim 1, characterized in that: The matching process is performed from a preset database according to the fault information to obtain a fault repair strategy, which includes: In the case where a corresponding fault code number is matched from the preset database according to the fault information, a first repair strategy is determined: wherein the fault repair strategy includes the first repair strategy and the second repair strategy; In the case that a corresponding fault code number is not matched from the preset database according to the fault information, the second repair strategy is determined.

5. The method according to claim 4, characterized in that In the case where a corresponding fault code number is matched from the preset database according to the fault information, determining the first repair strategy includes: Extracting the difference data between the master database and the slave database, the log file of the master database and the backup data of the slave database; wherein the backup data includes the backup of all data of the slave database; Statement generation processing is performed according to the fault code number, the difference data, the log file, and the backup data to obtain the first repair strategy.

6. The method according to claim 5, characterized in that In the case that a corresponding fault code number is not matched from the preset database according to the fault information, determining the second repair strategy includes: A statement generation process is performed according to the preset code number and the backup data to obtain the second repair strategy.

7. The method according to claim 1, characterized in that The performing fault repair processing on the database to be monitored according to the fault repair strategy to obtain a repaired database to be monitored comprises: Extracting difference data between the master database and the slave database, and generating a difference log according to the difference data; Data compensation processing is performed on the slave database according to the difference log and the fault repair strategy to obtain the repaired database to be monitored.

8. The method according to claim 1, characterized in that: After performing fault repair processing on the database to be monitored according to the fault repair strategy to obtain a repaired database to be monitored, the method further includes: Acquire first database information of the master database and second database information of the slave database; wherein the first database information at least includes all the data in the master database, and the second database information at least includes all the data in the slave database; Processing the first database information into a table to obtain first table data, and processing the second database information into a table to obtain second table data; Compare each data in the first table data with each row of data in the second table data using a preset comparison algorithm to obtain a comparison result; When the comparison result is a preset result threshold, determining that the repaired database to be monitored has no faults; When the comparison result is not equal to the preset result threshold, it is determined that the repaired database to be monitored has a fault, and the database to be monitored is repaired again according to the fault repair strategy.

9. A database fault handling device, characterized in that: include: A detection unit, used for performing data detection processing on a database to be monitored to obtain a data response time of the database to be monitored; wherein the database to be monitored includes a master database and a slave database, and the data response time is the time it takes for the data in the slave database to respond to the data in the master database; A judgment unit, configured to judge a fault of the database to be monitored according to the data response time, and obtain fault information of the database to be monitored; A sending unit, used for sending the fault information to a preset terminal; A matching unit, configured to perform matching processing from a preset database according to the fault information to obtain a fault repair strategy; The repair unit is used to perform fault repair processing on the database to be monitored according to the fault repair strategy to obtain a repaired database to be monitored.

10. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.