A method, apparatus, electronic device, and storage medium for detecting the status of a database

By performing real-time state detection on the database server and the database itself, the problem of untimely database status detection in the existing technology is solved, and the security of database services is improved.

CN115080367BActive Publication Date: 2025-06-13NETSUNION CLEARING CORP
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110268256.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-11
Publication Date
2025-06-13
Estimated Expiration
2041-03-11

AI Technical Summary

Technical Problem

The existing technology only judges the database status after the business transaction fails, and cannot determine whether the current state of the database is an abnormal state in a timely manner, which is not conducive to ensuring the availability of database services.

Method used

By obtaining the server status detection table, database status detection table and server information of the target database, the target server of the target database is detected according to the server IP, and the server status detection table is updated according to the available status detection results of the target server. When the available status detection result of the target server is normal, the available status detection of the target database is performed based on the database port of the target server, and the database status detection table is updated based on the available status detection result of the target database.

Benefits of technology

Real-time detection of the available status of the target server and database itself of the target database is achieved, and timely determination of whether there are abnormalities in the target database, so as to take emergency measures in a timely manner to improve the security of database business.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115080367B_ABST
    Figure CN115080367B_ABST
Patent Text Reader

Abstract

The present application provides a database status detection method, apparatus, electronic device, and storage medium. The method includes: obtaining a server status detection table, a database status detection table, and server information of a target database; performing an availability status detection on a target server corresponding to the target database according to the server IP, and updating the server status detection table according to the availability status detection result of the target server; when it is determined that the availability status detection result of the target server is a normal status, performing an availability status detection on the target database according to the database port of the target server, and updating the database status detection table according to the availability status detection result of the target database. It is possible to detect the availability status of the target server corresponding to the target database and the database itself in real time, so as to timely determine whether the target database has an abnormality, and thus timely take corresponding emergency measures, laying a foundation for improving the security of database services.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of database technology, and in particular, to a database status detection method, apparatus, electronic device, and storage medium. Background Art

[0002] With the development of information technology, databases have been widely applied in all walks of life. In order to ensure the availability of database services, how to monitor the current status of a database has become a key research content.

[0003] In the prior art, usually when a business transaction fails, it is determined that the current database is in an abnormal state, and an alarm message is generated to remind the operator to take safety measures in time.

[0004] However, the prior art judges the database status only after a business transaction fails, and it is impossible to timely determine whether the current status of the database is abnormal, which is not conducive to ensuring the availability of database services. Summary of the Invention

[0005] This application provides a database status detection method, apparatus, electronic device, and storage medium to solve the defects such as untimely detection of the database status in the prior art.

[0006] The first aspect of this application provides a database status detection method, including:

[0007] Obtain a server status detection table, a database status detection table, and server information of a target database; wherein, the server information includes a server IP and a corresponding database port;

[0008] According to the server IP, perform an availability status detection on a target server corresponding to the target database, and update the server status detection table according to the availability status detection result of the target server;

[0009] When it is determined that the availability status detection result of the target server is a normal state, perform an availability status detection on the target database according to the database port of the target server, and update the database status detection table according to the availability status detection result of the target database.

[0010] Optionally, after it is determined that the availability status detection result of the target database is a normal state, the method further includes:

[0011] Obtain role information of the target database;

[0012] When the role information indicates that the target database is a standby database, obtain the synchronization status information of the target database;

[0013] Detect the synchronization status of the target database according to the synchronization status information, and generate a corresponding synchronization status detection result.

[0014] Optionally, after determining that the synchronization status detection result of the target database is in a normal state, the method further includes:

[0015] Obtain the synchronization delay information of the target database;

[0016] Judge whether there is a delay fault in the target database according to the synchronization delay information, and generate a corresponding delay fault detection result.

[0017] Optionally, it further includes:

[0018] Obtain the kick-out information of the current service in the kick-out information table;

[0019] Determine the offline database that has been kicked out according to the kick-out information;

[0020] Judge whether the server corresponding to the offline database is in an abnormal state according to the server status detection table;

[0021] Judge whether the offline database is in an abnormal state according to the database status detection table;

[0022] When it is determined that the server corresponding to the offline database is in an abnormal state, set a kicked-out flag for the available state detection result corresponding to the server, or when the offline database is in an abnormal state, set a kicked-out flag for the available state detection result corresponding to the offline database.

[0023] Optionally, it further includes:

[0024] When it is determined that the server corresponding to the offline database is in a normal state and the offline database is in a normal state, generate a kick-out alarm message.

[0025] Optionally, the detecting the available state of the target server corresponding to the target database according to the server IP address includes:

[0026] Send an IP response instruction to the server IP;

[0027] Determine the available state detection result of the target server according to the instruction response situation of the server IP.

[0028] Optionally, the detecting the available state of the target database according to the database port of the target server includes:

[0029] Send a port response instruction to the database port;

[0030] Determine the availability status detection result of the target database according to the instruction response situation of the database port.

[0031] The second aspect of this application provides a database status detection device, including:

[0032] An acquisition module, configured to acquire a server status detection table, a database status detection table, and server information of the target database; wherein, the server information includes a server IP and a corresponding database port;

[0033] A first detection module, configured to perform an availability status detection on the target server corresponding to the target database according to the server IP, and update the server status detection table according to the availability status detection result of the target server;

[0034] A second detection module, configured to, when determining that the availability status detection result of the target server is a normal state, perform an availability status detection on the target database according to the database port of the target server, and update the database status detection table according to the availability status detection result of the target database.

[0035] Optionally, the device further includes a third detection module, configured to:

[0036] Acquire the role information of the target database;

[0037] When the role information indicates that the target database is a standby database, acquire the synchronization status information of the target database;

[0038] Detect the synchronization status of the target database according to the synchronization status information, and generate a corresponding synchronization status detection result.

[0039] Optionally, the device further includes a fourth detection module, configured to:

[0040] Acquire the synchronization delay information of the target database;

[0041] Judge whether there is a delay fault in the target database according to the synchronization delay information, and generate a corresponding delay fault detection result.

[0042] Optionally, the device further includes a fifth detection module, configured to:

[0043] Acquire the kick-out information of the current service in the kick-out information table;

[0044] Determine the offline database that has undergone kick-out according to the kick-out information;

[0045] Judge whether the server corresponding to the offline database is in an abnormal state according to the server status detection table;

[0046] Based on the database status detection table, determine whether the offline database is in an abnormal state;

[0047] When it is determined that the server corresponding to the offline database is in an abnormal state, set a kicked database flag for the detection result of the available state corresponding to the server, or, when the offline database is in an abnormal state, set a kicked database flag for the detection result of the available state corresponding to the offline database.

[0048] Optionally, the fifth detection module is further configured to:

[0049] When it is currently determined that the server corresponding to the offline database is in a normal state and the offline database is in a normal state, generate a kicked database alarm message.

[0050] Optionally, the first detection module is specifically configured to:

[0051] Send an IP response instruction to the server IP;

[0052] Determine the detection result of the available state of the target server according to the instruction response situation of the server IP.

[0053] Optionally, the second detection module is specifically configured to:

[0054] Send a port response instruction to the database port;

[0055] Determine the detection result of the available state of the target database according to the instruction response situation of the database port.

[0056] A third aspect of the present application provides an electronic device, including: at least one processor and a memory;

[0057] The memory stores computer execution instructions;

[0058] The at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the method described in the first aspect above and various possible designs of the first aspect.

[0059] A fourth aspect of the present application provides a computer-readable storage medium, in which computer execution instructions are stored, and when the processor executes the computer execution instructions, the method described in the first aspect above and various possible designs of the first aspect is implemented.

[0060] The technical solution of the present application has the following advantages:

[0061] The database status detection method, device, electronic device, and storage medium provided by this application obtain a server status detection table, a database status detection table, and server information of a target database; where the server information includes a server IP and a corresponding database port; perform an availability status detection on the target server corresponding to the target database according to the server IP, and update the server status detection table according to the availability status detection result of the target server; when it is determined that the availability status detection result of the target server is normal, perform an availability status detection on the target database according to the database port of the target server, and update the database status detection table according to the availability status detection result of the target database. The method provided by the above solution can detect the availability status of the target server corresponding to the target database and the database itself in real time, timely determine whether the target database has an abnormality, and thus take corresponding emergency measures in a timely manner, laying a foundation for improving the security of database services. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of this application, and those of ordinary skill in the art can also obtain other drawings based on these drawings.

[0063] Figure 1 It is a schematic structural diagram of a database status detection system based on an embodiment of this application;

[0064] Figure 2 It is a schematic flowchart of a database status detection method provided by an embodiment of this application;

[0065] Figure 3 It is a schematic overall flowchart of a database status detection method provided by an embodiment of this application;

[0066] Figure 4 It is a schematic structural diagram of a database status detection device provided by an embodiment of this application;

[0067] Figure 5 It is a schematic structural diagram of an electronic device provided by an embodiment of this application.

[0068] Through the above drawings, the clear embodiments of this application have been shown, and there will be more detailed descriptions later. These drawings and text descriptions are not intended to limit the scope of the concept of this disclosure in any way, but to illustrate the concept of this application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0069] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the following will clearly and completely describe the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are some but not all of the embodiments of this application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of this application without creative efforts shall fall within the scope of protection of this application.

[0070] In addition, terms such as "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. In the description of the following embodiments, "a plurality" means two or more unless otherwise specifically defined.

[0071] In the prior art, usually when it is found that a business transaction fails, the current database is determined to be in an abnormal state, and an alarm message is generated to remind the operator to take safety measures in a timely manner. However, the prior art judges the database state in the case of a business transaction failure and cannot determine in a timely manner whether the current state of the database is an abnormal state, which is not conducive to ensuring the security of database services.

[0072] In view of the above problems, the database state detection method, device, electronic device, and storage medium provided by the embodiments of this application obtain a server state detection table, a database state detection table, and server information of the target database; where the server information includes the server IP and the corresponding database port; according to the server IP, perform an availability status detection on the target server corresponding to the target database, and update the server state detection table according to the availability status detection result of the target server; when it is determined that the availability status detection result of the target server is a normal state, perform an availability status detection on the target database according to the database port of the target server, and update the database state detection table according to the availability status detection result of the target database. The method provided by the above solution can detect the availability status of the target server corresponding to the target database and the database itself in real time to timely determine whether the target database is abnormal, so as to take corresponding emergency measures in a timely manner, laying a foundation for improving the security of database services.

[0073] The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below with reference to the accompanying drawings.

[0074] First, the structure of the database state detection system on which this application is based will be described:

[0075] The database state detection method, device, electronic device, and storage medium provided by the embodiments of this application are applicable to detecting the state of a database. AsFigure 1 As shown in the figure, it is a schematic structural diagram of the database status detection system based on the embodiments of the present application, mainly including a database, a server corresponding to the database, and a database status detection device for detecting the status of the database. Specifically, the database status detection device detects the current status of the database and its corresponding server according to the obtained server information, and generates a corresponding status detection result.

[0076] The embodiments of the present application provide a database status detection method for detecting the status of a database. The execution subject of the embodiments of the present application is an electronic device, such as a server, a desktop computer, a laptop computer, a tablet computer, and other electronic devices that can be used to detect the status of a database.

[0077] As Figure 2 shown in the figure, it is a schematic flow diagram of the database status detection method provided by the embodiments of the present application. The method includes:

[0078] Step 201, obtain a server status detection table, a database status detection table, and the server information of the target database.

[0079] Among them, the server information includes the server IP and the corresponding database port.

[0080] It should be explained that the server status detection table records the historical status detection records of multiple servers, and the database status detection table records the historical status detection records of multiple databases.

[0081] Step 202, perform an availability status detection on the target server corresponding to the target database according to the server IP, and update the server status detection table according to the availability status detection result of the target server.

[0082] Specifically, during the process of detecting the status of the target server, the server status detection table is updated according to the obtained availability status detection result, so that the server status detection table conforms to the actual situation of the current network.

[0083] Specifically, in one embodiment, an IP response instruction can be sent to the server IP; according to the instruction response situation of the server IP, the availability status detection result of the target server is determined.

[0084] It should be explained that the IP response instruction is mainly used to verify whether the server IP can be pinged, that is, whether the server IP is normal.

[0085] Specifically, if the instruction response of the server IP is normal, it is determined that the target server is in a normal state. On the contrary, if the server IP cannot respond normally, it is determined that the target server is in an abnormal state, that is, the target server is in a down state.

[0086] Step 203, when it is determined that the availability status detection result of the target server is normal, perform an availability status detection on the target database according to the database port of the target server, and update the database status detection table according to the availability status detection result of the target database.

[0087] On the contrary, if the availability status detection result of the target server is abnormal, it can be determined that the corresponding target database must be abnormal, and there is no need to perform an availability status detection on the target database itself.

[0088] It should be explained that the database port refers to the interaction port provided by the target server for the target database, and the target database conducts business interactions based on this database port.

[0089] Specifically, during the process of performing an availability status detection on the target database, update the database status detection table according to the obtained availability status detection result, so that the database status detection table conforms to the actual situation of the current network.

[0090] Specifically, in one embodiment, a port response instruction can be sent to the database port; according to the instruction response situation of the database port, determine the status detection result of the target database.

[0091] It should be explained that the process of performing a status detection on the target database is similar to the process of detecting the availability status of the target server provided in the above embodiment. The port response instruction is also used to determine whether the database port is normal. If it is determined that the database port is normal, it can be determined that the target database can conduct business interactions normally, and thus it can be determined that the target database is in a normal state.

[0092] Based on the above embodiment, since the status evaluation criteria for the primary database and the standby database are different when performing a status detection on the database, therefore, in order to perform a more reliable status detection on the standby database, in one embodiment, after it is determined that the availability status detection result of the target database is normal, the method further includes:

[0093] Step 301, obtain the role information of the target database;

[0094] Step 302, when the role information indicates that the target database is a standby database, obtain the synchronization status information of the target database;

[0095] Step 303, detect the synchronization status of the target database according to the synchronization status information, and generate a corresponding synchronization status detection result.

[0096] Correspondingly, if it is determined that the target database is the primary database according to the role information of the target database, no subsequent synchronization status detection is performed.

[0097] It should be noted that the synchronization status information may refer to the synchronization status value feedback by the target database, which mainly reflects whether the target database can communicate with the master database normally and whether it can obtain the backup log generated by the master database normally, etc.

[0098] Specifically, if the target database is a standby database and the synchronization status detection result is normal, it can be determined that the database is in a normal state. On the contrary, if the synchronization status detection result is abnormal, it can be determined that the database is in an abnormal state, and the above database status detection table is updated according to the synchronization status detection result.

[0099] Furthermore, in one embodiment, in order to further improve the reliability of the database status detection result, after determining that the synchronization status detection result of the target database is in a normal state, the synchronization delay information of the target database can be obtained; according to the synchronization delay information, it is judged whether the target database has a delay fault, and a corresponding delay fault detection result is generated.

[0100] It should be noted that the synchronization delay information mainly reflects the backup log processing speed of the target database, and specifically can be the synchronization delay value feedback by the target database.

[0101] Among them, the abnormal synchronization status and delay fault of the standby database may not directly cause the database to have a transaction failure, but it is not conducive to ensuring the security of the database. Therefore, in order to effectively guarantee the security of the database, it is necessary to detect the synchronization situation of the standby databases in the network.

[0102] Specifically, if the synchronization delay information (synchronization delay value) of the target database is greater than the preset delay threshold, it can be determined that the target database has a delay fault. On the contrary, if the synchronization delay information (synchronization delay value) of the target database is not greater than the preset delay threshold, it can be determined that the target database does not have a delay fault. Furthermore, the above database status detection table is updated according to the delay fault detection result of the target database.

[0103] Specifically, the database status detection method provided by the embodiments of the present application performs status detection on the database and its corresponding server according to a preset status detection cycle, and can discover the abnormality of the database before a business transaction failure occurs in the database. In the case where the status detection result is determined to be abnormal, relevant operators are notified to take emergency measures such as abnormal repair of the database. For the database that has completed abnormal repair, if it is determined that the current status becomes normal after the status detection in the next status detection cycle, it is further updated to the normal state in the corresponding status detection table.

[0104] Exemplarily, such as Figure 3As shown in the figure, it is a schematic diagram of the overall process of the database status detection method provided by the embodiment of the present application. When detecting the status of the target database, first detect the connectivity of the IP port of the target server corresponding to the target database, and update the server status detection table according to the detection result. If the detection result of the available status of the target server is abnormal, end the status detection work. If it is normal, perform the available status detection on the target database itself according to the database port of the target server, and update the database status detection table according to the available status detection result. If the detection result of the available status of the target database is abnormal, end the status detection work. If it is normal, determine whether the target database is a standby database. If it is not a standby database, end the status detection work. If it is a standby database, detect the synchronization status of the target database, and further write the obtained synchronization status detection result into the database status detection table to update the record of the synchronization status detection result of the target database. If the detection result of the synchronization status of the target database is abnormal, end the status detection work. If it is normal, further determine whether there is a latency fault in the target database, and write the obtained latency fault detection result into the database status detection table to update the record of the latency fault detection result of the target database.

[0105] Based on the above embodiment, since the database will no longer provide services externally in the case of the entire set of databases being kicked out, then before the database is restarted, there is no need to perform status detection on it. In order to save status detection resources, as an implementable method, in one embodiment, the method further includes: obtaining the kick-out information of the current service in the kick-out information table; determining the offline database that has been kicked out according to the kick-out information; judging whether the server corresponding to the offline database is in an abnormal state according to the server status detection table; judging whether the offline database is in an abnormal state according to the database status detection table; when it is determined that the server corresponding to the offline database is in an abnormal state, set the kicked-out flag for the available status detection result corresponding to the server, or, when the offline database is in an abnormal state, set the kicked-out flag for the available status detection result corresponding to the offline database.

[0106] It should be explained that the current service is randomly obtained in the current network. This service may be initiated before the database is kicked out. It mainly searches for the corresponding kick-out information in the kick-out information table according to the database information fed back by the current service.

[0107] It should be further explained that since the database is generally kicked out as a whole set of databases, and there are a large number of databases with the same name but in different computer rooms in a network covering multiple computer rooms, in order to distinguish databases with the same name, when determining the offline database, determine the database name of the offline database and the corresponding computer room IDC.

[0108] Specifically, when determining that a certain database is an offline database, check whether there is any abnormal information corresponding to the offline database in the server status detection table and the database status detection table obtained in the above embodiments. Specifically, according to the status detection results recorded in the status detection table, the reason for the kicked database of the offline database can be determined, so that targeted repair measures can be taken. Moreover, adding the information of the kicked database to the corresponding status detection table can avoid performing status detection on the offline database and avoid wasting status detection resources.

[0109] On the contrary, in an embodiment, when it is currently determined that the server corresponding to the offline database is in a normal state and the offline database is in a normal state, a kicked database alarm message is generated.

[0110] Specifically, if the abnormal state of the offline database cannot be proven by checking the previously obtained status detection table and the database is indeed offline, it can be determined that the database is offline for other reasons and has nothing to do with the performance of the database itself. Further, write the kicked database alarm message into the status detection table, that is, record a new fault message with the kicked database status as the kicked database. The kicked database alarm message can also be reported to remind the operator to check whether the offline is caused by improper operation.

[0111] Similarly, referring to the above embodiments, it is possible to determine whether a database has been kicked according to a preset status detection period, and at the same time update and monitor the detection results.

[0112] The database status detection method provided by the embodiments of the present application includes obtaining a server status detection table, a database status detection table, and server information of a target database; where the server information includes the server IP and the corresponding database port; performing an availability status detection on the target server corresponding to the target database according to the server IP, and updating the server status detection table according to the availability status detection result of the target server; when it is determined that the availability status detection result of the target server is in a normal state, performing an availability status detection on the target database according to the database port of the target server, and updating the database status detection table according to the availability status detection result of the target database. The method provided by the above solution can detect the availability status of the target server corresponding to the target database and the database itself in real time, so as to timely determine whether the target database has an abnormality, and thus take corresponding emergency measures in time, laying a foundation for improving the security of database services. Moreover, it is also possible to detect the synchronization status of backup data, improving the reliability of the status detection results. In addition, it is possible to determine the kicked database and the corresponding offline reason, avoiding the waste of status detection resources.

[0113] The embodiments of the present application provide a database status detection device for executing the database status detection method provided by the above embodiments.

[0114] As shown Figure 4 in the figure, it is a schematic structural diagram of a database status detection device provided by an embodiment of the present application. The database status detection device 30 includes an acquisition module 301, a first detection module 302, and a third detection module 303.

[0115] Among them, the acquisition module is used to acquire a server status detection table, a database status detection table, and server information of a target database; wherein, the server information includes a server IP and a corresponding database port; the first detection module is used to perform an availability status detection on a target server corresponding to the target database according to the server IP, and update the server status detection table according to the availability status detection result of the target server; the second detection module is used to perform an availability status detection on the target database according to the database port of the target server when it is determined that the availability status detection result of the target server is a normal status, and update the database status detection table according to the availability status detection result of the target database.

[0116] Regarding the database status detection device in this embodiment, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated here.

[0117] The database status detection device provided by the embodiment of the present application is used to execute the database status detection method provided by the above embodiment, and its implementation manner and principle are the same, and will not be repeated.

[0118] The embodiment of the present application provides an electronic device for executing the database status detection method provided by the above embodiment.

[0119] As shown Figure 5 in the figure, it is a schematic structural diagram of an electronic device provided by an embodiment of the present application. The electronic device 40 includes: at least one processor 41 and a memory 42;

[0120] The memory stores computer-executable instructions; at least one processor executes the computer-executable instructions stored in the memory, so that at least one processor executes the database status detection method provided by the above embodiment.

[0121] The electronic device provided by the embodiment of the present application is used to execute the database status detection method provided by the above embodiment, and its implementation manner and principle are the same, and will not be repeated.

[0122] The embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the database status detection method provided by any of the above embodiments is implemented.

[0123] The storage medium containing computer-executable instructions in the embodiments of the present application can be used to store the computer-executable instructions for the database status detection method provided in the foregoing embodiments. The implementation manner and principle are the same and will not be elaborated herein.

[0124] Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the device described above can refer to the corresponding process in the foregoing method embodiments and will not be elaborated herein.

[0125] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit them. Although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features. These modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for detecting the status of a database, characterized in that, it includes: Obtain the server status detection table, the database status detection table, and the server information of the target database; wherein, the server information includes the server IP and the corresponding database port; According to the server IP, perform an availability status detection on the target server corresponding to the target database, and update the server status detection table according to the availability status detection result of the target server; When it is determined that the availability status detection result of the target server is in a normal state, perform an availability status detection on the target database according to the database port of the target server, and update the database status detection table according to the availability status detection result of the target database; It also includes: Obtain the kick-out information of the current service in the kick-out information table; According to the kick-out information, determine the offline database where kick-out has occurred; According to the server status detection table, determine whether the server corresponding to the offline database is in an abnormal state; According to the database status detection table, determine whether the offline database is in an abnormal state; When it is determined that the server corresponding to the offline database is in an abnormal state, set a kicked-out flag for the availability status detection result of the server, or, when the offline database is in an abnormal state, set a kicked-out flag for the availability status detection result of the offline database.

2. The method according to claim 1, characterized in that, After it is determined that the availability status detection result of the target database is in a normal state, the method further includes: Obtain the role information of the target database; When the role information indicates that the target database is a standby database, obtain the synchronization status information of the target database; According to the synchronization status information, detect the synchronization status of the target database and generate a corresponding synchronization status detection result.

3. The method according to claim 2, characterized in that, After it is determined that the synchronization status detection result of the target database is in a normal state, the method further includes: Obtain the synchronization delay information of the target database; According to the synchronization delay information, determine whether there is a delay fault in the target database and generate a corresponding delay fault detection result.

4. The method according to claim 1, characterized in that, It also includes: When it is determined that the server corresponding to the offline database is in a normal state and the offline database is in a normal state, generate a kick-out alarm message.

5. The method according to claim 1, characterized in that, The performing an availability status detection on the target server corresponding to the target database according to the server IP address includes: Send an IP response instruction to the server IP; According to the instruction response situation of the server IP, determine the availability status detection result of the target server.

6. The method according to claim 1, characterized in that, The performing an availability status detection on the target database according to the database port of the target server includes: Send a port response instruction to the database port; Determine the available status detection result of the target database according to the instruction response situation of the database port.

7. A database status detection device, characterized in that, comprising: an acquisition module, configured to acquire a server status detection table, a database status detection table, and server information of the target database; wherein, the server information includes a server IP and a corresponding database port; a first detection module, configured to perform an available status detection on the target server corresponding to the target database according to the server IP, and update the server status detection table according to the available status detection result of the target server; a second detection module, configured to, when determining that the available status detection result of the target server is a normal status, perform an available status detection on the target database according to the database port of the target server, and update the database status detection table according to the available status detection result of the target database; The device further includes a fifth detection module, configured to: acquire the kick-out information of the current service in the kick-out information table; determine the offline database for which kick-out has occurred according to the kick-out information; judge whether the server corresponding to the offline database is in an abnormal state according to the server status detection table; judge whether the offline database is in an abnormal state according to the database status detection table; when determining that the server corresponding to the offline database is in an abnormal state, set a kicked-out library flag for the available status detection result of the server, or, when the offline database is in an abnormal state, set a kicked-out library flag for the available status detection result of the offline database.

8. An electronic device, characterized in that, comprising: at least one processor and a memory; the memory stores computer execution instructions; the at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, the computer-readable storage medium stores computer execution instructions, and when the processor executes the computer execution instructions, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Database health state detection method and device and equipment

    CN110888776A