Network monitoring method and device based on CTDB and electronic equipment
By periodically obtaining node information and monitoring the status of the private network in the CTDB cluster, the reliability and high availability problems of the CTDB cluster when private IP network abnormalities are solved, real-time monitoring and automatic recovery are realized, and manual intervention costs are reduced.
Patent Information
- Application Number
- CN202411633768.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-03-21
AI Technical Summary
The CTDB cluster lacks real-time supervision when private IP network abnormalities, resulting in reduced cluster reliability and high availability, requiring manual intervention to repair, affecting the user experience.
CTDB periodically obtains the node information of the target node, determines the private IP address and the private network status of the network port, and adjusts the monitoring mode according to the status to realize real-time monitoring and automatic recovery of the private network status.
It reduces the probability of network partitioning in CTDB clusters, reduces the cost of manual intervention, and improves the high availability and stability of the cluster.
Smart Images

Figure CN119676077A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of network communications, and more particularly to a CTDB-based network monitoring method, device, and electronic device. Background Art
[0002] With the rapid development of network communication technology, cluster trivial database (CTDB) is often combined with cluster file system to solve high-availability cluster solutions, and recovery locks and master-slave mode are provided to solve the problem of split brain. CTDB usually configures two sets of IP addresses, including private IP for communication between nodes within the CTDB cluster and public IP for providing services to clients. However, the CTDB protocol does not have authentication and encryption operations. Based on network security considerations, private IP is usually configured in a private network, separated from the public IP network. However, CTDB currently lacks real-time monitoring of the network status of the private IP. Once the network where the private IP is located is abnormal, it usually requires a certain amount of manpower cost to intervene and repair, which affects the reliability of the cluster. When the private network abnormality of the CDTB cluster recovery master node cannot be repaired, the CTDB cluster will have a single-node network partition to provide services to the outside world, resulting in a single node running for a long time and high load, reducing the reliability, stability and high availability of the system, greatly affecting the stability of the cluster and the user experience of the product. Summary of the invention
[0003] The embodiments of this specification provide a network monitoring method, device and electronic device based on CTDB, and the technical solution thereof is as follows: In a first aspect, an embodiment of the present specification provides a network monitoring method based on CTDB, the method comprising: Periodically obtain node information of target nodes based on CTDB; Determine the private IP address and network port of the target node based on the node information, and determine the private network status corresponding to the private IP address and network port based on a shell command; Determine whether to restore the network status based on the private network status, and record the network status result; A node type of the target node is determined, and a monitoring mode of the target node is adjusted based on the node type, the network status result, and the node status.
[0004] In a second aspect, a CTDB-based network monitoring device is provided, the device comprising: An acquisition module, used for periodically acquiring node information of a target node based on CTDB; A determination module, configured to determine the private IP address and network port of the target node based on the node information, and determine the private network status corresponding to the private IP address and network port based on a shell command; A recovery module, used to determine whether to restore the network status based on the private network status, and record the network status result; The adjustment module is used to determine the node type of the target node and adjust the monitoring mode of the target node based on the node type, network status result and node status.
[0005] In a third aspect, an electronic device is provided, including a device processor and a memory; The device processor is connected to the memory; The memory is used to store executable program code; The device processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the steps of the method provided in the first aspect or any possible implementation manner of the first aspect.
[0006] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and the computer-readable storage medium stores instructions, which, when the instructions are executed on a computer or a device processor, cause the computer or the device processor to execute the method provided in the first aspect or any possible implementation of the first aspect.
[0007] The beneficial effects brought by the technical solutions provided by some embodiments of this specification include at least: In one or more embodiments of the present specification, the node information of the target node is periodically obtained through CTDB, and then the private IP address and network port of the target node are determined based on the node information, and the private network status corresponding to the private IP address and network port is determined based on the shell command, and then, based on the private network status, it is determined whether to restore the network status, and the network status result is recorded, and finally the node type of the target node is determined, and the monitoring mode of the target node is adjusted based on the node type, network status result and node status. The probability of network partition in the CTDB cluster is reduced, the cost of human intervention is reduced, and the high availability and stability of the cluster system are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0009] Figure 1 A schematic diagram of the system architecture of a network monitoring method based on CTDB provided in an embodiment of this specification; Figure 2 A flowchart of a network monitoring method based on CTDB provided in an embodiment of this specification; Figure 3 A schematic diagram of the structure of a network monitoring device based on CTDB provided in an embodiment of this specification; Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0010] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0011] The terms "first", "second", "third", etc. in the description and claims of this specification and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0012] The following description provides examples and does not limit the scope, applicability or examples set forth in the claims. Changes may be made to the functions and arrangements of the elements described without departing from the scope of the present specification. Various processes or components may be appropriately omitted, substituted or added to each example. For example, the described method may be performed in an order different from the order described, and various steps may be added, omitted or combined. In addition, features described with respect to some examples may be combined in other examples.
[0013] See also Figure 1 , Figure 1 A schematic diagram of the system architecture of a CTDB-based network monitoring method provided in an embodiment of this specification is shown.
[0014] like Figure 1As shown, the system architecture of the CTDB-based network monitoring method may include three server nodes to deploy a CTDB cluster, and Ceph can be used as the cluster file system at the bottom layer. When configuring the CTDB service, the recovery lock of CTDB can be set on the shared directory of the cluster so that all nodes can access it; configure the private IP and public IP of CTDB, where the private IP is configured in the private network and separated from the public IP network. After starting the CTDB service of each node in the cluster, all nodes in the cluster elect a leading node, which obtains and holds the recovery lock, and other nodes become follower nodes.
[0015] In addition, it should be noted that Figure 1 What is shown is only a system architecture provided by the present disclosure. In practical applications, other systems may also be included, for example, more servers may be included.
[0016] See next Figure 2 , Figure 2 The overall flow chart of a CTDB-based network monitoring method provided in an embodiment of the present specification is shown. The CTDB-based network monitoring method can be used in the server 20 .
[0017] like Figure 2 As shown, the CTDB-based network monitoring method may at least include the following steps: Step 201: Periodically obtain node information of a target node based on CTDB.
[0018] In the embodiments of this specification, in order to periodically monitor the private network status of the target node, it is necessary to first periodically obtain the node information of the target node from the running information of the CTDB service subprocess CTDB_Recoverd. Among them, the node information may include the number of cluster nodes and the pnn and flags of each node. Among them, flags will be updated in real time according to the status changes of each node. For example, in the case of heartbeat failure between cluster nodes and CTDB health detection failure, flags will be updated to abnormal status values. When the node abnormality is restored, flags will also be updated to normal status values, and the current status information of this node at this time is recorded as node_flags.
[0019] Step 202: Determine the private IP address and network port of the target node based on the node information, and determine the private network status corresponding to the private IP address and network port based on a shell command.
[0020] In the embodiments of this specification, after obtaining the node information of the target node, it is possible to first determine whether the current node status of the target node is normal. If the current node status is displayed as prohibited, that is, abnormal, then exit this round of monitoring and start the next round of periodic monitoring. If the current node status is displayed as normal, first determine the private IP address and network port information corresponding to the target node from the global service information. Further, the private network status of the target node is determined by the determined private IP address and network port information, and the private network status of the target node can be determined by the shell command in the C language.
[0021] In one possible implementation, determining the private IP address and network port of the target node based on the node information includes: Determine the node authority of the target node based on the node information; Acquire global service information of the target node based on the node authority, and determine a private IP address based on the global service information; The network port of the target node corresponding to the private IP address is determined based on the interface instruction output.
[0022] In the embodiments of the present specification, the node authority of the target node is first determined by the node information. When the node authority is characterized as a normal node status, the node information can be tested by the PING command to see if it has arrived. Then, all service information of the target node is obtained, such as DNS records, service configuration files, or network configuration information, to determine the private IP address corresponding to the target node. Furthermore, the network port associated with the private IP address is determined using the interface instruction output, and the network port information is recorded in a log file to subsequently verify whether the network port status is normal. When the node authority is characterized as the current target node being prohibited, i.e., abnormal, this round of monitoring is exited and the next round of periodic monitoring is started.
[0023] In one possible implementation, determining the private network status corresponding to the private IP address and the network port based on a shell command includes: Execute shell commands based on the popen interface and read the returned information based on the fread interface; When the returned information indicates that the network port status is abnormal or the private IP address is not correctly configured on the corresponding network port, the private network status corresponding to the target node is determined to be abnormal; When the returned information indicates that the network port status is normal and the private IP is correctly configured on the corresponding network port, the private network status corresponding to the target node is determined to be normal.
[0024] In the embodiment of the present specification, the popen interface in the C language can be called to execute the shell command, and the return information can be read to determine the private network status corresponding to the private IP address and the network port. First, the first shell command is executed through the popen interface, and the return information is read through the fread interface in the C language. If it is empty, it means that the network port does not exist, and -1 is directly returned. If the network port exists, the second shell command is executed again. If it is empty, it means that the network port is DOWN, and -2 is directly returned. If the network port status is normal, the third shell command is executed and the information is read. If it is empty, it means that the private IP address is not correctly configured on the corresponding network port, and -3 is directly returned. When the network port is UP and the private IP address is correctly configured on the network port, 0 is returned. Therefore, the private network status corresponding to the private IP address and the network port can be determined by the returned information.
[0025] Step 203: Determine whether to restore the network status based on the private network status, and record the network status result.
[0026] In the embodiment of the present specification, after obtaining the private network state corresponding to the target node, it can be determined whether to restore the network state according to the private network state, that is, when the private network state is characterized as normal, the continuous monitoring state is maintained, and when the private network state is determined to be abnormal, the network state of the target node is attempted to be restored. After the network state of the target node is restored, the network state may be restored successfully or failed, so it is necessary to record the network state result after the recovery attempt.
[0027] In one possible implementation, determining whether to restore the network status based on the private network status and recording the network status result includes: When the private network status is characterized as abnormal, restoring the network status of the target node and recording the network status result; When the private network status is characterized as normal, the network status result is recorded.
[0028] In the embodiments of this specification, the private network status can be determined first, and whether it is necessary to try to restore the network status is determined based on the private network status. When the private network status is characterized as abnormal, the network status of the target node is restored and the network status result is recorded; when the private network status is characterized as normal, the network status result is recorded. After the network status of the target node is restored, the network status may be restored successfully to normal or failed to be restored, so it is necessary to record the network status result after the recovery attempt.
[0029] Step 204: Determine the node type of the target node, and adjust the monitoring mode of the target node based on the node type, network status result and node status.
[0030] In the embodiment of the present specification, when the private network status of the target node is detected to be abnormal and the network status is attempted to be restored, the node type of the target node can be determined by first determining whether a recovery lock is included or by comparing the pnn number of the current node and the restored master node. Among them, the node type generally includes a leading node and a follower node, and only the leading node has a recovery lock. Therefore, the monitoring mode can be adjusted according to the node type and combined with the network status result and the node status.
[0031] In one possible implementation, determining the node type of the target node, and adjusting the monitoring mode of the target node based on the node type, the network status result, and the node status, includes: Determine the node type of the target node, where the node type includes a leading node and a follower node; When the node type is a dominant node, judging the network status result and the node status; When the network result is characterized as an abnormal private network state, and the node state is characterized as a single-node partition providing external services, the recovery lock held by the target node is released and the target node is BANed; When the network result and the node status judgment result are characterized as other situations, the continuous monitoring state is maintained.
[0032] In the embodiments of the present specification, the node type of the target node is first determined by whether it has a recovery lock. Generally, the node types include a dominant node and a follower node. When the node type of the target node is judged to be a follower node, the next round of monitoring state is directly entered. When the node type of the target node is judged to be a dominant node, the network status result and the node status of the target node are judged again. When the network result is characterized as an abnormal private network status and cannot be recovered, and the node status is characterized as a single-node partition providing services to the outside world, the recovery lock held by the target node is released and the target node is BANed. When the network result and the node status judgment result are characterized as other situations, the continuous monitoring state is maintained.
[0033] In one possible implementation, when the network result is characterized as an abnormal private network state, and the node state is characterized as a single-node partition providing external services, releasing the recovery lock held by the target node and banning the target node includes: When the network result is characterized as an abnormal private network state, judging the node state of the target node and other node states; When the judgment result indicates that the node status is normal and the other node statuses are all disconnected, the target node is determined to become a single-node partition to provide external services, the recovery lock held by the target node is released and the target node is BANed.
[0034] In the embodiments of this specification, how to judge that the network result is characterized as an abnormal private network state, and the node state is characterized as a single node partition providing external services, it can be determined that the network result is characterized as an abnormal private network state and cannot be recovered, and then the node state and other node states of the target node are judged. When the judgment result is characterized as a normal node state and the states of other nodes are all unconnected, it is determined that the target node has become a single node partition providing external services, the recovery lock held by the target node is released, and the target node is BANed.
[0035] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0036] See next Figure 3 , Figure 3 The structure diagram of a network monitoring device based on CTDB provided in the embodiment of this specification is shown. It should be noted that: Figure 3 The network monitoring device based on CTDB shown is used to execute the present application Figure 2 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 2 The embodiment shown.
[0037] like Figure 3 As shown, the CTDB-based network monitoring device may at least include: An acquisition module 301 is used to periodically acquire node information of a target node based on CTDB; A determination module 302 is used to determine the private IP address and network port of the target node based on the node information, and determine the private network state corresponding to the private IP address and network port based on a shell command; A recovery module 303, configured to determine whether to restore the network status based on the private network status, and record the network status result; The adjustment module 304 is used to determine the node type of the target node and adjust the monitoring mode of the target node based on the node type, the network status result and the node status.
[0038] In one possible implementation, the determination module 302 is specifically configured to: Determine the node authority of the target node based on the node information; Acquire global service information of the target node based on the node authority, and determine a private IP address based on the global service information; The network port of the target node corresponding to the private IP address is determined based on the interface instruction output.
[0039] In one possible implementation, the determination module 302 is further configured to: Execute shell commands based on the popen interface and read the returned information based on the fread interface; When the returned information indicates that the network port status is abnormal or the private IP address is not correctly configured on the corresponding network port, the private network status corresponding to the target node is determined to be abnormal; When the returned information indicates that the network port status is normal and the private IP is correctly configured on the corresponding network port, the private network status corresponding to the target node is determined to be normal.
[0040] In one possible implementation, the recovery module 303 is specifically used for: When the private network status is characterized as abnormal, restoring the network status of the target node and recording the network status result; When the private network status is characterized as normal, the network status result is recorded.
[0041] In one possible implementation, the adjustment module 304 is specifically configured to: Determine the node type of the target node, where the node type includes a leading node and a follower node; When the node type is a dominant node, judging the network status result and the node status; When the network result is characterized as an abnormal private network state, and the node state is characterized as a single-node partition providing external services, the recovery lock held by the target node is released and the target node is BANed; When the network result and the node status judgment result are characterized as other situations, the continuous monitoring state is maintained.
[0042] In one possible implementation, the adjustment module 304 is further configured to: When the network result is characterized as an abnormal private network state, judging the node state of the target node and other node states; When the judgment result indicates that the node status is normal and the other node statuses are all disconnected, the target node is determined to become a single-node partition to provide external services, the recovery lock held by the target node is released and the target node is BANed.
[0043] Those skilled in the art can clearly understand that the technical solutions of the embodiments of the present application can be implemented with the help of software and / or hardware. The "unit" and "module" in this specification refer to software and / or hardware that can independently complete or cooperate with other components to complete specific functions, where the hardware can be, for example, a field programmable gate array (FPGA), an integrated circuit (IC), etc.
[0044] Each processing unit and / or module of the embodiments of the present application may be implemented by an analog circuit that implements the functions described in the embodiments of the present application, or may be implemented by software that executes the functions described in the embodiments of the present application.
[0045] See next Figure 4 , Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification is shown.
[0046] like Figure 4 As shown, the electronic device 400 may include: at least one device processor 401 , at least one network interface 404 , a user interface 403 , a memory 405 , and at least one communication bus 402 .
[0047] The communication bus 402 may be used to realize the connection and communication among the above-mentioned components.
[0048] The user interface 403 may include buttons, and the optional user interface may also include a standard wired interface or a wireless interface.
[0049] The network interface 404 may include, but is not limited to, a Bluetooth module, an NFC module, a Wi-Fi module, etc.
[0050] Among them, the device processor 401 may include one or more processing cores. The device processor 401 uses various interfaces and lines to connect various parts within the entire electronic device 400, and executes various functions and processes data of the electronic device 400 by running or executing instructions, programs, code sets or instruction sets stored in the memory 405, and calling data stored in the memory 405. Optionally, the device processor 401 can be implemented in at least one hardware form of DSP, FPGA, and PLA. The device processor 401 can integrate one or a combination of CPU, GPU, modem, etc. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to handle wireless communications. It can be understood that the above-mentioned modem may not be integrated into the device processor 401, and it can be implemented separately through a chip.
[0051] The memory 405 may include a RAM or a ROM. Optionally, the memory 405 includes a non-transitory computer-readable medium. The memory 405 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 405 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned method embodiments, etc.; the data storage area may store data involved in the above-mentioned method embodiments, etc. The memory 405 may optionally be at least one storage device located away from the aforementioned device processor 401. As Figure 4 As shown, the memory 405 as a computer storage medium may include an operating system, a network communication module, a user interface module, and program instructions.
[0052] Specifically, the device processor 401 may be used to call the CTDB-based network monitoring application stored in the memory 405, and specifically perform the following operations: Periodically obtain node information of target nodes based on CTDB; Determine the private IP address and network port of the target node based on the node information, and determine the private network status corresponding to the private IP address and network port based on a shell command; Determine whether to restore the network status based on the private network status, and record the network status result; A node type of the target node is determined, and a monitoring mode of the target node is adjusted based on the node type, the network status result, and the node status.
[0053] As an option of an embodiment of this specification, the determining the private IP address and network port of the target node based on the node information includes: Determine the node authority of the target node based on the node information; Acquire global service information of the target node based on the node authority, and determine a private IP address based on the global service information; The network port of the target node corresponding to the private IP address is determined based on the interface instruction output.
[0054] As an optional embodiment of this specification, the determining the private network status corresponding to the private IP address and the network port based on the shell command includes: Execute shell commands based on the popen interface and read the returned information based on the fread interface; When the returned information indicates that the network port status is abnormal or the private IP address is not correctly configured on the corresponding network port, the private network status corresponding to the target node is determined to be abnormal; When the returned information indicates that the network port status is normal and the private IP is correctly configured on the corresponding network port, the private network status corresponding to the target node is determined to be normal.
[0055] As an option of an embodiment of this specification, the determining whether to restore the network status based on the private network status and recording the network status result includes: When the private network status is characterized as abnormal, restoring the network status of the target node and recording the network status result; When the private network status is characterized as normal, the network status result is recorded.
[0056] As an optional embodiment of this specification, determining the node type of the target node, and adjusting the monitoring mode of the target node based on the node type, the network status result and the node status, includes: Determine the node type of the target node, where the node type includes a leading node and a follower node; When the node type is a dominant node, judging the network status result and the node status; When the network result is characterized as an abnormal private network state, and the node state is characterized as a single-node partition providing external services, the recovery lock held by the target node is released and the target node is BANed; When the network result and the node status judgment result are characterized as other situations, the continuous monitoring state is maintained.
[0057] As an optional embodiment of this specification, when the network result is characterized as an abnormal private network state, and the node state is characterized as a single-node partition providing external services, releasing the recovery lock held by the target node and banning the target node includes: When the network result is characterized as an abnormal private network state, judging the node state of the target node and other node states; When the judgment result indicates that the node status is normal and the other node statuses are all disconnected, the target node is determined to become a single-node partition to provide external services, the recovery lock held by the target node is released and the target node is BANed.
[0058] The embodiments of this specification also provide a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of the above method are implemented. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a micro drive, and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.
[0059] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0060] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0061] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0062] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0063] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0064] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, disk or optical disk and other media that can store program codes.
[0065] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by entering a program to instruct related hardware, and the program may be stored in a computer-readable memory, which may include a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0066] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
Claims
1. A network monitoring method based on CTDB, characterized in that: The method comprises: Periodically obtain node information of target nodes based on CTDB; Determine the private IP address and network port of the target node based on the node information, and determine the private network status corresponding to the private IP address and network port based on a shell command; Determine whether to restore the network status based on the private network status, and record the network status result; A node type of the target node is determined, and a monitoring mode of the target node is adjusted based on the node type, the network status result, and the node status.
2. The method according to claim 1, characterized in that: The determining the private IP address and network port of the target node based on the node information includes: Determine the node authority of the target node based on the node information; Acquire global service information of the target node based on the node authority, and determine a private IP address based on the global service information; The network port of the target node corresponding to the private IP address is determined based on the interface instruction output.
3. The method according to claim 1, characterized in that The determining the private network status corresponding to the private IP address and the network port based on the shell command includes: Execute shell commands based on the popen interface and read the returned information based on the fread interface; When the returned information indicates that the network port status is abnormal or the private IP address is not correctly configured on the corresponding network port, the private network status corresponding to the target node is determined to be abnormal; When the returned information indicates that the network port status is normal and the private IP is correctly configured on the corresponding network port, the private network status corresponding to the target node is determined to be normal.
4. The method according to claim 1, characterized in that: The determining whether to restore the network status based on the private network status and recording the network status result includes: When the private network status is characterized as abnormal, restoring the network status of the target node and recording the network status result; When the private network status is characterized as normal, the network status result is recorded.
5. The method according to claim 1, characterized in that The determining the node type of the target node, and adjusting the monitoring mode of the target node based on the node type, the network status result and the node status, includes: Determine the node type of the target node, where the node type includes a leading node and a follower node; When the node type is a dominant node, judging the network status result and the node status; When the network result is characterized as an abnormal private network state, and the node state is characterized as a single-node partition providing external services, the recovery lock held by the target node is released and the target node is BANed; When the network result and the node status judgment result are characterized as other situations, the continuous monitoring state is maintained.
6. The method according to claim 5, characterized in that When the network result is characterized as an abnormal private network state, and the node state is characterized as a single-node partition providing external services, releasing the recovery lock held by the target node and banning the target node, including: When the network result is characterized as an abnormal private network state, judging the node state of the target node and other node states; When the judgment result indicates that the node status is normal and the other node statuses are all disconnected, the target node is determined to become a single-node partition to provide external services, the recovery lock held by the target node is released and the target node is BANed.
7. A network monitoring device based on CTDB, characterized in that: The device comprises: An acquisition module, used for periodically acquiring node information of a target node based on CTDB; A determination module, configured to determine the private IP address and network port of the target node based on the node information, and determine the private network status corresponding to the private IP address and network port based on a shell command; A recovery module, used to determine whether to restore the network status based on the private network status, and record the network status result; The adjustment module is used to determine the node type of the target node and adjust the monitoring mode of the target node based on the node type, network status result and node status.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, wherein the computer-readable storage medium has instructions stored therein, and when the instructions are executed on a computer or a processor, the computer or the processor executes the steps of the method according to any one of claims 1 to 7.