Anomaly detection method, apparatus and related device
By using collaborative detection and threshold judgment across multiple management nodes, the accuracy of database node anomaly detection was solved, achieving both accuracy and continuity in anomaly detection.
Patent Information
- Application Number
- CN202611429959.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-15
- Publication Date
- 2026-11-20
AI Technical Summary
In existing technologies, the accuracy of database node anomaly detection is affected, which may lead to misjudgment of the database node's operating status.
Multiple management nodes perform status probes on the same database node, generating multiple status probe results. The source of the anomaly is determined based on the number and distribution of the probe results, and a threshold is used to distinguish between database node anomalies and communication path anomalies.
It improves the accuracy of database node anomaly detection, reduces the possibility of false positives, and ensures the targeted and continuous nature of anomaly handling.
Smart Images

Figure CN123138221A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of database technology, and in particular to an anomaly detection method, apparatus and related equipment. Background Technology
[0002] As the amount of data and business traffic carried by the database increases, a database cluster consisting of multiple database nodes can be used to provide data storage and access services. Deploying a database management system (DBMS) allows for the management of the database nodes within the cluster. The DBMS can obtain information about the database nodes, perform anomaly detection, and determine the operational status of the database nodes.
[0003] During the operation of a database cluster, the database management system (DBMS) can perform anomaly detection on database nodes. For example, the DBMS can send probe requests to database nodes or establish communication connections with them, and obtain the probe results based on the information returned by the database nodes and the communication connection status. The DBMS can then analyze the database nodes based on the probe results to determine whether any anomalies have occurred.
[0004] However, the anomaly detection results obtained by performing status probing on database nodes may deviate from the actual operating status of the database nodes, which will affect the accuracy of database node anomaly detection. Summary of the Invention
[0005] In view of this, this application provides an anomaly detection method to improve the accuracy of database node anomaly detection. Furthermore, this application also provides a corresponding anomaly detection device, computing equipment, computer-readable storage medium, and computer program product.
[0006] Firstly, this application provides an anomaly detection method. This method can be applied to a database management system. The database management system may include multiple management nodes, with a minimum of three management nodes, each managing a first database node. Each management node can perform state probing on the first database node, obtaining multiple state probing results for the first database node. Different state probing results are generated based on state probing performed by different management nodes on the first database node, and each state probing result can be used to characterize the access state of the corresponding management node to the first database node. Further, one of the multiple management nodes can generate an anomaly detection result for the first database node based on the multiple state probing results. The multiple state probing results may include target state probing results, which indicate an anomaly in the access of the management node to the first database node. When the number of target state probing results is greater than a first threshold, the anomaly detection result can be used to indicate an anomaly in the first database node itself; when the number of target state probing results is less than a second threshold, the anomaly detection result can be used to indicate an anomaly in the communication path between the management node that generated the target state probing result and the first database node. The first threshold is greater than the second threshold.
[0007] In this way, multiple management nodes perform state probing on the same first database node, and different state probing results are generated based on the state probing of different management nodes. This allows multiple state probing results to reflect the access status of different management nodes to the first database node. Therefore, the number of target state probing results can reflect the number of management nodes with access anomalies and the distribution range of access anomalies among multiple management nodes. When the number of target state probing results is greater than the first threshold, it indicates that many different management nodes have access anomalies to the same first database node. The access anomalies exhibit commonality across management nodes, thus reducing the possibility of identifying local communication path anomalies as anomalies of the first database node itself, and thus identifying the anomalies at the first database node. When the number of target state probing results is less than the second threshold, it indicates that access anomalies only occur in the access process of a few management nodes to the first database node. The access anomalies exhibit locality, thus identifying the anomalies at the communication path between the corresponding management node and the first database node. By limiting the higher and lower ranges of the number of target state probing results by the first threshold and the second threshold, respectively, the distribution of access anomalies among different management nodes can be used to distinguish between anomalies of the first database node itself and communication path anomalies, thereby improving the accuracy of anomaly detection.
[0008] In one possible implementation, the multiple management nodes may include a first management node and a second management node, and these management nodes may also manage a second database node. The first management node can synchronize the identifiers of the first and second database nodes to the second management node. The first management node can determine first probe allocation information based on the identifiers of the first and second database nodes, and this first probe allocation information can be used to record the database nodes to be probed corresponding to the first management node. Furthermore, the first management node can perform status probes on the database nodes to be probed recorded in the first probe allocation information.
[0009] Thus, by synchronizing the identifiers of the first and second database nodes to the second management node through the first management node, the second management node can obtain the identifier information of the database nodes managed by the database management system, providing a data foundation for different management nodes to perform status probing based on the corresponding database node information. Simultaneously, the first management node determines the first probing allocation information based on the identifiers of the first and second database nodes, and determines the database nodes that need to be probing based on this information. This provides a clear allocation basis for probing tasks targeting multiple database nodes and provides a data foundation for subsequent anomaly detection based on the status probing results obtained from different management nodes.
[0010] In one possible implementation, the target state detection result can be a state detection result where the anomaly count reaches a third threshold. The anomaly count can be used to characterize the number of times that the access state of one of the multiple management nodes to the first database node is continuously determined to be abnormal.
[0011] In this way, the anomaly count can reflect the continuous abnormal access of the management node to the first database node, and when the anomaly count reaches the third threshold, the corresponding state detection result is determined as the target state detection result. This avoids directly generating the target state detection result for subsequent anomaly detection based on only a single access anomaly, reducing the impact of instantaneous network fluctuations or occasional access anomalies on the number of target state detection results, improving the stability of state detection results used for subsequent anomaly detection, and enhancing the reliability of anomaly detection results.
[0012] In one possible implementation, when the anomaly detection result indicates an anomaly in the first database node itself, the communication status between multiple management nodes corresponding to the target status detection result can be further obtained. When the communication status indicates a communication failure among the multiple management nodes corresponding to the target status detection result, a verification result can be generated. The verification result can be used to indicate a communication failure among the multiple management nodes, and that the first database node itself has not experienced an anomaly.
[0013] Thus, after initially determining the anomaly of the first database node based on multiple state detection results, further verification can be performed using the communication status between the multiple management nodes that generated the target state detection results. When communication failures exist between multiple management nodes, it is possible to identify situations where multiple management nodes simultaneously exhibit abnormal state detection results due to communication failures between management nodes. This reduces the likelihood of identifying the first database node as an anomaly solely based on the access status of multiple management nodes to the first database node, thereby improving the accuracy of anomaly detection and fault source differentiation for the first database node.
[0014] In one possible implementation, when the anomaly detection result indicates an anomaly in the first database node itself, the database service provided by the first database node can be switched to another database node, or the database service provided by the first database node can be stopped. When the anomaly detection result indicates an anomaly in the communication path between the management node corresponding to the target state probe result and the first database node, an anomaly response operation can be executed. The anomaly response operation can be used to mitigate the impact of communication path anomalies on the state probe of the first database node.
[0015] Thus, when the first database node itself experiences an anomaly, appropriate handling can be performed for that anomaly, reducing the impact of the anomaly continuing to provide database services. Similarly, when an anomaly occurs in the communication path between the management node and the first database node, corresponding anomaly response operations can be executed for the communication path anomaly, without treating it as an anomaly of the first database node itself. This allows for the adoption of appropriate anomaly handling methods for different anomaly sources, improving the targeting of anomaly handling and reducing the impact of different anomalies on the database management process.
[0016] In one possible implementation, when the first management node malfunctions, the second management node can determine second probe allocation information based on the identifiers of the first and second database nodes. The second probe allocation information can be used to record the database nodes to be probed corresponding to the second management node, and these database nodes may include those corresponding to the first management node. Furthermore, the second management node can perform status probes on the database nodes to be probed recorded in the second probe allocation information.
[0017] Thus, after the first management node malfunctions, the second management node can continue to perform state probing on at least some of the database nodes originally corresponding to the first management node. This ensures that the corresponding database nodes can still obtain state probing even after the first management node malfunctions. This reduces the possibility of interruption or omission in database node state probing caused by a single management node malfunction, improves the continuity of database node state probing, and continues to provide a data foundation for anomaly detection based on state probing results from multiple management nodes.
[0018] Secondly, this application also provides an anomaly detection device. The anomaly detection device can be applied to a database management system. The database management system may include multiple management nodes, with the number of management nodes not less than three, and these multiple management nodes can manage a first database node. The anomaly detection device may include a detection module and a generation module. The detection module can be used to perform state detection on the first database node through multiple management nodes, obtaining multiple state detection results for the first database node. Different state detection results are generated based on state detection performed on the first database node by different management nodes, and each state detection result can be used to characterize the access state of the corresponding management node to the first database node. The generation module can be used to generate an anomaly detection result for the first database node based on the multiple state detection results. When the number of target state detection results among the multiple state detection results is greater than a first threshold, the anomaly detection result can be used to indicate that the first database node itself is abnormal, and the target state detection result can be used to indicate that the management node's access to the first database node is abnormal; when the number of target state detection results is less than a second threshold, the anomaly detection result can be used to indicate that the communication path between the management node that generated the target state detection result and the first database node is abnormal. The first threshold is greater than the second threshold.
[0019] In one possible implementation, the multiple management nodes may include a first management node and a second management node, and these multiple management nodes may also manage a second database node. The anomaly detection device may further include a synchronization module and a determination module. The synchronization module may be used to synchronize the identifiers of the first and second database nodes to the second management node via the first management node. The determination module may be used to determine first probe allocation information based on the identifiers of the first and second database nodes via the first management node. The first probe allocation information may be used to record the database nodes to be probed corresponding to the first management node. The probe module may also be used to perform status probes on the database nodes to be probed recorded in the first probe allocation information via the first management node.
[0020] In one possible implementation, the determination module can also be used to determine the anomaly count value corresponding to the state detection result, and when the anomaly count value reaches a third threshold, determine the corresponding state detection result as the target state detection result. The anomaly count value can be used to characterize the number of times the access state of one of the multiple management nodes to the first database node is continuously determined to be abnormal.
[0021] In one possible implementation, the anomaly detection device may also include an acquisition module.
[0022] The acquisition module can be used to acquire the communication status between multiple management nodes corresponding to the target status detection result when the anomaly detection result indicates that the first database node itself is abnormal. The generation module can also be used to generate a verification result when the communication status indicates that there is a communication failure between the multiple management nodes corresponding to the target status detection result. The verification result can be used to indicate a communication failure and to indicate that the first database node itself has not experienced an anomaly.
[0023] In one possible implementation, the anomaly detection device may further include an execution module. The execution module can be used to switch the database service provided by the first database node to another database node, or to stop the first database node from providing database services, when the anomaly detection result indicates that the first database node itself is abnormal. The execution module can also be used to perform anomaly response operations when the anomaly detection result indicates that the communication path between the management node corresponding to the target state probe result and the first database node is abnormal. The anomaly response operations can be used to reduce the impact of communication path abnormalities on the state probe of the first database node.
[0024] In one possible implementation, when the first management node malfunctions, the determination module can further be used to determine the second probe allocation information based on the identifiers of the first and second database nodes through the second management node. The second probe allocation information can be used to record the database nodes to be probed corresponding to the second management node, and these database nodes may include the database nodes to be probed corresponding to the first management node. The probe module can also be used by the second management node to perform status probes on the database nodes to be probed recorded in the second probe allocation information.
[0025] In any of the above possible implementations, the different functional modules in the anomaly detection device can be implemented separately through independent software or hardware modules, or they can be integrated by two or more functional modules. The specific processing procedures corresponding to each functional module in the anomaly detection device can be found in the description of the corresponding anomaly detection method in the first aspect, and will not be repeated here.
[0026] Thirdly, this application provides a computing device. The computing device may include a processor and a memory, and the processor and memory can communicate with each other. The processor executes instructions stored in the memory to cause the computing device to perform an exception detection method as described in the first aspect or any implementation thereof. The memory may be integrated into the processor or may be independent of the processor. The computing device may also include a bus. The processor is connected to the memory via the bus. The memory may include read-only memory and random access memory.
[0027] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium can store a computer program, which, when executed by a processor, can implement the anomaly detection method provided in the first aspect and any possible implementation thereof.
[0028] Fifthly, this application also provides a computer program product. The computer program product may include a computer program, which, when executed by a processor, can implement the anomaly detection method provided in the first aspect and any possible implementation thereof.
[0029] The beneficial effects of the anomaly detection device, computing device, computer-readable storage medium, and computer program product provided in the second to fifth aspects above can be found in the relevant descriptions in the first aspect and various possible implementations of the first aspect, and will not be repeated here.
[0030] Based on the implementation methods provided above, this application can further combine the technical features of different implementation methods to provide more implementation methods capable of anomaly detection. Attached Figure Description
[0031] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0032] Figure 1 This application provides a schematic diagram of the structure of a database management system according to an embodiment of the present application. Figure 2 A schematic diagram of the interaction flow of an anomaly detection method provided in an embodiment of this application; Figure 3 A timing diagram illustrating the allocation, execution, and result synchronization of a detection task, provided for an embodiment of this application; Figure 4A timing diagram illustrating the detection period and timeout determination provided in an embodiment of this application; Figure 5 This is a schematic diagram illustrating the process of generating and judging anomaly detection results, provided in an embodiment of this application. Figure 6 A flowchart illustrating an anomaly detection result verification and differentiated response provided in this application embodiment; Figure 7 This is a schematic diagram of the structure of an anomaly detection device provided in an embodiment of this application; Figure 8 This is a schematic diagram of the hardware structure of a computing device provided in an embodiment of this application. Detailed Implementation
[0033] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some, not all, of the embodiments of this application. Other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort may also fall within the scope of protection of this application.
[0034] To facilitate understanding of the subsequent embodiments, some of the technical concepts involved in this application will be explained below.
[0035] A database management system is a system used to manage one or more database nodes or database clusters and to perform tasks such as status monitoring, anomaly detection, fault handling, or database maintenance.
[0036] A management node can be a computing node in a database management system capable of performing at least one of the following processes: database management, database node status detection, anomaly detection, or anomaly response. Management nodes can be implemented using physical servers, virtual machines, container instances, or other running instances with computing capabilities.
[0037] A database node is a node that is managed by a database management system and can provide data storage, data access, transaction processing, or other database services. Database nodes can be implemented through physical devices running database services or virtual computing instances.
[0038] Access status refers to the state formed when a management node accesses a database node, reflecting whether the management node can access the database node normally. Access status can include states such as access normal, access error, connection error, or response timeout.
[0039] State probing can be the process by which a management node obtains access status by accessing a database node. For example, a management node can attempt to establish a communication connection with a database node, or after the communication connection is established, it can send a probe request, execute a lightweight query, or execute a health check command supported by the database.
[0040] Status probe results can be information formed based on status probes, characterizing the access status of a management node to a database node. Status probe results can include normal or abnormal states, and can also include at least one of the following: management node identifier, database node identifier, probe time, response duration, error type, or other probe information.
[0041] The target status detection result can be a status detection result used to indicate that the management node has detected an access anomaly to the database node currently being detected and that the corresponding preset conditions are met.
[0042] The communication path refers to the communication links and related network infrastructure that the management node uses when accessing the database node. An abnormality in the communication path may prevent the management node from accessing the database node, but it does not necessarily indicate that the database node itself is malfunctioning.
[0043] Lightweight queries are database queries primarily used to verify database connections or database service response status, with relatively low processing overhead. Management nodes can execute lightweight queries to determine whether database nodes can normally receive and process database requests.
[0044] The Raft protocol can be a protocol for achieving consistency management among multiple management nodes. In one possible implementation, one management node can assume the role of leader, and other management nodes can assume the role of follower, synchronizing relevant management information through methods such as log replication.
[0045] A consistency log is a log used in a consistency protocol to record and synchronize management information. Database node information, probe-related information, state probe results, or management data related to state probe results can all be recorded or synchronized as information in the consistency log.
[0046] Heartbeat messages can be messages that are periodically or repeatedly transmitted between management nodes to determine whether the management nodes can communicate normally or whether the management nodes can operate normally.
[0047] A network partition can be a communication network between multiple management nodes that has been separated into two or more isolated communication areas due to a network failure. Management nodes located within the same communication area can exchange information normally, while management nodes located in different communication areas may not be able to exchange information normally.
[0048] Automated operation and maintenance can be a processing method in which the database management system automatically triggers database management or anomaly handling operations based on anomaly detection results, without requiring manual triggering each time.
[0049] Operational and maintenance (O&M) processes can include management operations performed on database nodes or database clusters. For example, O&M processes can include at least one of the following: database service switching, stopping database services, node isolation, node replacement, or database cluster reconfiguration.
[0050] The technical solutions in this application will now be described with reference to the accompanying drawings.
[0051] See Figure 1 This is a schematic diagram of the structure of an exemplary database management system 100. Figure 1 As shown, the database management system 100 may include an anomaly detection device 110, a database cluster 120, and a communication network layer 130. Figure 1 The anomaly detection device 110 may include a first management node, a second management node, and a third management node, and the database cluster 120 may include a first database node, a second database node, and a third database node, as illustrated below.
[0052] The anomaly detection device 110 may include multiple management nodes. The anomaly detection device 110 can be implemented through software, hardware, or a combination of software and hardware.
[0053] When the anomaly detection device 110 is implemented by software, the anomaly detection device 110 may include one or more program processes running on a physical server, virtual machine or container. Figure 1 The first, second, and third management nodes can be implemented by different program instances or running instances. Different management nodes can run on different physical servers, or they can run in isolated virtual machines or containers.
[0054] When the anomaly detection device 110 is implemented in hardware, it can be implemented by multiple computing devices with data processing and communication capabilities. For example, a management node can be implemented by a server, workstation, or other computing device. Different management nodes in the anomaly detection device 110 can be implemented by different computing devices, or they can be implemented by mutually independent operating environments provided by the same computing device. This application does not limit the specific implementation form of the anomaly detection device 110 and its management nodes.
[0055] Database nodes can be implemented using physical devices or virtual computing instances that run database services. For example, a database node can be a database instance running on a physical server, or it can be a database instance running in a virtual machine, container, or other virtual computing environment. Multiple database nodes can be deployed on the same or different physical devices.
[0056] Database cluster 120 can include two or more database nodes. Figure 1 The example described uses a database cluster 120 with three database nodes. In practical applications, the database cluster 120 may include more or fewer database nodes, and this application does not impose any limitations on this. The database cluster 120 may be, for example, a relational database cluster, a key-value database cluster, a cache database cluster, a time-series database cluster, or other types of database clusters. The database management system 100 can also manage one or more database clusters simultaneously. Different database clusters may use the same database type or different database types.
[0057] The communication network layer 130 can be implemented through a wired communication network, a wireless communication network, or a combination of both. For example, the communication network layer 130 may include at least one of a local area network (LAN), a wide area network (WAN), a virtual local area network (VLAN), a virtual private network (VPN), or other networks capable of establishing communication connections between nodes. Figure 1 The communication network between different nodes is uniformly abstracted and represented as communication network layer 130, which does not mean that there is only one physical network in the database management system 100.
[0058] exist Figure 1In the database management system 100 shown, the database management system 100 can obtain the running status of each database node in the database cluster 120. After a database node fails, the database management system 100 can also perform database management or maintenance procedures based on the corresponding anomaly detection results.
[0059] In a real-world scenario, the database management system 100 can perform status probing on database nodes through one of its management nodes. For example, a management node can periodically send status probing requests to the first database node. When the first database node returns a normal probing response, the management node can determine that the first database node is in a normal state; when the first database node does not return a probing response, the response times out, or the communication connection fails to be established, the management node can determine the corresponding probing result as abnormal and further determine that the first database node has encountered an anomaly.
[0060] In this scenario, the management node actually receives the result of whether it can access the first database node normally. However, "the management node cannot access the first database node normally" is not entirely equivalent to "the first database node itself is abnormal." For example, if the database process in the first database node malfunctions, the database service stops, or the computing device where the first database node is located fails, the management node may be unable to access the first database node normally.
[0061] On the other hand, even if the first database node itself is still running normally, if there is a network interruption, network congestion, routing anomaly, switching equipment malfunction, or other communication failure in the communication path between the management node and the first database node, the management node may also be unable to access the first database node normally.
[0062] In other words, a single state detection result from a management node typically only reflects the access status from the perspective of that management node to the database node, and it's difficult to further determine whether the access anomaly originates from the database node itself or from the communication path between the management node and the database node. If an access anomaly from a management node is directly used as the basis for determining whether a database node itself is experiencing an anomaly, then even if the actual anomaly originates from a local communication path, a normally functioning database node might be incorrectly identified as an abnormal database node. Furthermore, when performing automated maintenance based on this anomaly detection result, the database management system 100 might also perform database service switching, database service shutdown, or other maintenance procedures on normal database nodes, thereby affecting the normal database service provided by the database cluster 120.
[0063] Based on this, Figure 1In the database management system 100 shown, the anomaly detection device 110 can perform status detection on the same database node through multiple management nodes, and generate anomaly detection results for the database node by combining the multiple status detection results formed by different management nodes.
[0064] Specifically, taking the first database node as an example, at least two of the first, second, and third management nodes can access the first database node through the communication network layer 130. Different management nodes can each perform state probes on the first database node and generate corresponding state probe results. Therefore, the multiple state probe results obtained for the first database node are not generated by repeated probes from the same management node, but rather can be generated based on state probes performed on the first database node by different management nodes. In this way, multiple state probe results can reflect the access status of different management nodes to the same first database node.
[0065] Based on multiple state probe results, the anomaly detection device 110 can generate an anomaly detection result for the first database node. In one possible implementation, the anomaly detection device 110 can obtain state probe results from multiple different management nodes through one of the management nodes, and the management node can perform the anomaly detection result generation process. The anomaly detection device 110 can determine the target state probe result from the multiple state probe results to indicate that the management node's access to the first database node is abnormal, and determine the source of the anomaly based on the number of target state probe results. For example, when the number of target state probe results is greater than a first threshold, it indicates that many different management nodes have experienced access anomalies to the first database node, and the generated anomaly detection result can be used to indicate that the first database node itself is abnormal. When the number of target state probe results is less than a second threshold, it indicates that the access anomaly mainly occurs during the process of fewer management nodes accessing the first database node, and the generated anomaly detection result can be used to indicate that the communication path between the management node that generated the target state probe result and the first database node is abnormal, wherein the first threshold is greater than the second threshold.
[0066] The specific values of the first and second thresholds can be determined based on the number of management nodes participating in the detection of the first database node, the deployment scale of the database management system 100, or the anomaly detection requirements. The specific process of generating anomaly detection results based on the number of target state detection results will be further explained later with reference to the corresponding accompanying figures.
[0067] In this way, this application does not directly determine whether a database node is abnormal based on the access status of a single management node. Instead, it uses multiple different management nodes to form access perspectives for the same database node and determines the source of the abnormality based on the distribution of abnormal access among different management nodes.
[0068] This reduces the likelihood of local communication anomalies on the management node side being mistakenly identified as database node anomalies, improves the accuracy of database node anomaly detection and anomaly source differentiation, and further reduces the possibility of performing incorrect maintenance operations on normal database nodes based on erroneous anomaly detection results. Moreover, multiple management nodes in the anomaly detection device 110 can jointly undertake the status probing task for the database cluster 120, distributing the network access and database access overhead generated by status probing to different management nodes. This reduces the problem of concentrated probing load caused by a single management node centrally probing a large number of database nodes, and reduces the possibility of a single management node's network anomaly having a concentrated impact on the anomaly judgment of multiple database nodes.
[0069] It is worth noting that the above Figure 1 The database management system 100 shown is merely an illustrative example and is not intended to be limiting. For example, in other possible implementations, the anomaly detection device 110 may include three or more management nodes, the database cluster 120 may include a greater number of database nodes, and the database management system 100 may manage multiple database clusters 120 simultaneously. Furthermore, the management nodes participating in the state detection of a database node may be all or some of the management nodes in the anomaly detection device 110; for different database nodes, the number of management nodes participating in state detection may be the same or different. Also, the communication network layer 130 may be implemented by a single communication network or by multiple physical or logical networks. Communication between multiple management nodes in the anomaly detection device 110, and communication between management nodes in the anomaly detection device 110 and database nodes, may be achieved through the same or different communication paths, and this application does not limit this.
[0070] exist Figure 1 Based on the database management system 100 shown, the following will combine... Figures 2 to 5 This paper describes one implementation of the anomaly detection method provided in the embodiments of this application.
[0071] See Figure 2 , Figure 2 This is a schematic diagram of the interactive process of an anomaly detection method provided in an embodiment of this application. Figure 2 The method shown can be derived from Figure 1The anomaly detection device 110 shown can be used for execution, but it can also be executed by other anomaly detection devices capable of performing status probing on database nodes through multiple management nodes. The following uses... Figure 2 The method shown is illustrated by example, performed by the anomaly detection device 110 in the database management system 100.
[0072] Figure 2 The first management node, second management node, and third management node shown can all be Figure 1 The anomaly detection device 110 shown includes a management node, and the first database node can be one of the database nodes in the database cluster 120. Data interaction between the first management node, the second management node, the third management node, and the first database node can be achieved through... Figure 1 The communication network layer 130 shown is implemented.
[0073] Figure 2 Taking the example of the first management node, second management node, and third management node in the anomaly detection device 110 each performing state probing on the same first database node, different management nodes can each generate state probing results for the first database node, making the multiple state probing results distinct from each other in terms of the management node source. In practical applications, the anomaly detection device 110 may include more than three management nodes, and the number of management nodes participating in the state probing of the first database node can also be set according to the deployment method of the database management system 100.
[0074] Specifically, Figure 2 The method shown may include the following steps.
[0075] S201: The first management node, the second management node, and the third management node each send a status probe request to the first database node.
[0076] The first management node, second management node, and third management node can each obtain the database node information corresponding to the first database node, and access the first database node through the communication network layer 130 based on the database node information. The database node information may include at least one of the following: the identifier of the first database node, network address, communication port, database type, database cluster identifier, node role, or other information that can be used to access the first database node. For example, the identifier of the first database node may be a unique node identifier, or it may include or be associated with the Internet Protocol address and communication port of the first database node. The node role may include information indicating whether the database node assumes a primary node, backup node, read-only node, or other service role in the database cluster.
[0077] A status probe request can be a connection request used to establish a communication connection between the management node and the first database node, or it can be a database service probe request sent after the communication connection has been established.
[0078] For example, for a relational database, a state probe request can be a connection establishment request or a lightweight query request sent after a database session has been established. As another example, for a key-value database, a state probe request can be a liveness check command sent after a network connection has been established. Furthermore, for a database that provides a health check interface, a state probe request can also be an access request sent to the corresponding health check interface.
[0079] Different management nodes can use the same or different status probing methods for the first database node. For example, the first, second, and third management nodes can all use a connection establishment plus lightweight query approach to perform status probing. Alternatively, different management nodes can each use other probing methods that can characterize whether they can access the first database node normally. This application does not limit the status probing request to a specific database command or communication protocol.
[0080] In step S201, the database nodes that each management node needs to perform status probing can also be determined based on the probing allocation information.
[0081] See Figure 3 , Figure 3 This is a timing diagram illustrating the allocation, execution, and result synchronization of a detection task, provided as an embodiment of this application. Figure 3 This illustrates an example where the first management node acts as the leader, the second management node as the follower, and the third management node as the follower. The leader and follower represent the node roles of management nodes in a consistency management mechanism. The leader node can be responsible for organizing or initiating the consistency synchronization of management information, while the follower nodes can receive management information synchronized by the leader node and update their local management data accordingly. The leader and follower roles can switch between multiple management nodes, and it does not mean that the first management node must always be the leader node.
[0082] S301: The first management node obtains database node information.
[0083] exist Figure 3In the implementation shown, the database node information may include information about one or more database nodes currently managed by the database management system 100. For example, the first management node can obtain the identifier of the first database node and the identifier of the second database node. The first management node can also obtain the identifiers of the third database node or other database nodes in the database cluster 120.
[0084] The first management node can obtain the corresponding database node information when a database node is added to the database management system 100, and can also update the database node information when nodes are added, deleted, replaced, or their configurations change in the database cluster 120. The first management node can also obtain database node information from the management data storage, registration information, or other management information corresponding to the database management system 100.
[0085] S302: The first management node sends probe allocation information to other management nodes through the consensus protocol.
[0086] Figure 3 The "probe allocation information" shown can be information that directly records the correspondence between management nodes and database nodes to be probed, or it can be allocation-related information used by other management nodes to determine their own probe allocation information. For example, the first management node can synchronize the identifiers of the first and second database nodes to the second management node. The first management node can also synchronize the corresponding database node identifiers to the third management node using the same or similar method. After obtaining the corresponding database node identifiers, the second and third management nodes can determine their own corresponding database nodes to be probed based on the obtained database node information.
[0087] In another possible implementation, the first management node can first determine the probe correspondence between one or more management nodes and database nodes, and then send the information representing the corresponding probe correspondence to other management nodes. The consensus protocol can be the Raft protocol or other consensus protocols capable of synchronizing management information among multiple management nodes.
[0088] For example, when the database management system 100 uses the Raft protocol, the first management node can write the database node identifier or management information related to the probe task into the consistency log, and then replicate the consistency log to the second and third management nodes. Once the corresponding logs meet the application conditions, the second and third management nodes can apply the information recorded in the logs to their respective local management data.
[0089] In other possible implementations, multiple management nodes can also obtain consistent or corresponding database node information through shared management data, distributed configuration data, or other inter-management node communication mechanisms. This application embodiment does not limit this.
[0090] S303: The first management node, the second management node, and the third management node determine their own detection allocation information and execute detection tasks based on the detection allocation information.
[0091] Figure 3 The determination of probe allocation information and the execution of probe tasks are integrated into the same step. In actual processing, the management node can first determine its own corresponding probe allocation information, and then perform status probes on the corresponding database nodes based on the probe allocation information.
[0092] The probe allocation information can be used to record the database nodes to be probed corresponding to the respective management nodes. The probe allocation information can be a set of database node identifiers, a list of probe tasks, a set of database node indexes, or other data structures that can represent the database nodes to be probed; this application does not limit this.
[0093] For example, the first probe allocation information determined by the first management node may include at least one of the first database node and the second database node. The first management node can perform status probes on the corresponding database node based on the database node identifier recorded in the first probe allocation information.
[0094] Correspondingly, the second and third management nodes can also determine their own corresponding probe allocation information and perform status probes according to their respective probe allocation information.
[0095] Figure 2 In the illustrated embodiment, the first management node, the second management node, and the third management node each perform status probing on the first database node. Therefore, in this example, the probing allocation information corresponding to each of the first management node, the second management node, and the third management node can all include the first database node.
[0096] For other database nodes in database cluster 120, the probe allocation relationship for different management nodes can be the same or different.
[0097] For example, the second database node can also have its status probed by the first, second, and third management nodes. Alternatively, the second database node can have its status probed by some of the management nodes in the anomaly detection device 110. Furthermore, the first and second database nodes can each correspond to different combinations of management nodes.
[0098] In one possible implementation, the same database node can correspond to the probing tasks of two or more different management nodes. Multiple different management nodes can each perform state probing on the same database node and generate state probing results from different management node sources.
[0099] For example, the first database node can simultaneously correspond to the probing tasks of the first management node, the second management node, and the third management node. After the first management node, the second management node, and the third management node each perform state probing on the first database node, they can each generate state probing results corresponding to their respective access states.
[0100] When database nodes are added or deleted in database cluster 120, one or more management nodes can redetermine the corresponding probe allocation information based on the updated database node information.
[0101] For example, when a fourth database node is added to database cluster 120, the probe allocation information corresponding to at least two management nodes can be used to add the fourth database node. As another example, when a second database node is deleted from database cluster 120, the corresponding management node can delete the second database node from its probe allocation information.
[0102] In one possible implementation, when the first management node malfunctions, the second management node can determine second probe allocation information based on the identifiers of the first and second database nodes. The second probe allocation information can record the database nodes to be probed corresponding to the second management node, and these database nodes may include at least some of the database nodes originally corresponding to the first management node.
[0103] For example, before the first management node experiences an anomaly, the first probe allocation information corresponding to the first management node may include the first database node. After the first management node experiences an anomaly, the second probe allocation information determined by the second management node may also include the first database node. The second management node can then continue to perform status probes on the first database node based on the second probe allocation information.
[0104] In another possible implementation, when one of the multiple management nodes fails, the current leader node can reassign probe allocation information to the remaining healthy management nodes. The leader node can determine the updated probe allocation information based on the database node information currently managed by the database management system, the running status of each management node, and the current probe allocation information for each management node. The updated probe allocation information can reassign at least some of the state probing tasks originally undertaken by the failed management node to one or more healthy management nodes. The leader node can send or synchronize the updated probe allocation information to the corresponding healthy management nodes, which can then continue performing state probing based on the updated information.
[0105] For example, the first, second, and third management nodes can jointly undertake state probing tasks for multiple database nodes. The first management node can act as the current leader node, while the second and third management nodes can act as follower nodes. When the second management node experiences an anomaly, the first management node can determine the state probing tasks that need to be reassigned based on the original probing allocation information of the second management node. The first management node can reassign all the state probing tasks originally undertaken by the second management node to the third management node, or it can reassign a portion of the state probing tasks to the third management node and assign the remaining state probing tasks to other normal management nodes in the anomaly detection device 110. The first management node can also determine the state probing tasks that different normal management nodes need to continue executing based on the number of probing tasks currently undertaken by each normal management node, the probing cycle of the corresponding database node, or other probing task allocation conditions.
[0106] In one possible implementation, the first management node can synchronize the updated probe allocation information to the corresponding normal management nodes via a consistency protocol. After receiving the updated probe allocation information, the corresponding normal management nodes can perform status probes on the corresponding database nodes according to the updated information. Subsequently, when changes such as the addition of a management node, the restoration of a management node to normal operation, or the addition or deletion of a database node are detected, the current leader node can update the probe allocation information again and assign the updated probe tasks to the corresponding management nodes. Therefore, the probe tasks corresponding to multiple management nodes can be dynamically adjusted based on the running status of the management nodes and changes in the database nodes.
[0107] In another possible implementation, after the first management node malfunctions, the second management node can, based on the second probe allocation information, continue to execute all the state probe tasks originally undertaken by the first management node, and continue to perform state probes on all the database nodes that the first management node originally needed to probe. Alternatively, the second management node may only continue to execute a portion of the state probe tasks, continuing to perform state probes on the database nodes that the first management node originally needed to probe; the remaining state probe tasks originally undertaken by the first management node can be continued by the third management node or other normal management nodes in the anomaly detection device 110. This application does not limit this approach.
[0108] Therefore, when a management node malfunctions, other management nodes can take over the corresponding status probing tasks, reducing the possibility that a single management node malfunction will cause interruption or omission of status probing for some database nodes, and improving the continuity of status probing.
[0109] S304: The first management node synchronizes the state probe results to other management nodes through the consistency protocol.
[0110] After each management node performs status probing based on its corresponding probe allocation information, it can generate corresponding status probing results. Different status probing results can correspond to the access status of different management nodes to the corresponding database nodes.
[0111] For example, when the first management node, the second management node, and the third management node all perform state probes on the first database node, the first management node can generate its own state probe result for the first database node, the second management node can generate its own state probe result for the first database node, and the third management node can generate its own state probe result for the first database node. Each management node can synchronize its corresponding state probe results through a consistency protocol.
[0112] For example, in an implementation where the first management node acts as the leader, and the second and third management nodes act as followers, the second and third management nodes can send their generated state probe results to the first management node. The first management node can obtain its own generated state probe results as well as those generated by the second and third management nodes, and can form management data to be synchronized based on these results. The first management node can then synchronize this management data to other management nodes using a consistency protocol. Consequently, the second and third management nodes can also obtain state probe results from the other management nodes.
[0113] In one implementation using the Raft protocol, the first management node can write the state probe results or the corresponding management data to the consistency log, and then replicate the corresponding consistency log to the second and third management nodes. When the corresponding consistency log meets the commit conditions, each management node can apply the corresponding log to its local state and obtain the corresponding state probe results.
[0114] For example, after the first management node receives the status probe results generated by the first management node, the second management node, and the third management node for the first database node, it can record the corresponding status probe results or management data based on the corresponding status probe results to the consistency log. After receiving and applying the corresponding consistency logs, the second and third management nodes can obtain multiple status probe results for the first database node.
[0115] In other possible implementations, state probe results are not required to be directly recorded in the consistency log. For example, the consistency log can record the state identifier corresponding to the state probe result, a summary of the result, an index of the result, or other information that can characterize the corresponding state probe result. Other data of the state probe results can be stored in the management data storage space accessible to each management node. Alternatively, management nodes can transmit state probe results through shared management data, message passing mechanisms, or other inter-management communication mechanisms. This application does not limit the state probe results to be synchronized using the Raft protocol, nor does it limit the database node information, probe allocation information, and state probe results to using the same information synchronization method.
[0116] In one possible implementation, the management node performing anomaly detection can obtain state probe results generated by different management nodes from multiple synchronized state probe results, and generate anomaly detection results for the corresponding database node based on these multiple state probe results. For example, the first management node can obtain state probe results generated by the first management node, the second management node, and the third management node for the first database node, and generate anomaly detection results for the first database node based on the state probe results corresponding to the three management nodes.
[0117] Figure 3 The following example illustrates the synchronization of state probe results among multiple management nodes. In other possible implementations, the management node performing anomaly detection can also directly receive state probe results sent by other management nodes, without requiring the state probe results to be further synchronized to all management nodes; this is not a limitation.
[0118] For example, the second and third management nodes can each send the state probe results generated for the first database node to the first management node, which then performs anomaly detection based on its own state probe results for the first database node. In this case, the second and third management nodes do not require all state probe results generated by other management nodes to be obtained.
[0119] Therefore, the state probe results generated by different management nodes can be provided to the management node performing anomaly detection, enabling the management node performing anomaly detection to obtain multiple access perspectives from different management nodes, and providing a data foundation for subsequently determining the source of anomalies in the first database node based on multiple state probe results.
[0120] S202: The first database node returns probe responses to the first management node, the second management node, and the third management node, respectively.
[0121] After receiving a status probe request, the first database node can perform corresponding database processing based on the status probe request and return a probe response to the management node that sent the status probe request.
[0122] The probe response can include information indicating successful request processing, as well as the database service status, database node status, database response code, or other status probe-related information. For example, when the first management node sends a lightweight query request to the first database node, the first database node can return the corresponding query results. The first management node can determine whether the first database node can be accessed normally through the access path corresponding to the first management node based on whether the expected query results are obtained. As another example, when the first management node sends a health check request to the first database node, the first database node can return a health status identifier. The health status identifier can include normal status, abnormal status, or other database-defined status information.
[0123] During partial state probing, the management node may not receive a valid probe response from the first database node within a preset time. In this case, the management node can generate a response timeout message.
[0124] Response timeouts can occur in several ways. For example, the management node may fail to establish a communication connection with the first database node; the management node may have successfully sent a status probe request but did not receive a response from the first database node within a preset time; the management node may also receive data, but the data does not meet the conditions for a valid response to the current status probe.
[0125] A response timeout indicates that the corresponding management node did not receive a valid response from the first database node during the current state probing process. This response timeout itself does not necessarily need to be directly identified as an anomaly in the first database node itself.
[0126] It should be noted that the state detection corresponding to steps S201 and S202 can be repeated according to the detection cycle. Figure 3 The process of task allocation, execution and result synchronization shown is only one possible implementation method and is not intended to limit the specific role relationship, information synchronization method, task allocation method and status detection result transmission method among multiple management nodes in the anomaly detection device 110.
[0127] When a single management node performs status probing on a corresponding database node, the status probing can be repeated at certain time intervals, and the response timeout can be used to determine whether the current status probing has timed out. A specific implementation of the probing cycle and response timeout determination is described below. Figure 4 Please provide an explanation.
[0128] See Figure 4 , Figure 4 This is a timing diagram illustrating the detection period and timeout determination provided in an embodiment of this application.
[0129] A management node can repeatedly send status probe requests to a database node according to a preset probe cycle. The probe cycle can be a fixed time period or a time period dynamically determined based on the database node status, system load, or detection strategy.
[0130] For example, the detection period can be 1 second, 5 seconds, 10 seconds, or other time lengths. The above time values are only used to illustrate one possible implementation and do not constitute a limitation on the actual value of the detection period.
[0131] like Figure 4 As shown, after a probe cycle begins, the management node can send a status probe request to the database node. After sending the status probe request, the management node can enter a waiting window for a response. This waiting window can be denoted as Tw. It can be less than or equal to the detection period. For example, the detection period can be 5 seconds. The timeframe can be 3 seconds. If the management node receives a valid probe response within 3 seconds, it can generate information corresponding to this round of state probes based on the response. If no valid detection response is obtained by the deadline, this round of state detection can be determined as a response timeout.
[0132] After completing this round of state probing, the management node can enter the next probing cycle and send a state probing request again. A single response timeout does not necessarily mean that the management node must stop subsequent state probing.
[0133] Different management nodes can use the same probing cycle. For example, the first management node, the second management node, and the third management node can all perform a status probe on the first database node every 5 seconds.
[0134] Different management nodes can also use different probing cycles. For example, the first management node can perform a status probe every 5 seconds, while the second and third management nodes can use other probing cycles. The management node performing anomaly detection can determine the status probe result used for the same anomaly detection from the status probe results generated by different management nodes based on the probe round, time window, or probe time.
[0135] S203: The first management node, the second management node, and the third management node generate status detection results based on their respective detection responses.
[0136] The status probe result can be used to characterize the access status of the management node that generated the status probe result to the first database node. The status probe result can include normal access or abnormal access. In other implementations, the status probe result can also include more status categories, such as normal, connection error, response timeout, database response error, or other statuses.
[0137] The status probe result may also include at least one of the following: the identifier of the management node that generated the status probe result, the identifier of the first database node, the probe time, the probe round, the response duration, the error type, or other probe-related information. For example, if the first management node can successfully establish a communication connection with the first database node and obtain a probe response that meets preset conditions within the waiting response window, the first management node can generate a status probe result indicating that the access is normal.
[0138] When the first management node fails to establish a communication connection, experiences a connection interruption, or fails to obtain a valid probe response within the waiting response window, the first management node can generate a status probe result to indicate an access anomaly.
[0139] For example, if the first management node is already able to transmit data normally with the first database node, but the first database node returns a response message indicating an abnormal database service, the first management node can also generate a status probe result to characterize the access abnormality.
[0140] The first management node, the second management node, and the third management node can each independently generate their own corresponding state probe results. Therefore, the state probe result generated by the first management node reflects the state of the first management node accessing the first database node, the state probe result generated by the second management node reflects the state of the second management node accessing the first database node, and the state probe result generated by the third management node reflects the state of the third management node accessing the first database node.
[0141] In one possible implementation, the management node can also maintain an anomaly count for state probing between itself and the first database node. The anomaly count can characterize the number of times a management node's access to the first database node is consistently determined to be abnormal. Different management nodes can maintain their own corresponding anomaly counts.
[0142] For example, each time the first management node receives a status probe result indicating an access anomaly, it can increment the anomaly count value of the first management node corresponding to the first database node by 1. When the first management node receives a status probe result indicating normal access, it can restore the corresponding anomaly count value to its initial value, for example, to 0.
[0143] In other possible implementations, the management node may also reduce the anomaly count value after obtaining the normal state detection result, or use a weighted accumulation method to calculate the anomaly count value to represent the degree of continuous access anomaly. This application embodiment does not limit this.
[0144] When the anomaly count reaches the third threshold, the corresponding state detection result can be identified as the target state detection result. The target state detection result can be used to indicate an anomaly in the access of the corresponding management node to the first database node, and can also serve as the state detection result for subsequently determining the number of target state detection results. The third threshold can be 2, 3, or any other value greater than or equal to 1.
[0145] For example, if the detection period is 5 seconds and the third threshold is 3, and the first management node determines that the access to the first database node is abnormal for three consecutive detection periods, the current state detection result of the first management node can be determined as the target state detection result. If the first management node obtains a normal state detection result again after two consecutive access anomalies, the first management node can reset or reduce the anomaly count value according to the preset anomaly counting rules. In this case, the aforementioned short-term access anomaly may not directly form the target state detection result.
[0146] Therefore, by using an anomaly count to characterize the number of times the access status of the management node to the first database node is continuously determined to be abnormal, and by determining the corresponding status detection result as the target status detection result when the anomaly count reaches the third threshold, the possibility of directly forming the target status detection result due to instantaneous network fluctuations, occasional response timeouts, or other short-term access anomalies can be reduced. This reduces the impact of occasional access anomalies on the number of target status detection results, allowing subsequent target status detection results used for anomaly source determination to more stably reflect the continuous abnormal access status of each management node to the first database node. This reduces the interference of occasional anomalies on the differentiation results between the first database node's own anomalies and communication path anomalies, thereby improving the accuracy of anomaly detection results and anomaly source determination.
[0147] S204: The second and third management nodes send their respective generated state probe results to the first management node.
[0148] Figure 2 Taking the example of the first management node obtaining multiple state probe results and performing subsequent anomaly detection, the first management node can retain its own generated state probe results and obtain the state probe results generated by the second and third management nodes respectively, thereby obtaining multiple state probe results for the same first database node.
[0149] For a specific implementation of transmitting or synchronizing status probe results between multiple management nodes, please refer to [link to relevant documentation]. Figure 3 The embodiments corresponding to step S304 will not be discussed again here. Figure 2 The scenario where the first management node obtains multiple state probe results is merely an example. In other possible implementations, other management nodes in the anomaly detection device 110 may also obtain state probe results from multiple different management nodes and perform subsequent anomaly detection based on the corresponding state probe results; this application does not limit this approach.
[0150] Figure 2 Taking the first management node in the anomaly detection device 110 as an example, which is responsible for obtaining state probe results and generating anomaly detection results, other possible implementations may also involve the second management node, the third management node, or other management nodes in the anomaly detection device 110 obtaining multiple state probe results and performing corresponding anomaly detection result generation processes. For example, when the first management node is the current leader node, it can perform state probe result aggregation and anomaly detection. After the leader role is switched, the new leader node can also obtain state probe results from different management nodes and continue to perform corresponding anomaly detection.
[0151] After the first management node obtains multiple status probe results, it can aggregate the status probe results according to the identifier of the first database node.
[0152] The first management node can also distinguish the source of the status probe results based on the management node identifier carried in the status probe results. Different status probe results among multiple status probe results used for a single anomaly detection can correspond to different management nodes. For example, the first management node can determine the latest valid status probe result formed by each management node for the first database node from the status probe results formed by the first management node, the second management node, and the third management node within a preset time window, and use the three status probe results for a single anomaly detection.
[0153] When a management node generates multiple status probe results within the same time window, the first management node can determine which status probe result to include in the current anomaly detection based on the management node identifier, probe time, or probe round. This way, multiple consecutive status probe results generated by the same management node will not be directly counted as status probe results from multiple different management nodes.
[0154] S205: The first management node generates anomaly detection results based on multiple status detection results.
[0155] The first management node can determine the target state probe result from multiple state probe results, and generate an anomaly detection result for the first database node based on the number of the target state probe result among multiple state probe results from different management nodes.
[0156] A further implementation of step S205 can be found in [reference needed]. Figure 5 .
[0157] See Figure 5 , Figure 5 This is a schematic diagram illustrating the process of generating and judging anomaly detection results, as provided in an embodiment of this application. Figure 5 Steps S501 to S507 shown can be executed by the anomaly detection device 110. In one possible implementation, the anomaly detection device 110 can be executed by the management node currently responsible for aggregating state detection results. Figure 5 The processing is as shown; in another possible implementation, the anomaly detection device 110 can also perform the corresponding processing through other management nodes capable of obtaining multiple state detection results. This application does not limit this.
[0158] in, Figure 5 The processing method shown may specifically include the following steps.
[0159] S501: Anomaly detection device 110 aggregates the status detection results generated from multiple detection cycles.
[0160] The anomaly detection device 110 can obtain status detection results from multiple different management nodes according to the identifier of the first database node.
[0161] Figure 5 The state detection results generated by multiple detection cycles mentioned above can be state detection results generated and retained by one or more management nodes within multiple detection cycles. When the anomaly detection device 110 performs an anomaly source judgment, it can determine the corresponding state detection results from the state detection results corresponding to different management nodes according to the detection round, preset time window, or the most recent effective detection time.
[0162] For example, when the first management node, the second management node, and the third management node all perform periodic status probes on the first database node, the anomaly detection device 110 can obtain the latest valid status probe results generated by the first management node, the second management node, and the third management node for the first database node within the current time window.
[0163] Therefore, multiple status probe results generated by the same management node in multiple probe cycles can be used to determine the status of the management node continuously accessing the first database node, but the number of target status probe results can be counted according to different management node sources.
[0164] S502: The anomaly detection device 110 determines the target state detection result from multiple state detection results.
[0165] In step S502, the anomaly detection device 110 can determine the target state detection result from multiple state detection results based on the access state corresponding to each state detection result and the determination conditions of the target state detection result.
[0166] In one possible implementation, when the anomaly count value of a management node corresponding to the first database node reaches a third threshold, the anomaly detection device 110 can determine the current state detection result corresponding to that management node as the target state detection result. For a specific implementation regarding the anomaly count value and the determination of the target state detection result based on the anomaly count value, please refer to the embodiment corresponding to step S203, which will not be repeated here.
[0167] In other possible implementations, the anomaly detection device 110 can also combine the response timeout flag, connection failure flag, database response error information, or other information that can characterize access anomalies in the status detection results to determine whether the corresponding status detection results meet the determination conditions of the target status detection results.
[0168] S503: Anomaly detection device 110 determines the number of target status detection results.
[0169] The number of target state detection results can be the number of different management nodes that generate target state detection results for the first database node. For example, when the first management node, the second management node, and the third management node all participate in the state detection of the first database node, the number of target state detection results can be 0, 1, 2, or 3.
[0170] When the first management node and the second management node each generate a target status detection result, but the third management node does not generate a target status detection result, the number of target status detection results can be 2.
[0171] When the same management node generates multiple access anomaly results in multiple probe cycles, these multiple results can be used to determine the corresponding anomaly count or to determine a target state probe result, without requiring the multiple probe cycles corresponding to the same management node to be counted separately in the number of target state probe results.
[0172] S504: The anomaly detection device 110 compares the number of target state detection results with the first threshold and the second threshold.
[0173] The first and second thresholds can be pre-configured thresholds or determined based on the number of management nodes participating in the first database node status probe.
[0174] For example, when the number of management nodes participating in the first database node status detection is 3, the first threshold can be 2.5, and the second threshold can be 1.5. In this case, when the number of target status detection results is 3, the number of target status detection results is greater than the first threshold; when the number of target status detection results is 1, the number of target status detection results is less than the second threshold; and when the number of target status detection results is 2, the number of target status detection results is within the intermediate range defined by the first and second thresholds. The above values are only used to illustrate one possible threshold configuration method, and this application embodiment does not limit the first and second thresholds to using corresponding values.
[0175] In another possible implementation, the first threshold and the second threshold can also be determined proportionally based on the number of management nodes participating in the detection. For example, the first threshold can correspond to a higher proportion of management nodes forming the target state detection result, and the second threshold can correspond to a lower proportion of management nodes forming the target state detection result.
[0176] S505: When the number of target status detection results is greater than the first threshold, the anomaly detection device 110 determines that the first database node itself is abnormal.
[0177] Multiple target status detection results can indicate that multiple different management nodes cannot access the first database node normally. For example, when the first management node, the second management node, and the third management node access the first database node through their respective communication paths, and all three management nodes continuously generate target status detection results, the anomaly detection device 110 can generate an anomaly detection result to indicate that the first database node itself is abnormal.
[0178] The first database node's own abnormality can be due to an abnormality in the database service process, an abnormality in the database listening service, a stoppage of the database service, an abnormality in the database node resources, or other abnormal states that prevent multiple management nodes from obtaining database services normally.
[0179] S506: When the number of target state detection results is within the middle range defined by the second threshold and the first threshold, the anomaly detection device 110 can mark the first database node as to be observed and trigger subsequent processing.
[0180] For example, in one possible implementation, when the second threshold is less than or equal to the number of target state detection results, and the number of target state detection results is less than or equal to the first threshold, the anomaly detection device 110 may temporarily determine whether the first database node itself is abnormal or the corresponding communication path is abnormal, and mark the first database node as to be observed.
[0181] While in the observation state, the database management system 100 can continue to acquire subsequent state probe results. For example, the management node can increase the number of state probes for the first database node, extend the state observation time, and add more management nodes to participate in the state probe of the first database node.
[0182] If the number of target state detection results changes during subsequent detection, the anomaly detection device 110 can re-execute the corresponding judgment based on the updated number of target state detection results.
[0183] For example, when the number of target status detection results increases and further exceeds the first threshold, the anomaly detection device 110 can determine that the first database node itself is abnormal; when the number of target status detection results decreases and further falls below the second threshold, the anomaly detection device 110 can determine that the communication path between the corresponding management node and the first database node is abnormal.
[0184] The observation processing shown in step S506 can be implemented as an optional approach. Other implementations may also employ different anomaly handling strategies for the range of quantities between the first and second thresholds.
[0185] S507: When the number of target status detection results is less than the second threshold, the anomaly detection device 110 determines that the communication path between the management node and the first database node is abnormal.
[0186] In one possible implementation, the second threshold can be a value greater than 0. When an anomaly in the communication path is determined based on the number of target state detection results, the number of target state detection results can be greater than 0 and less than the second threshold to indicate that at least one management node has generated a target state detection result. For example, if the first management node generates a target state detection result, and the second and third management nodes can both access the first database node normally, the number of target state detection results can be within the range of less than the second threshold.
[0187] The fact that the second and third management nodes can access the first database node normally indicates that the first database node can respond normally to status probes through the access paths corresponding to other management nodes. The anomaly detection device 110 can then generate an anomaly detection result indicating an anomaly in the communication path between the first management node and the first database node.
[0188] For example, if the second management node generates a target status detection result, and the first and third management nodes can both access the first database node normally, the anomaly detection result can be used to indicate that the communication path between the second management node and the first database node is abnormal.
[0189] Communication path anomalies can include network link interruptions, routing anomalies, network congestion, switching equipment malfunctions, or other communication anomalies that prevent the corresponding management node from accessing the first database node normally. Therefore, step S205 can distinguish between anomalies of the first database node itself and communication path anomalies between the management node and the first database node based on the number of target status detection results from different management nodes.
[0190] Figure 2In the method shown, different state probe results are generated based on state probes performed by different management nodes on the same first database node. Therefore, multiple state probe results can reflect the access status of multiple different management nodes to the first database node. The number of target state probe results used for anomaly detection can further represent the distribution of access anomalies among multiple different management nodes. Alternatively, in an implementation using anomaly counts, each management node can first determine persistent access anomalies based on state probe results over multiple probe periods, and then the management node performing anomaly detection can count the number of target state probe results from different management nodes. In this way, the state probe process can combine the persistent access status of a single management node over time, as well as the state distribution of multiple management nodes from different access perspectives, improving the stability of anomaly detection results and the accuracy of anomaly source differentiation.
[0191] It should be noted that, Figure 5 The anomaly detection result generation and judgment process shown is only one possible implementation and is not intended to limit the scope. In practical applications, the processing methods corresponding to the first threshold, the second threshold, and the intermediate range between the first and second thresholds can be set according to the number of management nodes participating in state probing and the anomaly detection strategy. This application does not limit these methods.
[0192] It should also be noted that, Figures 2 to 5 The anomaly detection process shown is for illustrative purposes only and is not intended to limit the scope of the application. In practical applications, the number of management nodes participating in the state probing of the same database node, the database nodes to be probed corresponding to each management node, the state probing method, the method of transmitting state probing results, and the method of generating anomaly detection results can all be configured according to the deployment of the database management system 100, and this application does not impose any limitations on these aspects.
[0193] Figure 5 After generating anomaly detection results, the database management system 100 can also perform further verification or anomaly response processing corresponding to the source of the anomaly based on the anomaly detection results. The corresponding implementation will be combined with... Figure 6 The embodiments are further illustrated below.
[0194] See Figure 6 , Figure 6 This is a flowchart illustrating an anomaly detection result verification and differentiated response provided in an embodiment of this application. Figure 6 The process shown can be... Figure 1 The abnormality detection device 110 shown is activated.
[0195] Figure 6The explanation will primarily focus on the example of the anomaly detection device 110 obtaining preliminary anomaly detection results for the first database node. These preliminary anomaly detection results can be... Figure 5 The anomaly detection result generated by the process shown can also be the anomaly detection result generated by the anomaly detection device 110 using other anomaly detection methods, and this application does not limit it.
[0196] In one possible implementation, Figure 6 It can mainly undertake Figure 5 The handling results for either the first database node's own anomaly or a communication path anomaly have been determined. For example, Figure 5 After step S505 determines that the first database node itself is abnormal, execution can continue. Figure 6 The verification process is shown below; Figure 5 After step S507 determines that the communication path between the corresponding management node and the first database node is abnormal, execution can continue. Figure 6 The communication path anomaly response handling is shown.
[0197] when Figure 5 While the first database node is still in the observation state shown in step S506, the anomaly detection device 110 can continue to acquire subsequent state detection results and re-determine the source of the anomaly based on the updated number of target state detection results. After obtaining new anomaly detection results, the anomaly detection device 110 can then execute... Figure 6 The process is shown below.
[0198] Specifically, Figure 6 The process shown may include the following steps.
[0199] S601: The anomaly detection device 110 acquires preliminary anomaly detection results.
[0200] The preliminary anomaly detection results can be used to indicate anomalies in the first database node itself, or to indicate anomalies in the communication path between the management node that generates the target state detection results and the first database node.
[0201] For example, the first management node, the second management node, and the third management node all perform status probing on the first database node. When multiple management nodes generate target status probing results, and the number of target status probing results exceeds a first threshold, the anomaly detection device 110 can obtain preliminary anomaly detection results to indicate anomalies in the first database node itself.
[0202] For example, when only the first management node forms a target status detection result, while the second and third management nodes can access the first database node normally, the anomaly detection device 110 can obtain a preliminary anomaly detection result indicating an anomaly in the communication path between the first management node and the first database node.
[0203] The preliminary anomaly detection results may also include information related to the determination of the anomaly source. For example, the preliminary anomaly detection results may include at least one of the following: the identifier of the first database node, the identifier of the management node that generated the target state detection results, the number of target state detection results, the time of state detection, the error type, or other anomaly detection information.
[0204] S602: The anomaly detection device 110 determines whether the preliminary anomaly detection result is used to indicate an anomaly in the first database node itself.
[0205] The anomaly detection device 110 can read the anomaly type, anomaly source identifier, or other information used to characterize the anomaly source in the preliminary anomaly detection results, and determine the anomaly source indicated by the preliminary anomaly detection results.
[0206] Taking the first database node as an example, when the preliminary anomaly detection result indicates an anomaly in the communication path between the management node that generated the target state detection result and the first database node, the anomaly detection device 110 can execute step S603. When the preliminary anomaly detection result indicates an anomaly in the first database node itself, the anomaly detection device 110 can continue to execute step S604 and obtain the communication status between the multiple management nodes that generated the target state detection result. The term "preliminary" here can mean... Figure 5 The resulting database node anomaly detection allows for further verification in conjunction with other communication states, but does not imply... Figure 5 The generated anomaly detection results are invalid.
[0207] For example, if both the first management node and the second management node are unable to access the first database node normally, the anomaly detection device 110 can preliminarily determine that the first database node itself is abnormal based on the target state detection results formed by the two management nodes respectively. However, if the first management node and the second management node are also in the same communication failure area, the simultaneous inability of both management nodes to access the first database node may also be related to an anomaly in the management-side communication network. Therefore, the anomaly detection device 110 can also verify the preliminary anomaly detection results by combining the communication status between the two management nodes.
[0208] S603: The anomaly detection device 110 executes the communication path anomaly response strategy.
[0209] The communication path anomaly response strategy may include one or more processing methods corresponding to the communication path anomaly. The anomaly detection device 110 may select the appropriate processing method based on the type of communication path anomaly, the management node where the communication path anomaly occurred, or the current operating status of the database management system 100.
[0210] For example, the anomaly detection device 110 can generate a communication path anomaly alarm. The communication path anomaly alarm information may include at least one of the following: the identifier of the management node where the communication path anomaly occurred, the identifier of the first database node, the time of the anomaly, the error type, and the corresponding communication path information.
[0211] The anomaly detection device 110 can also perform communication link detection. For example, the anomaly detection device 110 can detect the network connectivity status, routing status, port connectivity status, or network access control status between the corresponding management node and the first database node, and can further obtain the location or type of anomaly in the communication path.
[0212] In one possible implementation, the anomaly detection device 110 can also re-establish the communication connection where the anomaly occurred. For example, when the original communication connection between the first management node and the first database node is interrupted, the anomaly detection device 110 can control the first management node to re-establish the communication connection with the first database node.
[0213] In another possible implementation, the anomaly detection device 110 can adjust parameters related to state detection. For example, the anomaly detection device 110 can change the detection frequency, adjust the wait-for-response window, or use other available state detection methods.
[0214] The anomaly detection device 110 can also temporarily adjust the state probing tasks. For example, when an anomaly occurs in the communication path between the first management node and the first database node, the anomaly detection device 110 can cause the third management node to add state probing targeting the first database node. The original probing allocation information of the third management node can be retained, and the added state probing can be used as a temporary probing task.
[0215] The above communication path anomaly response strategy is only an example. The anomaly detection device 110 can execute one of the processes or combine multiple processes according to the specific circumstances of the communication path anomaly; this application does not limit this.
[0216] Even in the event of a communication path anomaly, the first database node itself may still operate normally. Therefore, the anomaly detection device 110 can directly perform maintenance procedures for the anomaly of the first database node itself without considering the corresponding communication path anomaly. For example, when the first management node cannot access the first database node normally, but the second and third management nodes can still access the first database node normally, the anomaly detection device 110 can temporarily refrain from performing database service switching, service stopping, node isolation, or node deletion on the first database node. This reduces the possibility of a normal database node being subjected to incorrect maintenance operations due to a local communication path anomaly.
[0217] S604: The anomaly detection device 110 acquires the communication status between multiple management nodes corresponding to the target status detection results.
[0218] In this embodiment, the management node corresponding to the target state detection result can be the management node that generates the corresponding target state detection result. For example, when the first management node and the second management node generate target state detection results for the first database node respectively, the anomaly detection device 110 can obtain the communication status between the first management node and the second management node.
[0219] For example, when the first management node, the second management node, and the third management node all generate target status detection results, the anomaly detection device 110 can obtain the communication status between the three management nodes.
[0220] The communication status between management nodes can be used to characterize whether the corresponding management nodes can normally exchange management information. The communication between management nodes can be different from the communication when a management node accesses the first database node. The former can be the communication used when multiple management nodes within the anomaly detection device 110 perform state synchronization or consistency protocol communication, while the latter can be the communication used when a management node accesses the first database node in the database cluster 120 through the communication network layer 130.
[0221] The communication status between management nodes can be obtained in various ways. For example, when multiple management nodes in the anomaly detection device 110 use the Raft protocol for information synchronization, the anomaly detection device 110 can determine the corresponding communication status based on the communication between the management node currently assuming the leader role and the management node assuming the follower role. Taking the first management node as the leader node and the second and third management nodes as followers as examples, the first management node can interact with the second and third management nodes by sending heartbeat messages or other Raft protocol messages. When the first management node can send the corresponding message to the second management node normally and receive a response from the second management node within the corresponding time, the anomaly detection device 110 can determine that the communication status between the first and second management nodes is normal. Correspondingly, when the first management node can send the corresponding message to the third management node normally and receive a response from the third management node within the corresponding time, the anomaly detection device 110 can determine that the communication status between the first and third management nodes is normal.
[0222] For example, the anomaly detection device 110 can determine the corresponding communication status based on the consistency log replication status between the leader node and the follower nodes. Taking the first management node as the leader node and the second and third management nodes as followers as an example, when the first management node can send consistency logs to the second management node, and the second management node can normally receive or acknowledge the corresponding consistency logs, the anomaly detection device 110 can determine that the communication status between the first and second management nodes is normal; when the first management node can send consistency logs to the third management node, and the third management node can normally receive or acknowledge the corresponding consistency logs, the anomaly detection device 110 can determine that the communication status between the first and third management nodes is normal.
[0223] The communication status between management nodes can include normal communication or communication failure. In other possible implementations, the communication status may further include response timeout, connection interruption, log synchronization failure, or other statuses, which are not limited in this application.
[0224] In practical applications, communication between multiple management nodes for managing databases, synchronizing states, and transmitting consistency protocol messages can be referred to as management plane communication. Management plane communication is merely an illustrative term used to distinguish between communication between management nodes and communication between management nodes accessing database nodes. It does not limit the database management system 100 to using two physically isolated networks. For example, management plane communication between management nodes and communication between management nodes accessing the first database node can be implemented on different physical networks, or they can share some switching devices, routing devices, or network links within the same physical network.
[0225] S605: The anomaly detection device 110 determines whether a communication failure has occurred between multiple management nodes corresponding to the target status detection results.
[0226] The anomaly detection device 110 can determine whether there is a communication failure among the multiple management nodes that generate the target status detection results based on the communication status obtained in step S604, and further determine whether the multiple target status detection results may be affected by a common communication failure.
[0227] For example, when both the first management node and the second management node generate target status detection results for the first database node, the anomaly detection device 110 can obtain the connection status, consistency log replication status, or other information that can reflect the communication between the two management nodes.
[0228] When a persistent heartbeat timeout, connection interruption, failure to replicate consistency logs, or other communication failures occur between the first and second management nodes, the anomaly detection device 110 can determine that a communication failure exists between multiple management nodes. In this case, the simultaneous inability of the first and second management nodes to access the first database node may be related to multiple management nodes being affected by management-side communication anomalies, thus reducing the independence between the multiple target state detection results. Therefore, the anomaly detection device 110 can temporarily refrain from directly confirming the anomaly of the first database node itself based on the multiple target state detection results and execute step S606 to further verify the preliminary anomaly detection results.
[0229] For example, both the first and second management nodes are continuously unable to access the first database node normally, and the heartbeat messages between the first and second management nodes also continuously time out. The first and second management nodes may be in the same or similar network fault areas, or some shared communication resources may be malfunctioning. In this situation, the simultaneous generation of target status detection results by multiple management nodes may not be entirely due to an anomaly in the first database node itself. The anomaly detection device 110 can further generate a verification result and determine whether to continue retaining the judgment that the first database node itself is abnormal based on the verification result.
[0230] Therefore, the anomaly detection device 110 can utilize the communication status between management nodes that generate multiple target status detection results to perform a second-level verification on the preliminary anomaly detection results obtained based on the multiple status detection results. When communication between multiple management nodes is normal, the possibility of multiple target status detection results being affected by a common communication anomaly is low; when communication failures also exist between multiple management nodes, it can identify situations where multiple target status detection results may be affected by a common communication anomaly, thereby reducing the possibility of incorrectly identifying the first database node as itself as an anomaly due to a common communication failure on the management side, and improving the accuracy of anomaly source judgment.
[0231] S606: Anomaly detection device 110 generates verification results.
[0232] The verification results can be generated based on the communication status between multiple management nodes corresponding to the target status detection results.
[0233] In one possible implementation, when there is a communication failure among multiple management nodes, and the communication failure may collectively affect the detection results of multiple target states, the anomaly detection device 110 can generate a verification result indicating that there is a communication failure among the corresponding management nodes.
[0234] For example, the verification result can also be used to indicate that the first database node itself has not experienced any abnormalities. For instance, when both the first management node and the second management node form target status detection results for the first database node, and a network partition occurs between the first management node and the second management node, and the anomaly detection device 110 can determine from other status information that the first database node can still provide database services normally, the anomaly detection device 110 can generate a verification result to indicate that the first database node itself has not experienced any abnormalities.
[0235] In another possible implementation, if the currently obtained information is sufficient to determine that there is a communication failure among multiple management nodes, but is insufficient to further confirm the actual operating status of the first database node itself, the anomaly detection device 110 can generate a review result to temporarily disregard the anomaly of the first database node itself. For example, the anomaly detection device 110 can adjust the anomaly status of the first database node from "the first database node itself is abnormal" to "pending review" or other intermediate status, and continue to obtain subsequent status detection results.
[0236] The anomaly detection device 110 can also freeze at least some of the operation and maintenance operations related to the first database node based on the verification results.
[0237] In this embodiment, "freezing" can mean temporarily suspending or prohibiting operations that may change the service status or cluster structure of the first database node, but it does not mean stopping all processing of the database management system 100. For example, the anomaly detection device 110 can suspend at least one of the following operations: switching the database service of the first database node, node isolation, node deletion, or database cluster reconfiguration. The anomaly detection device 110 can still perform status detection, status information collection, alarms, or communication link checks.
[0238] When subsequent status probe results or communication status between management nodes change, the anomaly detection device 110 can re-perform anomaly detection or verification. For example, after communication between management nodes is restored, the anomaly detection device 110 can re-obtain the status probe results formed by different management nodes for the first database node and execute the detection again. Figure 5 The source of the anomaly is determined as shown.
[0239] exist Figure 6 In one implementation shown, after the anomaly detection device 110 generates the verification result, it can further execute the communication path anomaly response strategy shown in step S603. Figure 6 The dashed connection relationship in the diagram can be used to represent the above optional processing. For example, after freezing the relevant operation and maintenance operations for the first database node, the anomaly detection device 110 can simultaneously generate alarms, perform link detection, or take other communication failure response measures for communication failures between management nodes.
[0240] S607: The anomaly detection device 110 executes the first database node's own anomaly response strategy.
[0241] When the preliminary anomaly detection result indicates an anomaly in the first database node itself, and the communication status obtained in step S605 does not indicate a communication failure between multiple management nodes corresponding to the target status detection result, the anomaly detection device 110 can execute a response strategy corresponding to the anomaly in the first database node itself.
[0242] When the first database node experiences an anomaly, the anomaly detection device 110 can determine an appropriate anomaly response strategy based on the database service currently provided by the first database node, whether other database nodes can take over the database service, and the current anomaly status of the first database node. For example, if the first database node is currently providing the primary database service, and there are other database nodes in the database cluster 120 capable of taking over the database service, the anomaly detection device 110 can switch the database service provided by the first database node to another database node. Alternatively, if the first database node can no longer provide database services normally, the anomaly detection device 110 can stop the first database node from continuing to provide the corresponding database service.
[0243] In one possible implementation, the anomaly detection device 110 can also isolate the first database node. For example, the anomaly detection device 110 can prevent business traffic from continuing to access the first database node, allowing other normal database nodes to continue providing database services.
[0244] The anomaly detection device 110 can also perform at least one of the following operations according to the operation and maintenance strategy of the database management system 100: alarm, node replacement, or other database node anomaly response.
[0245] The above-described database node self-abnormal response strategies are only used to illustrate several processing methods that the anomaly detection device 110 can execute, and do not mean that all processing methods need to be executed every time the first database node itself experiences an anomaly. The anomaly detection device 110 can select one or more processing methods according to the actual abnormal state. For example, when the first database node only experiences a recoverable database service process anomaly, the anomaly detection device 110 can first generate an alarm or attempt to recover the database service; when the first database node experiences a serious anomaly that prevents it from continuing to provide database services, the anomaly detection device 110 can perform database service switching, service shutdown, or node isolation.
[0246] The anomaly detection device 110 can also record Figure 6 The information generated during the processing is shown. For example, the anomaly detection device 110 can record at least one of the following: the identifier of the first database node, the identifier of the management node that generated the target status detection result, the preliminary anomaly detection result, the communication status between management nodes, the verification result, and the final anomaly response operation. At least one of the following—the preliminary anomaly detection result, the communication status between management nodes, the verification result, and the final anomaly response operation—can be associated and saved with the identifier of the first database node and the corresponding management node identifier to form an anomaly detection event or maintenance event, for subsequent fault querying or process tracing.
[0247] pass Figure 6 As shown in the diagram, the anomaly detection device 110 can perform corresponding processing based on the anomaly source indicated by the preliminary anomaly detection result. When the preliminary anomaly detection result indicates an anomaly in the communication path, the anomaly detection device 110 can execute an anomaly response for the corresponding communication path; when the preliminary anomaly detection result indicates an anomaly in the first database node itself, the anomaly detection device 110 can also verify the communication status between multiple management nodes.
[0248] When communication failures occur between multiple management nodes, the anomaly detection device 110 can temporarily suspend related maintenance operations on the first database node based on the verification results. When communication between multiple management nodes is normal, the anomaly detection device 110 can continue to execute the processing corresponding to the anomaly of the first database node itself. This reduces the possibility of normal database nodes being incorrectly subjected to maintenance operations due to communication failures on the management side, and improves the accuracy and relevance of anomaly handling.
[0249] It should be noted that, Figure 6 The verification and anomaly response processes shown are only one possible implementation and are not intended to limit the scope. In practical applications, the anomaly detection device 110 can select to execute one or more verification or anomaly response processes based on the anomaly detection results, the communication status between management nodes, and the database management strategy.
[0250] The above combination Figures 1 to 6 The anomaly detection method provided in the embodiments of this application will be introduced. Next, with reference to the accompanying drawings, an implementation of the anomaly detection device and computing device provided in the embodiments of this application will be described.
[0251] Based on the aforementioned anomaly detection method, this application also provides an anomaly detection device. The anomaly detection device may include multiple functional modules, which can cooperate with each other to implement the corresponding processing in the aforementioned anomaly detection method. The following describes... Figure 7 The functional structure of an anomaly detection device is described.
[0252] See Figure 7 , Figure 7 This is a schematic diagram of the structure of an anomaly detection device 700 provided in an embodiment of this application. The anomaly detection device 700 can be applied to... Figure 1 The database management system 100 shown can also be applied to other database management systems that can perform status probing on database nodes through multiple management nodes.
[0253] like Figure 7As shown, the anomaly detection device 700 may include a detection module 710 and a generation module 720. The detection module 710 and the generation module 720 may be implemented through software functions, hardware circuits, or a combination of software and hardware. In one example, the detection module 710 and the generation module 720 may be implemented through program processes running on a management node. In another example, the detection module 710 and the generation module 720 may also be implemented by one or more processors in the management node executing corresponding computer programs. Multiple management nodes in the anomaly detection device 700 may each undertake at least a portion of the processing functions of the detection module 710 or the generation module 720. This application does not limit the fixed deployment method between each functional module and the physical management node.
[0254] The detection module 710 can be used to perform status probing on the first database node through multiple management nodes and obtain multiple status probing results for the first database node. Different status probing results can be generated based on the status probing performed on the first database node by different management nodes. Each status probing result can characterize the access status of the first database node by the management node that generated the status probing result.
[0255] For example, the first, second, and third management nodes can each send status probe requests to the first database node and generate status probe results based on the received probe responses. Status probes can employ connection establishment, lightweight queries, health check requests, or other probe methods supported by the database. Status probe results can include a normal access status or an abnormal access status, and can also include at least one of the following: management node identifier, database node identifier, probe time, probe round, response duration, or error type. For a specific implementation of multiple management nodes performing status probes and generating status probe results, please refer to [link to relevant documentation]. Figures 2 to 4 Related embodiments will not be repeated here.
[0256] The generation module 720 can be used to generate anomaly detection results for the first database node based on multiple state probe results. The generation module 720 can determine the target state probe result from the multiple state probe results and generate the anomaly detection result according to the number of target state probe results. The target state probe result can be used to characterize abnormal access to the first database node by the corresponding management node.
[0257] For example, when the number of target state detection results exceeds a first threshold, the generation module 720 can generate an anomaly detection result indicating an anomaly in the first database node itself. When the number of target state detection results is less than a second threshold, the generation module 720 can generate an anomaly detection result indicating an anomaly in the communication path between the management node that generated the target state detection result and the first database node. The first threshold can be greater than the second threshold. The first and second thresholds can be determined based on the number of management nodes participating in the state detection of the first database node, the deployment scale of the database management system 100, or the anomaly detection strategy. For a specific implementation regarding the number of target state detection results and the generation of anomaly detection results, please refer to [link to relevant documentation]. Figure 5 Related embodiments will not be repeated here.
[0258] In one possible implementation, the anomaly detection device 700 may further include a synchronization module. The synchronization module is an optional functional module.
[0259] The synchronization module can be used to synchronize the identifiers of database nodes between different management nodes. For example, multiple management nodes may include a first management node and a second management node, and the database management system 100 can also manage the second database node. The synchronization module can synchronize the identifiers of the first and second database nodes to the second management node through the first management node, enabling the second management node to obtain the identifiers of the multiple database nodes managed by the database management system 100.
[0260] The synchronization module can use a consistency protocol, shared management data, distributed configuration data, or other inter-management node communication mechanisms to complete identifier synchronization. For example, when the database management system 100 uses the Raft protocol, the first management node can write the identifiers of the first and second database nodes into the consistency log, and the second management node can obtain the corresponding identifier through log replication. In another possible implementation, the anomaly detection device 700 may also include a determination module. The determination module is an optional functional module.
[0261] The determination module can be used to determine probe allocation information. For example, the determination module can determine the first probe allocation information based on the identifiers of the first database node and the second database node through the first management node. The first probe allocation information can record the database nodes for which the first management node needs to perform state probes. The probe module 710 can further perform state probes on the database nodes to be probed recorded in the first probe allocation information through the first management node.
[0262] The probe allocation information can be a set of database node identifiers, a list of probe tasks, a set of database node indexes, or other data structures that can represent the database nodes to be probed. For example, the first probe allocation information can record one or more database nodes, such as the first database node and the second database node. For a specific implementation of determining the probe allocation information and performing state probes based on it, please refer to [link to relevant documentation]. Figure 3 Related embodiments will not be repeated here.
[0263] The determination module can also be used to determine anomaly count values and, based on these count values, to determine the target state probe result. For example, when a management node continuously receives state probe results characterizing anomalies in access to a first database node, the determination module can update the anomaly count value for that management node regarding the first database node. When the anomaly count value reaches a third threshold, the determination module can determine the current state probe result as the target state probe result.
[0264] The anomaly count can be generated through methods such as successive accumulation, resetting after obtaining a normal state detection result, decreasing after obtaining a normal state detection result, or weighted accumulation. For example, each time the first management node obtains a state detection result indicating an access anomaly, it can increment the anomaly count by 1; when the first management node obtains a state detection result indicating a normal access, it can restore the anomaly count to its initial value. For a specific implementation of determining the anomaly count and the target state detection result, please refer to steps S203 and... Figure 5 Related embodiments will not be repeated here.
[0265] In one possible implementation, when the first management node malfunctions, the determining module can also determine the second probe allocation information through the second management node. For example, the second management node can determine the second probe allocation information based on the identifiers of the first and second database nodes. The second probe allocation information can record the database nodes for which the second management node needs to perform state probing, wherein the database nodes to be probed recorded in the second probe allocation information may include one or more database nodes that undertook state probing tasks before the first management node malfunctioned.
[0266] The detection module 710 can further perform status detection through the second management node based on the second detection allocation information. For example, if the first management node was undertaking the status detection task of the first database node before the first management node experienced an anomaly, the second detection allocation information determined by the second management node can add the first database node, and then the second management node can continue to perform status detection on the first database node. All detection tasks originally undertaken by the first management node can be taken over by the second management node, or they can be shared by the second management node and other normal management nodes. For information on adjusting detection tasks after a management node anomaly, please refer to [link to relevant documentation]. Figure 3 Related embodiments will not be repeated here.
[0267] In another possible implementation, the anomaly detection device 700 may further include an acquisition module. The acquisition module is an optional functional module.
[0268] The acquisition module can be used to obtain the communication status between multiple management nodes. For example, when the anomaly detection result indicates that the first database node itself is abnormal, the acquisition module can obtain the communication status between the management nodes that generated multiple target status detection results. The communication status can be obtained based on heartbeat messages between management nodes, consistency protocol communication status, network connection status, or other information that can characterize the communication situation between multiple management nodes.
[0269] For example, when multiple management nodes can transmit heartbeat messages normally and complete consensus protocol interactions normally, the acquisition module can obtain a communication status indicating normal communication between the multiple management nodes. When heartbeat messages between some management nodes are interrupted, consensus protocol communication fails, or network connection is interrupted, the acquisition module can obtain a communication status indicating communication failure between the multiple management nodes. For a specific implementation of obtaining the communication status between management nodes, please refer to [link to relevant documentation]. Figure 6 Related embodiments will not be repeated here.
[0270] The generation module 720 can also generate a verification result based on the communication status obtained by the acquisition module. For example, if multiple target status detection results initially indicate that the first database node itself is abnormal, and if there is a communication failure between the relevant management nodes, the generation module 720 can generate a verification result indicating a communication failure and that the first database node itself is not abnormal. For a specific implementation of the verification result generation and subsequent processing, please refer to [link to relevant documentation]. Figure 6 Related embodiments will not be repeated here.
[0271] In one possible implementation, the anomaly detection device 700 may further include an execution module. The execution module is an optional functional module.
[0272] The execution module can be used to perform exception handling based on the anomaly detection results. For example, when the anomaly detection result indicates that the first database node itself is abnormal, the execution module can switch the database service provided by the first database node to another database node, or it can stop the first database node from providing database services. The execution module can also perform database node isolation, database node replacement, database cluster reconfiguration, or other database node anomaly handling.
[0273] When the anomaly detection result indicates an anomaly in the communication path between the management node and the first database node, the execution module can perform an anomaly response operation. This operation can mitigate the impact of the communication path anomaly on the status probing of the first database node. For example, the anomaly response operation may include at least one of the following: communication link detection, communication connection re-establishment, status probing parameter adjustment, or probing task adjustment. The execution module can also generate alarm information related to the communication path anomaly so that the database management system 100 can record or output the current communication anomaly.
[0274] In one example, the execution module can transfer the state probing task affected by the communication path anomaly to another management node that can access the first database node normally. The other management node can then continue performing state probing on the first database node. In another example, the execution module can re-establish the abnormal communication connection and resume the original management node's state probing task after communication is restored. For differentiated handling of anomalies in the first database node itself and communication path anomalies, please refer to [link to documentation]. Figure 6 Related embodiments.
[0275] It should be noted that, Figure 7 Only the detection module 710 and the generation module 720, two functional modules used to implement basic anomaly detection processing, are shown. The synchronization module, determination module, acquisition module, and execution module are all optional functional modules that can be configured in the anomaly detection device 700. Figure 7 The optional functional modules mentioned above are not shown. The anomaly detection device 700 may be equipped with one or more of the optional functional modules mentioned above as needed, or at least some of the processing functions undertaken by the optional functional modules may be implemented by the detection module 710, the generation module 720 or other existing functional modules.
[0276] Figure 7The functional module division described herein is primarily used to illustrate one functional implementation of the anomaly detection device 700, and does not limit different functions to be implemented by separate physical components. The detection module 710, generation module 720, and optional functional modules can be implemented through software modules, hardware circuits, or a combination of software and hardware. Two or more functional modules can also be integrated into the same software module or hardware component, and a functional module can also be implemented by multiple software modules or hardware components.
[0277] Figure 7 The anomaly detection device 700 shown can correspond to Figure 1 The anomaly detection device 110 in the anomaly detection device 700. Therefore, the specific processing procedures and corresponding technical effects of each functional module in the anomaly detection device 700 can be found in [reference]. Figures 1 to 6 The relevant descriptions in the corresponding embodiments will not be repeated here.
[0278] The following is combined Figure 8 The hardware structure of a computing device used to implement the anomaly detection method or anomaly detection device of this application is described.
[0279] See Figure 8 , Figure 8 This is a schematic diagram of the hardware structure of a computing device 800 provided in an embodiment of this application. Figure 8 As shown, the computing device 800 may include a processor 801, a memory 802, a communication interface 803, and a bus 804. The processor 801, the memory 802, and the communication interface 803 can communicate via the bus 804.
[0280] Computing device 800 can be used to achieve Figure 1 The anomaly detection device 110 includes one or more management nodes, which can also be used to implement... Figure 7 The anomaly detection device 700 in the middle.
[0281] Bus 804 can be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or other buses capable of transmitting data, address, and control information. Bus 804 may also include at least one of an address bus, a data bus, and a control bus. Figure 8 A single bus 804 is used to represent a communication relationship between various hardware components. This is mainly for the purpose of simplifying the illustrations and does not mean that the computing device 800 can only include one physical bus or one type of bus.
[0282] The processor 801 can be used to execute computer programs stored in the memory 802, causing the computing device 800 to execute the anomaly detection method provided in the embodiments of this application.
[0283] Processor 801 may be a central processing unit (CPU), or at least one of a digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), other programmable logic device, or discrete device assembly. Processor 801 may include one processing core or multiple processing cores.
[0284] The memory 802 can be used to store computer programs and data used during the operation of the computing device 800. For example, the memory 802 can store at least one of the following: database node information, probe allocation information, status probe results, anomaly count values, anomaly detection results, communication status between management nodes, or verification results.
[0285] The memory 802 may include at least one of volatile memory and non-volatile memory. Non-volatile memory may include, for example, read-only memory (ROM), programmable read-only memory, flash memory, or solid-state memory; volatile memory may include, for example, random access memory (RAM). The memory 802 may be integrated into the processor 801 or may be disposed independently outside the processor 801.
[0286] The communication interface 803 can be used by the computing device 800 to communicate with other management nodes, database nodes, or other network devices. For example, the communication interface 803 can send or receive consensus protocol messages, database node information, status probe requests, probe responses, status probe results, or information related to abnormal responses.
[0287] Communication interface 803 may include at least one of wired communication interface and wireless communication interface. Different communication interfaces can be used for communication between management nodes and communication between management nodes and database nodes, or different types of communication data can be carried through the same communication interface.
[0288] In one possible implementation, the first management node, the second management node, and the third management node can be implemented by different computing devices 800. For example, the three management nodes can run on three separate servers and interact with each other through a communication network.
[0289] In another possible implementation, the same computing device 800 can also implement two or more management nodes through virtual machines, containers, or other independent runtime environments. Different management nodes can form mutually distinguishable sources of state detection results, which can be used to execute the aforementioned anomaly detection method based on multiple management nodes.
[0290] It should be noted that, Figure 8 The hardware structure shown is merely an exemplary implementation of the computing device 800 and is not intended to limit its functionality. In practical applications, the computing device 800 may also include multiple processors, multiple memories, input / output interfaces, or other hardware components.
[0291] When processor 801 executes a computer program stored in memory 802, it can cause computing device 800 to perform... Figures 1 to 6 The anomaly detection method in the corresponding embodiment. For the specific processing procedure and corresponding technical effects of the method, please refer to the foregoing embodiments, which will not be repeated here.
[0292] This application also provides a computer-readable storage medium. This computer-readable storage medium can store a computer program. When the computer program is executed by a processor, it can enable a corresponding computing device to implement any of the aforementioned anomaly detection methods of this application.
[0293] A computer-readable storage medium can be any available storage medium accessible to a computing device, or it can be a data storage device that includes one or more available storage media. As different implementation examples, a computer-readable storage medium can include a magnetic storage medium, an optical storage medium, a semiconductor storage medium, or other media capable of storing a computer program.
[0294] This application also provides a computer program product. The computer program product may include a computer program, which, when executed by a processor, enables a computing device to perform any of the aforementioned anomaly detection methods.
[0295] Computer program products may take the form of software installation packages, executable programs, program modules, or other programs that can be loaded and executed by computing devices, and the embodiments of this application do not limit this.
[0296] It should be noted that, Figure 7 The anomaly detection device 700 shown Figure 8The computing device 800, computer-readable storage medium, and computer program product shown all correspond to the aforementioned anomaly detection method. Therefore, for the same or similar processing procedures and the technical effects produced by the corresponding processing procedures as in the aforementioned method embodiments, please refer to the relevant descriptions in the aforementioned method embodiments, and they will not be repeated here.
[0297] In the embodiments of this application, "at least one" refers to one or more, and "multiple" refers to two or more. "And / or" is used to describe the association relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: only A exists, both A and B exist, or only B exists.
[0298] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate; this is merely a method of distinction used in describing objects with the same attributes in the embodiments of this application.
[0299] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can make equivalent modifications or substitutions to the above embodiments within the scope of the technology disclosed in this application, and such modifications or substitutions should all be covered within the scope of protection of this application.
Claims
1. An anomaly detection method, characterized in that, The method is applied to a database management system, which includes multiple management nodes, the number of which is not less than three. These multiple management nodes are used to manage a first database node. The method includes: The multiple management nodes perform state probing on the first database node to obtain multiple state probing results for the first database node. The different state probing results are generated based on the state probing performed on the first database node by different management nodes among the multiple management nodes. The state probing results are used to characterize the access state of the management nodes to the first database node. One of the multiple management nodes generates an anomaly detection result for the first database node based on the multiple state detection results; Wherein, if the number of target state detection results among the plurality of state detection results is greater than a first threshold, the anomaly detection result is used to indicate that the first database node itself is abnormal, and the target state detection result is used to indicate that the management node's access to the first database node is abnormal; if the number of target state detection results among the plurality of state detection results is less than a second threshold, the anomaly detection result is used to indicate that the communication path between the management node that generated the target state detection result and the first database node is abnormal, and the first threshold is greater than the second threshold.
2. The method according to claim 1, characterized in that, The plurality of management nodes includes a first management node and a second management node, and the plurality of management nodes are also used to manage a second database node. The method further includes: The first management node synchronizes the identifier of the first database node and the identifier of the second database node to the second management node; The first management node determines first probe allocation information based on the identifier of the first database node and the identifier of the second database node. The first probe allocation information is used to record the database node to be probed corresponding to the first management node. The first management node performs status detection on the database nodes to be detected recorded in the first detection allocation information, based on the first detection allocation information.
3. The method according to claim 1, characterized in that, The target state detection result is the state detection result where the anomaly count value reaches the third threshold. The anomaly count value is used to characterize the number of times that the access state of one of the multiple management nodes to the first database node is continuously determined to be abnormal.
4. The method according to claim 1, characterized in that, The method further includes: When the anomaly detection result indicates that the first database node itself is abnormal, the communication status between multiple management nodes corresponding to the target status detection result is obtained. In the event that there is a communication failure among multiple management nodes corresponding to the target state detection result, a verification result is generated. The verification result is used to indicate the communication failure and that the first database node itself has not experienced any abnormalities.
5. The method according to any one of claims 1 to 4, characterized in that, The method further includes: If the anomaly detection result indicates that the first database node itself is abnormal, the database service provided by the first database node will be switched to another database node, or the database service provided by the first database node will be stopped. If the anomaly detection result indicates that the communication path between the management node corresponding to the target state detection result and the first database node is abnormal, an anomaly response operation is performed to reduce the impact of the communication path anomaly on the state detection of the first database node.
6. The method according to claim 2, characterized in that, The method further includes: In the event of an anomaly in the first management node, the second management node determines second probe allocation information based on the identifier of the first database node and the identifier of the second database node. The second probe allocation information is used to record the database nodes to be probed by the second management node, including the database nodes to be probed corresponding to the first management node. The second management node performs status detection on the database nodes to be detected recorded in the second detection allocation information, based on the second detection allocation information.
7. An anomaly detection device, characterized in that, The device is applied to a database management system, which includes multiple management nodes, the number of which is not less than three. These multiple management nodes are used to manage a first database node. The device includes: The detection module is used to perform state detection on the first database node through the multiple management nodes to obtain multiple state detection results for the first database node. The different state detection results among the multiple state detection results are generated based on the state detection performed on the first database node by different management nodes among the multiple management nodes. The state detection results are used to characterize the access state of the management node to the first database node. A generation module is used to generate anomaly detection results for the first database node based on the multiple state detection results; Wherein, if the number of target state detection results among the plurality of state detection results is greater than a first threshold, the anomaly detection result is used to indicate that the first database node itself is abnormal, and the target state detection result is used to indicate that the management node's access to the first database node is abnormal; if the number of target state detection results among the plurality of state detection results is less than a second threshold, the anomaly detection result is used to indicate that the communication path between the management node that generated the target state detection result and the first database node is abnormal, and the first threshold is greater than the second threshold.
8. A computing device, characterized in that, Including processor and memory; The memory is used to store computer programs; The processor is configured to execute the computer program to cause the computing device to perform the method of any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method of any one of claims 1 to 6.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 6.
