A monitoring method, device and electronic equipment
By using packet algorithms to establish monitoring relationships between nodes in distributed network systems, the problem of breaking monitoring relationships when nodes join or leave is solved, automated management and efficient monitoring are realized, and suitable for complex distributed environments.
Patent Information
- Application Number
- CN202211707134.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-27
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2042-12-27
AI Technical Summary
In complex distributed systems, monitoring relationships between nodes are difficult to establish and maintain, resulting in a break in the monitoring relationship when the node joins or leaves, affecting the reliability and efficiency of the system.
By using a packet algorithm in a distributed network system, a relationship that is monitored by at least m nodes is established, ensuring the formation and maintenance of monitoring relationships between nodes, including the establishment of individual monitoring relationships and the establishment of closed monitoring groups, and using nodes The degree of applicability between them is sorted and grouped.
It realizes the automated management of monitoring relationships between nodes in distributed systems, reduces manual participation, improves the reliability and scalability of the system, and is suitable for various distributed resource monitoring environments, especially in scenarios where cluster scale is rapidly growing Resource monitoring and management efficiency.
Smart Images

Figure CN116170346B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a monitoring method, device and electronic equipment. Background Art
[0002] A distributed network system includes multiple nodes, and these nodes often have complex network connection relationships.
[0003] A distributed system consists of multiple nodes, such as computers. These nodes are geographically dispersed and can be distributed in a unit, a city, a country, or even the world. The functions of the entire system are implemented on each node, so the distributed system has the distribution of data processing. That is, several nodes in the system can cooperate with each other to complete a common task, or a program can be distributed on several nodes and run in parallel.
[0004] At present, with the development of technology, distributed systems are becoming more and more complex, and more and more functions can be realized, such as self-configuration, self-repair, self-optimization, self-protection and context awareness.
[0005] Among them, in a complex distributed system, a node can freely join the system and can also freely leave the system. In view of the scalability of the distributed system, it is no longer feasible for two nodes in the system to monitor each other. Summary of the invention
[0006] Embodiments of the present application provide a monitoring method, device, and electronic device to implement monitoring in a distributed network system.
[0007] In a first aspect, an embodiment of the present application provides a monitoring method, which is applied to a distributed network system, wherein the distributed network system includes a plurality of nodes; the method includes:
[0008] Establishing a monitoring relationship between the nodes in the distributed network system so that each node is monitored by at least m nodes, where m is an integer greater than or equal to 1 and less than Q, and Q represents the total number of nodes included in the distributed network system;
[0009] The operation process of the nodes in the distributed network system that have a monitoring relationship with the nodes is monitored.
[0010] In a second aspect, an embodiment of the present application provides a monitoring device, which is applied to a distributed network system, wherein the distributed network system includes a plurality of nodes; the device includes:
[0011] An establishment module, configured to establish a monitoring relationship between nodes in the distributed network system so that each node is monitored by at least m nodes, where m is an integer greater than or equal to 1 and less than Q, and Q represents the total number of nodes included in the distributed network system;
[0012] The monitoring module is used to monitor the operation process of the nodes having a monitoring relationship with the nodes in the distributed network system.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the above-mentioned monitoring method when executed by the processor.
[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned monitoring method are implemented.
[0015] The technical solution of the embodiment of the present application can establish a monitoring relationship between each node in the distributed network system, so that each node is monitored by at least m nodes, so that each node in the distributed network system can monitor the operation process of the node with which it has a monitoring relationship, m is an integer greater than or equal to 1 and less than Q, and Q represents the total number of nodes included in the distributed network system. It can be seen that in the embodiment of the present application, each node in the distributed network system is monitored by at least m nodes, so that after a node in the distributed network system leaves the system, other nodes can also monitor the nodes with which the node has a monitoring relationship; or, after a node joins the distributed network system, the monitoring method of the embodiment of the present application can also be used to establish a monitoring relationship of the distributed network system after the node is added. Therefore, the embodiment of the present application can realize monitoring in a distributed network system. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 is a flow chart of a monitoring processing method provided by an embodiment of the present application;
[0017] Figure 2 This is a schematic diagram of the individual monitoring relationship in the embodiment of the present application;
[0018] Figure 3 This is a schematic diagram of a closed monitoring group in an embodiment of the present application;
[0019] Figure 4 It is one of the schematic diagrams of merging two groups in the embodiment of the present application;
[0020] Figure 5This is the second schematic diagram of merging two groups in the embodiment of the present application;
[0021] Figure 6 This is a schematic diagram of merging and continuous splitting in an embodiment of the present application;
[0022] Figure 7 is a schematic diagram of a scenario in which a leader is converted to a non-leader in an embodiment of the present application;
[0023] Figure 8 is a schematic diagram of the transfer of non-leaders between groups in an embodiment of the present application;
[0024] Fig. 9 is a structural block diagram of a monitoring device provided in an embodiment of the present application;
[0025] Fig.10 It is a structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0027] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present invention. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0028] In various embodiments of the present invention, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0029] First, refer to Figure 1 , shows a flowchart of a monitoring method in an embodiment of the present application, the method may include the following steps 101 to 102:
[0030] Step 101: Establish a monitoring relationship between nodes in the distributed network system so that each node is monitored by at least m nodes.
[0031] Wherein, m is an integer greater than or equal to 1 and less than Q, and Q represents the total number of nodes included in the distributed network system.
[0032] In the embodiment of the present application, a grouping algorithm can be used to establish a monitoring relationship between each node in the distributed network system, so that each node is monitored by at least m nodes. Among them, the grouping algorithm is generally used in data structures, and in the embodiment of the present application, the grouping algorithm is applied to construct the monitoring relationship of the distributed network system, which is more conducive to the formation of the monitoring relationship.
[0033] Here, in the distributed network system, each node is monitored by at least m nodes. The specific implementation method may be: each node is monitored by m nodes (for example Figure 2 As shown, an independent monitoring relationship is formed, that is, an individual monitoring relationship); or, multiple nodes in a distributed network system form multiple groups, each group includes multiple nodes, and the nodes in a group monitor each other (for example Figure 3 As shown, a group monitoring relationship is formed, i.e., a closed monitoring group).
[0034] Step 102: Monitor the operation process of the nodes in the distributed network system that have a monitoring relationship with the nodes.
[0035] In an embodiment of the present application, the monitoring relationship can be used to monitor whether a fault occurs during the operation of each node. Wherein, a fault detection process is set in each node, and the fault detection process is used to monitor whether a node with a monitoring relationship with the node fails. For example, if node A is used to monitor node B, the fault detection process of node B can return fault information to node A.
[0036] It can be seen from the above steps 101 to 102 that the embodiment of the present application can establish a monitoring relationship between each node in the distributed network system, so that each node is monitored by at least m nodes, so that each node in the distributed network system can monitor the operation process of the node with which it has a monitoring relationship, m is an integer greater than or equal to 1 and less than Q, and Q represents the total number of nodes included in the distributed network system. It can be seen that in the embodiment of the present application, each node in the distributed network system is monitored by at least m nodes, so that after a node in the distributed network system leaves the system, other nodes can also monitor the nodes with which the node has a monitoring relationship; or, after a node joins the distributed network system, the monitoring method of the embodiment of the present application can also be used to establish a monitoring relationship of the distributed network system after the node is added. Therefore, the embodiment of the present application can realize monitoring in a distributed network system.
[0037] Optionally, the above step 101 “establishing a monitoring relationship between nodes in the distributed network system so that each node is monitored by at least m nodes” includes:
[0038] The following process is performed for each node in the distributed network system to obtain the monitoring relationship between the nodes in the distributed network system:
[0039] Selecting m monitoring nodes of the first node from the first other nodes, and establishing a monitoring relationship between the first node and the monitoring nodes;
[0040] The first node is one of the nodes included in the distributed network system, and the first other nodes include nodes other than the first node among the nodes included in the distributed network system.
[0041] For example, if the distributed network system includes 16 nodes from A1 to A16, and each node is required to be monitored by 4 nodes, then for node A1, 4 monitoring nodes can be selected from A2 to A16; then, for node A2, 4 monitoring nodes can be selected from A1, A3 to A16; ... until 4 monitoring nodes are selected from A1 to A15 for node A16. Finally, the monitoring relationship formed between the nodes in the distributed network system, such as Figure 2 shown.
[0042] Optionally, the step of selecting m monitoring nodes of the first node from the first other nodes includes the following steps H1 to H3:
[0043] Step H1: Acquire parameter information of the first node and parameter information of each of the first other nodes;
[0044] Step H2: determining a first degree of applicability between the first node and each of the first other nodes according to the parameter information of the first node and the parameter information of the first other nodes;
[0045] Step H3: Sort the first other nodes in descending order of the first applicability degree, and select the top m nodes as monitoring nodes of the first node.
[0046] Here, the first applicability degree is used to indicate the applicability or matching degree between the first node and each first other node. The larger the value of the first applicability degree is, the greater the matching degree between the first node and the first other node is.
[0047] Optionally, the parameter information includes: delay information between nodes, reliability information of nodes, and load conditions of nodes. That is, the first degree of applicability between the first other node and the first node can be determined based on the delay information between the first other node and the first node, the reliability information of the first other node, and the load conditions of the first other node.
[0048] Optionally, the first degree of applicability is: an average value of a degree of hardware device matching between nodes and a network connection performance index between nodes.
[0049] From this, it can be seen that the hardware matching degree between the first other node and the first node and the network connection performance index between the first other node and the first node can be determined based on the delay information between the first other node and the first node, the reliability information of the first other node, and the load condition of the first other node, and then the average of the two is calculated to obtain the first applicability degree between the first other node and the first node.
[0050] For example, the function for calculating the degree of suitability can be expressed as s(u, v), then s(u, v) = (h(u, v) + y(u, v)) / 2, where s(u, v) represents the degree of suitability between node u and node v, h(u, v) returns a value indicating the degree of hardware device matching between node u and node v, and y(u, v) returns a value indicating the performance of the network connection between node u and node v.
[0051] Among them, in the case of a node outage, another node with similar hardware equipment is likely to be able to inherit the task of the failed node, then this scenario will be meaningful. Therefore, the setting of the applicability function will affect the establishment of the monitoring relationship.
[0052] In addition, the above steps H1 to H3 may be performed by the first node, and the implementation method of "obtaining parameter information of each of the first other nodes" in step H1 may be:
[0053] Sending a first request to each first other node through the first node, wherein the first request is used to indicate parameter information of the requesting node;
[0054] The parameter information of the other node sent by the first other node is received through the first node.
[0055] For example, a distributed network system includes 16 nodes A1 to A16, and each node is required to be monitored by 4 nodes. When selecting 4 monitoring nodes from A2 to A16 for node A1, node A1 can send the above-mentioned first request to nodes A2 to A16 respectively, and then receive the respective parameter information returned by nodes A2 to A16. In this way, node A1 can calculate the first degree of applicability between itself and each node in A2 to A16 respectively, and then sort nodes A2 to A16 in descending order according to the first degree of applicability, so as to select the top 4 nodes as monitoring nodes of node A1.
[0056] Optionally, the above step 101 “establishing a monitoring relationship between nodes in the distributed network system so that each node is monitored by at least m nodes” includes the following steps L1 to L2:
[0057] Step L1: determining a plurality of groups based on the nodes included in the distributed network system, wherein each of the groups includes at least m+1 nodes;
[0058] Step L2: Establish a monitoring relationship between every two nodes in the same group.
[0059] From this, we can see that each node in a distributed network system can be divided into multiple groups, and then the nodes in the same group monitor each other.
[0060] The monitoring relationship between the various groups can also be used for many other purposes besides monitoring, such as collaborative fault recovery, that is, for some existing groups, an automatic planning engine can be used to plan together to restore the system.
[0061] Optionally, the above step L1 “determining a plurality of groups based on the nodes included in the distributed network system” includes the following steps L1-1 to L1-4:
[0062] Step L1-1: selecting a master node and a slave node from the nodes included in the distributed network system according to a preset ratio, wherein the preset ratio is a ratio of the number of master nodes to the total number of nodes included in the distributed network system, and among the nodes included in the distributed network system, nodes other than the master node are slave nodes;
[0063] Step L1-2: assigning a master node to a group to obtain multiple groups;
[0064] Step L1-3: assigning the slave nodes to the multiple groups;
[0065] Step L1-4: Adjust the number of nodes in the multiple groups so that each of the groups includes at least m+1 nodes.
[0066] Among them, for a distributed network system composed of n nodes, if each node requires at least m monitoring nodes, the number of master nodes can be n / m+1. For example: in a distributed network system with 12 nodes, each node requires at least 2 monitoring nodes, that is, each group includes at least 3 nodes, that is, the best case is 4 groups of size 3. Therefore, 12 / (2+1)=4 master nodes are required. Therefore, the probability of each node being a master node is 1 / m+1. However, since too many master nodes are worse than too few master nodes, the probability of a node becoming a master node can be adjusted to 0.8 / m+1. It can be seen that the above preset ratio can be determined in advance based on the value of m.
[0067] In addition, if the value obtained by summing up the preset ratio * the actual number of nodes included in the distributed network system is not an integer, it can be rounded off. For example, when the preset ratio = 0.8 / m+1 = 0.8 / 3, 0.8 / 3*12 = 3.2, then the number of master nodes in the distributed network system can be 3.
[0068] In addition, in an embodiment of the present application, after the nodes in the distributed network system are divided into master nodes and slave nodes, each master node is first assigned to a group, and then the slave nodes are assigned to each group; then the number of nodes between each group is adjusted so that the minimum number of nodes in each group is m+1. In this way, each node in the distributed network system can be monitored by at least m+1 nodes.
[0069] Optionally, the above step L1-3 “the assigning of the slave nodes to the multiple groups” includes the following steps L1-3-1 to L1-3-3:
[0070] Step L1-3-1: Obtain parameter information of the i-th master node and parameter information of the slave nodes to be assigned, wherein the slave nodes to be assigned include slave nodes that are not assigned to the group;
[0071] Step L1-3-2: determining a second degree of applicability between the i-th master node and each of the slave nodes to be assigned according to the parameter information of the i-th master node and the parameter information of the slave nodes to be assigned;
[0072] Step L1-3-3: According to the second applicability degree, m and the number of the slave nodes to be allocated, selecting a slave node to be allocated to the group where the i-th master node is located from the nodes to be allocated;
[0073] Wherein, i is an integer from 1 to N, and P represents the number of the master nodes.
[0074] For example, after the above step L1-1, the master nodes obtained include two, A1 and A2, and the slave nodes include eight, A3 to A10. Then, A1 and A2 are respectively assigned to group B1 and group B2. If m=4, firstly, nodes assigned to group B1 are selected from A3 to A10, for example, A3 to A6 are selected; then, nodes assigned to group B2 are selected from A7 to A10, for example, A7 to A10 are selected. In this way, group B1 includes master node A1 and slave nodes A3 to A6, and group B2 includes master node A2 and slave nodes A7 to A10.
[0075] The second degree of suitability is used to indicate the degree of suitability or matching between the ith master node and each slave node to be assigned. The greater the value of the second degree of suitability, the greater the matching degree between the ith master node and the slave node to be assigned.
[0076] Optionally, the parameter information includes: delay information between nodes, reliability information of nodes, and load conditions of nodes. That is, the second degree of suitability between the slave node to be allocated and the i-th master node can be determined based on the delay information between the slave node to be allocated and the i-th master node, the reliability information of the slave node to be allocated, and the load conditions of the slave node to be allocated.
[0077] Optionally, the second degree of applicability is: an average value of a degree of hardware device matching between nodes and a network connection performance index between nodes.
[0078] From this, it can be seen that the hardware matching degree between the slave node to be assigned and the i-th master node, as well as the network connection performance index between the slave node to be assigned and the i-th master node can be determined based on the delay information between the slave node to be assigned and the i-th master node, the reliability information of the slave node to be assigned, and the load condition of the slave node to be assigned, and then the average of the two is calculated to obtain the second suitability degree between the slave node to be assigned and the i-th master node.
[0079] Among them, the above steps L1-3-1 to L1-3-3 can be executed by the i-th master node, and the implementation method of "obtaining parameter information of the slave node to be allocated" in step L1-3-1 can be:
[0080] Sending a first request to each slave node to be allocated through the i-th master node, wherein the first request is used to indicate parameter information of the requesting node;
[0081] The parameter information of the slave node to be assigned sent by the slave node to be assigned is received through the i-th master node.
[0082] In addition, the selecting, from the nodes to be allocated, the slave nodes allocated to the group where the i-th master node is located according to the second applicability degree, m, and the number of the slave nodes to be allocated, may include:
[0083] When the number of slave nodes to be allocated is greater than m, the slave nodes to be allocated are sorted in descending order of the second applicability, and the first m slave nodes to be allocated are allocated to the group where the i-th master node is located;
[0084] When the number of slave nodes to be allocated is less than or equal to m, all the slave nodes to be allocated are allocated to the group where the i-th master node is located.
[0085] In addition, among the multiple groups obtained after the above step L1-3, the situations of the nodes included in each group may be different, for example, the number of nodes in some groups is less than m+1, while the number of nodes in some groups is greater than or equal to m+1; or, some groups may include a master node and at least one slave node, and some groups may include only one master node, and the specific method of adjusting the number of nodes in these groups may be the following method 1 or method 2:
[0086] Method 1: Optionally, the above step L1-4 "adjusting the number of nodes in the multiple groups so that each of the groups includes at least m+1 nodes" includes the following steps L1-4-1 to L1-4-5:
[0087] Step L1-4-1: Obtain a first number of nodes in each second other group, wherein the second other group includes groups other than the first group in the plurality of groups, and the first group is one of the groups having a number of nodes less than m+1;
[0088] Step L1-4-2: Combine the first group with the first target group with the smallest number to obtain a combined group;
[0089] Step L1-4-3: when the number of nodes in the merged group is greater than or equal to 2·(m+1), split the merged group into two groups including at least m+1 nodes, wherein each of the two groups obtained by splitting includes a master node;
[0090] Step L1-4-4: when the number of nodes in the merged group is less than 2·(m+1), converting the master node in the merged group that originally belonged to the first group into a slave node;
[0091] Step L1-4-5: Stop merging the groups until each of the groups includes at least m+1 nodes.
[0092] It can be seen that in the embodiment of the present application, for the multiple groups obtained after executing the above step L1-3, the group with the number of nodes less than m+1 can be first screened out, and then the following process is performed for the first group with the number of nodes less than m+1:
[0093] Obtain the number of nodes in each of the other groups except the first group (including the groups except the first group in the groups with the number of nodes less than m+1, and the groups with the number of nodes greater than or equal to m+1), so as to select the group with the smallest number of nodes from these groups, and then merge the first group into the selected group to obtain a merged group; (it can be seen that the group merged with the first group here may be a group with the number of nodes less than m+1, or a group with the number of nodes greater than or equal to m+1);
[0094] If the number of nodes in the merged group is greater than or equal to 2·(m+1), the merged group needs to be split into two groups, and each group includes a master node and at least m slave nodes; if the number of nodes in the merged group is less than 2·(m+1), the master node originally belonging to the first group in the merged group is converted into a slave node;
[0095] At this point, the merging process of the first group is completed;
[0096] Thereafter, the above process may be repeated for a group in which the number of nodes in the current group is less than m+1, until the number of nodes in all groups is greater than or equal to m+1.
[0097] It can be seen that in the first approach, by merging groups, the number in each group can be adjusted to be greater than or equal to m+1, so that each node in each group has at least m monitoring nodes.
[0098] Wherein, the above steps L1-4-1 to L1-4-4 may be executed by the master node in the first group, and the implementation method of "obtaining the first number of nodes in each second other group" in step L1-4-1 may be:
[0099] Sending a second request to the master node of the second other group through the master node in the first group, wherein the second request is used to request the number of nodes in the group,
[0100] The target number of nodes in the first other groups is received by the master node in the first group, which is sent by the master node of each of the second other groups.
[0101] In addition, after the above steps L1-4-2 to L1-4-4 are executed by the master node in the first group, the master node in the first group can notify the slave nodes in the first group and each node in the first target group, which group they are in.
[0102] Mode 2: Optionally, adjusting the number of nodes in the multiple groups so that each of the groups includes at least m+1 nodes, including:
[0103] Converting a master node in each second group into a slave node to obtain a target slave node, wherein the second group is a group including only one master node;
[0104] In the third group, respectively select a second target group to be joined for each target slave node, and add the target slave node to its corresponding second target group, wherein the third group is a group including a master node and at least one slave node;
[0105] The nodes between the third groups are balanced so that each of the third groups includes at least m+1 nodes.
[0106] It can be seen that in an embodiment of the present application, for the multiple groups obtained after executing the above steps L1-3, the second group including only one master node and the third group including one master node and at least one slave node can be screened out first, and then, all the master nodes in the second group are converted into slave nodes, and the second group no longer exists; secondly, the converted slave nodes are assigned to the third group, and then the nodes between the third groups are balanced so that the number of nodes in each third group is greater than or equal to m+1.
[0107] Optionally, in the third group, selecting, for each of the target slave nodes, a second target group to be joined includes the following steps R1 to R2:
[0108] Step R1: obtaining a second number of nodes in each of the third groups;
[0109] Step R2: selecting the third group with the smallest second number as the second target group that the kth target slave node needs to join;
[0110] Wherein, k is an integer from 1 to K, and K represents the number of the target slave nodes.
[0111] For example, if the target slave nodes obtained by the conversion are slave nodes C1 and C2, and the third group includes group V1, group V2 and group V3, then the group with the smallest number of nodes among the current group V1, group V2 and group V3 is selected, and then the slave node C1 is added to the group, and the number of each third group is updated; then, after the number of nodes is updated, the group with the smallest number of nodes among group V1, group V2 and group V3 is selected, and then the slave node C2 is added to the group.
[0112] It can be seen from this that each target slave node can be added to the third group with the smallest number of current nodes.
[0113] The above steps R1 to R2 may be performed by the kth target slave node, so the above step R1 may specifically include:
[0114] Sending a second request to the third group through the kth target slave node, wherein the second request is used to request the number of nodes in the group;
[0115] The second number of nodes in the third group sent by each of the third groups is received through the k-th target slave node.
[0116] In addition, after the kth target slave node executes the above step R2, it can notify each node in the above second target group that it has joined the second target group.
[0117] Optionally, balancing the nodes between the third groups so that each of the third groups includes at least m+1 nodes includes the following steps W1 to W2:
[0118] Step W1: when there is a group with more than m+1 nodes in the third group, at least some of the nodes in the group with the largest number of nodes in the group with more than m+1 nodes are transferred to the group with the smallest number of nodes in the third group;
[0119] Step W2: If there is no group with a node number greater than m+1 in the third group, sort the groups with a node number less than m+1 in order of the number of nodes from small to large, select the top two groups, and convert the master node in one of the selected groups into a slave node, and transfer the nodes in the group to another selected group.
[0120] It can be seen that when balancing the nodes between the third groups, if there are groups with a number of nodes greater than m+1, part of the group with the largest number of nodes in these groups can be transferred from the node to the group with the smallest number of nodes in the current group, and then the number of nodes in each group is updated once; if there is no group with a number of nodes greater than m+1, the group with the smallest number of nodes and the group with the second smallest number of nodes (that is, the top two groups in terms of the number of nodes in descending order) can be selected, so as to convert the master node of one of the two groups into a slave node, and then transfer all the nodes of the group to another node, and update the number of nodes in each group once;
[0121] Then, the aforementioned process is repeated for the third group after the number is updated until the difference between the number of the group with the largest number of nodes and the number of the group with the smallest number of nodes in the obtained groups is less than a preset threshold, and the handover of nodes between the third groups is stopped.
[0122] In this way, by setting a reasonable preset threshold, after stopping the handover of nodes between the third groups, the number of nodes in each third group is greater than or equal to m+1, and the number of nodes is not much different from each other.
[0123] It is understandable that step W1 can be performed by the master node in the third group.
[0124] In summary, the specific implementation of the monitoring method of the embodiment of the present application can be described as follows:
[0125] For a monitoring relationship network, it can be represented as a triple (N, M, s) relationship, where N represents the set of nodes (or processes) in the network. represents the monitoring relationship, and s represents the function mapping from N×N (i.e., the monitoring relationship) to a real value in [0,1].
[0126] For each tuple (u, v), ∈ N×N, s(u, v) represents the degree of suitability of node u to monitor node v. This degree of suitability may depend on different aspects, such as the latency of the connection, the reliability of the node, its load, etc. If node u cannot monitor node v, then s(u, v) outputs 0.
[0127] The monitoring relationship defines which monitoring relationships are established between nodes, that is, (u, v)∈M means that node u currently monitors node v. (u, v)∈M can also be represented by u→v. Among them, the relationship M is not reflective, that is, the node is not allowed to monitor itself. *→v means all nodes that monitor node v, that is, *→v:={u∈N|u→v}. Similarly, u*→ means all nodes that node u is monitoring, that is, u*→:={v∈N|u→v}.
[0128] In the embodiment of the present application, a grouping algorithm is used to establish a monitoring relationship of a distributed network system, thereby forming a monitoring network. That is, the task of the grouping algorithm is basically: given a monitoring network Net = (N, M, s) and a positive integer m < |N|, establish a monitoring relationship so that each node of the network is monitored by at least m nodes. In this work, this problem has two characteristics, namely, decentralized monitoring relationships and closed monitoring groups. In the former, the monitoring relationship can be set separately for each node (for example, Figure 2 As shown), while in the latter, nodes form groups with mutual monitoring relationships (e.g. Figure 3 shown).
[0129] The number of monitoring nodes m for each node can be defined by the user. Generally, more monitoring nodes provide higher reliability but also lead to higher overhead.
[0130] In addition, the grouping algorithm should maximize the degree of suitability between nodes to establish appropriate monitoring relationships. That is, it can be expressed by the formula Maximize the degree of applicability between nodes, that is, when establishing a monitoring relationship, the sum of the degrees of applicability between nodes in the system can be considered and maximized as much as possible, so as to establish a more appropriate monitoring relationship.
[0131] In addition, for the above-mentioned decentralized monitoring relationship (also called individual monitoring relationship), in the monitoring network, there are |*→v|=m holds, that is, any node v in the system is monitored by m nodes, and the degree of applicability between the mutually monitored nodes meets certain requirements.
[0132] Unlike individual monitoring relationships, a closed monitoring group includes a set of nodes whose members monitor each other. Among them, the degree of applicability between nodes in a closed monitoring group must also meet certain requirements, and the monitoring relationship between nodes should be symmetric and transitive to produce a closed monitoring group. On the other hand, compared with individual monitoring relationships, the problem of finding a closed monitoring group is more relaxed, because it is not always possible to find a group of size m+1, resulting in m monitoring nodes for each node in the group. For this case, larger closed monitoring groups are also allowed. That is, relative to individual monitoring relationships, a closed monitoring group is a "closed monitoring group" that solves the above problem. Holding |*→v|=m" is relaxed to " Holding |*→v|≥m", this problem belongs to a soft constraint similar to the maximum.
[0133] Moreover, for a closed monitoring group, each group has a node declared as a leader (i.e., the master node), and the other nodes are non-leaders (i.e., slave nodes). The master node acts as a coordinator or contact node. Whether the division of closed monitoring groups in a monitoring network is more sufficient depends on the environment and monitoring tasks.
[0134] The embodiment of the present application provides three grouping algorithms to establish a monitoring relationship between nodes in a distributed network system, wherein one algorithm is to establish the above-mentioned individual monitoring relationship, and the other two algorithms are to establish the above-mentioned closed monitoring group.
[0135] Among them, it is not assumed that all nodes have parameter information about all other nodes, that is, a node in a distributed network system does not know whether other nodes are suitable for monitoring it. Until the node obtains the parameter information of other nodes, the degree of suitability between the node and other nodes can be calculated. It should be noted that the degree of suitability between nodes may also change over time. Therefore, each node stores parameter information about some other nodes that allow the calculation of the degree of suitability and updates it regularly. Here, the parameter information used to calculate the degree of suitability between nodes may include: delay information between nodes, reliability information of nodes, and load conditions of nodes.
[0136] In addition, the function for calculating the degree of suitability can be expressed as s(u, v), then s(u, v) = (h(u, v) + y(u, v)) / 2, where s(u, v) represents the degree of suitability between node u and node v, h(u, v) returns a value indicating the degree of hardware device matching between node u and node v, and y(u, v) returns a value indicating the performance of the network connection between node u and node v.
[0137] The following is a detailed introduction to three grouping algorithms for establishing monitoring relationships provided in the embodiments of the present application:
[0138] 1. Individual algorithm (i.e., grouping algorithm for establishing individual monitoring relationships)
[0139] For example, a distributed network system includes 16 nodes A1 to A16, and each node is required to be monitored by m = 4 nodes. Then, the 4 monitoring nodes of node A1 are selected according to the following process:
[0140] When selecting 4 monitoring nodes from A2 to A16, node A1 can send a first request to nodes A2 to A16 respectively to request the parameter information of the nodes, and then receive the respective parameter information returned by nodes A2 to A16. In this way, node A1 can calculate the degree of applicability between itself and each node in A2 to A16 respectively, and then sort nodes A2 to A16 in descending order of the degree of applicability, so as to select the top 4 nodes as monitoring nodes of node A1;
[0141] Thereafter, the above process is repeated for each node from A2 to A16 until the monitoring node of node A16 is found.
[0142] 2. Merging Algorithm (i.e., a grouping algorithm for building a closed monitoring group)
[0143] For example, a distributed network system includes 16 nodes A1 to A16, and each node is required to be monitored by at least m = 4 nodes. Then, these nodes are divided into multiple groups according to the following process, and the mutual monitoring relationship between the nodes in each group is established:
[0144] First, according to the preset probability, the 16 nodes from A1 to A16 are converted into leaders (i.e., master nodes) and non-leaders (i.e., slave nodes), and different leaders are assigned to different groups;
[0145] Then, traverse each leader, and the i-th leader sends a first request to the non-leaders that are not currently in the group, requesting the parameter information of the node. These non-leaders reply with their own parameter information, so that the i-th leader calculates the degree of suitability between itself and each non-leader, and then selects a corresponding number of non-leaders to join the i-th leader's group according to m and the number of non-leaders that are not currently in the group; until the traversal is completed, multiple groups are obtained;
[0146] Next, perform group merging. Assume that after the above process, three groups B1, B2, and B3 are obtained. The number of nodes in group B1 and group B2 is less than m+1, and the number of nodes in group B3 is greater than m+1. Then, select the group that can be merged with group B1 according to the following process:
[0147] The leader in group B1 can send a second request to the leaders in groups B2 and B3 to obtain the number of nodes in groups B2 and B3. Then the leader in group B1 selects the group with the smallest number to merge and obtain a merged group. For example, group B1 is merged with group B2 to obtain merged group B4. It is necessary to determine whether the number of nodes in the merged group B4 is greater than or equal to 2·(m+1). If so, the merged group is split into two groups, and each group includes a leader and at least m non-leaders. If not, the leader of group B1 in the merged group is converted to a non-leader.
[0148] Then, for another group in the current group whose number of nodes is less than m+1, the above process is repeated to select a group that can be merged with it, until the number of nodes in all groups is greater than or equal to m+1.
[0149] It can be seen that in this algorithm, the leader of a group less than m+1 requests the leader of another suitable group to merge their groups. If this request is accepted, the two groups are merged, and the requesting group leader needs to give up its leader role. The requested leader is the leader of the newly formed group. After such a merge, the leader of the new group will notify all nodes in its group. Among them, the node that loses the leader role plays a completely passive role in the further grouping process and is no longer allowed to accept merge requests from other leaders.
[0150] Moreover, the maximum size of the merged group generated by the inter-group merge is 2·(m+1)-1. If there is a merged group with a size of 2·(m+1), it can be divided into two groups with a size of m+1. It can be seen that after the inter-group merge, the size of the group is always between m+1 and 2·(m+1)-1.
[0151] For example, if m=2, that is, a group with a minimum size of 3 is formed, then Figure 4 In the example, two groups have been formed. One group includes nodes 1 and 2, and node 1 is the leader. The other group includes node 3, and node 3 is the leader. Node 3 can request node 1's group to merge. After the merger, a new group includes exactly 3 members, and node 1 is the leader of the group.
[0152] Among them, the leader never rejects a merge request. For example Figure 5As shown in the figure, two groups have been formed, one group includes nodes 1 and 2, and node 1 is the leader, and the other group includes nodes 3 and 4, and node 3 is the leader. Node 3 can request the group of node 1 to merge. After the merger, a new group includes 4 members. It can be seen that after the two groups are merged, it is very likely that a group with more than m+1 members will appear.
[0153] In addition, for example Figure 6 As shown in the figure, two groups have been formed, one group includes nodes 1 to 4, and node 1 is the leader, and the other group includes nodes 5 and 6, and node 5 is the leader. Node 5 can request the group of node 1 to be merged. After the merger, a new group includes 6 members, and the new group can be split into two groups. For example, one of the split groups includes nodes 1 to 3, and node 1 is the leader, and the other group includes nodes 4 to 6, and node 5 is the leader.
[0154] 3. Classification and grouping algorithm (another grouping algorithm for building closed monitoring groups)
[0155] For example, a distributed network system includes 16 nodes A1 to A16, and each node is required to be monitored by at least m = 4 nodes. Then, these nodes are divided into multiple groups according to the following process, and the mutual monitoring relationship between the nodes in each group is established:
[0156] First, according to the preset probability, the 16 nodes from A1 to A16 are converted into leaders (i.e., master nodes) and non-leaders (i.e., slave nodes), and different leaders are assigned to different groups;
[0157] Then, it traverses each leader, and the i-th leader sends a request message to the non-leaders that are not currently in the group. These non-leaders reply with their own parameter information, so that the i-th leader calculates the degree of suitability between itself and each non-leader, and then selects a corresponding number of non-leaders to join the i-th leader's group according to m and the number of non-leaders that are not currently in the group; until the traversal is completed, multiple groups are obtained;
[0158] Next, for each group that contains only one leader, perform the following process:
[0159] The leader is converted to a non-leader. The leader requests the number of nodes currently included in the group of each leader from each leader. Then, the group with the least number of nodes is selected, and the non-leader is added to this group, and the number of nodes in this group is updated.
[0160] Until all non-leaders converted from leaders are added to the corresponding groups;
[0161] Again, the leaders of each current group interact with the number of nodes in their respective groups to determine whether there is a group with more than m+1 nodes. If so, it is further determined whether it is in the group with the largest number of nodes. If so, at least some of the non-leaders in its group are transferred to the group with the smallest number of nodes. If there is no group with more than m+1 nodes, it is determined whether it is in the group with the smallest or second smallest number of nodes. If it is in the group with the smallest number of nodes, all nodes in its group are transferred to the group with the second smallest number of nodes, and the leader is converted to a non-leader; until the difference in the number of nodes between the group with the largest number of nodes and the group with the smallest number of nodes is less than the preset threshold.
[0162] It can be seen that in this algorithm, if the random assignment of nodes cannot guarantee the effective distribution of leaders and non-leaders. Therefore, if a leader cannot find a non-leader to connect to, it can be converted into a non-leader and join other groups; if there are too many non-leaders in the group where a leader is located, some non-leaders can be transferred to other groups. If this also fails, the leader will be converted into a non-leader and join other groups with fewer non-leaders in the same group as the leader.
[0163] For example Figure 7 The network shown in contains too many leaders. In this case, if m=3, it means that a group needs to include at least 4 nodes. Here, the group with the largest number of nodes (i.e., the group including nodes 1 to 4) includes 4 nodes and cannot provide non-leaders for other groups with fewer nodes. Therefore, node 7 can be converted to a non-leader, and nodes 7 and 8 are transferred to the group where nodes 5 and 6 are located.
[0164] For example Figure 8As shown in , if m=3, this means that a group needs to include at least 4 nodes. Here, the group with the largest number of nodes (i.e., the group including nodes 1 to 5) includes 5 nodes, then the group can transfer one of the non-leaders to a group with fewer nodes (e.g., the group including nodes 6 to 8).
[0165] From the above, it can be seen that the monitoring method of the embodiment of the present application has the following specific advantages:
[0166] 1. Creatively established three grouping algorithms for distributed system node management, so as to group and manage distributed global resources based on the grouping algorithm, optimize the complexity of monitoring and management of distributed systems, and solve the problem of linear growth of distributed resource management with cluster scale in existing methods.
[0167] 2. The entire monitoring process does not require too much human involvement and can be automatically implemented, thus reducing costs
[0168] 3. Applicable to distributed environments, with good scalability, the entire resource management and monitoring process is completely transparent to resource users;
[0169] 4. It realizes the self-monitoring management of distributed systems without the intervention of third-party system resources.
[0170] That is, the monitoring method of the embodiment of the present application is applicable to various distributed resource monitoring and management environments. It is particularly applicable to resource monitoring and management scenarios where the cluster scale grows too fast. The monitoring method of the embodiment of the present application can optimize the efficiency of cluster resource monitoring and management, improve the real-time sensitivity of resource monitoring and management, and can promptly discover various resource monitoring problems of distributed clusters.
[0171] The present application also provides a monitoring device, which is applied to a distributed network system, wherein the distributed network system includes a plurality of nodes; Fig. 9 As shown, the device comprises:
[0172] Establishing module 901, used to establish a monitoring relationship between each node in the distributed network system, so that each node is monitored by at least m nodes, where m is an integer greater than or equal to 1 and less than Q, and Q represents the total number of nodes included in the distributed network system;
[0173] The monitoring module 902 is used to monitor the operation process of the nodes having a monitoring relationship with the nodes in the distributed network system.
[0174] Optionally, the establishing module 902 includes:
[0175] The first establishment submodule is used to perform the following process for each node in the distributed network system to obtain the monitoring relationship between the nodes in the distributed network system:
[0176] Selecting m monitoring nodes of the first node from the first other nodes, and establishing a monitoring relationship between the first node and the monitoring nodes;
[0177] The first node is one of the nodes included in the distributed network system, and the first other nodes include nodes other than the first node among the nodes included in the distributed network system.
[0178] Optionally, the first establishing submodule selects m monitoring nodes of the first node from the first other nodes, specifically for:
[0179] Acquire parameter information of the first node and parameter information of each of the first other nodes;
[0180] determining, according to the parameter information of the first node and the parameter information of the first other nodes, a first degree of applicability between the first node and each of the first other nodes;
[0181] The first other nodes are sorted in descending order of the first applicability degree, and the top m nodes are selected as monitoring nodes of the first node.
[0182] Optionally, the establishing module 901 includes:
[0183] A grouping submodule, configured to determine a plurality of groups based on the nodes included in the distributed network system, wherein each of the groups includes at least m+1 nodes;
[0184] The second establishing submodule is used to establish a monitoring relationship between every two nodes in the same group.
[0185] Optionally, the grouping submodule includes:
[0186] A node division unit, configured to select a master node and a slave node from the nodes included in the distributed network system according to a preset ratio, wherein the preset ratio is a ratio of the number of master nodes to the total number of nodes included in the distributed network system, and among the nodes included in the distributed network system, nodes other than the master node are the slave nodes;
[0187] A first allocation unit, configured to allocate a master node to a group to obtain a plurality of groups;
[0188] A second allocating unit, configured to allocate the slave nodes to the plurality of groups;
[0189] An adjusting unit is used to adjust the number of nodes in the plurality of groups so that each of the groups includes at least m+1 nodes.
[0190] Optionally, the second allocation unit is specifically used to:
[0191] Obtaining parameter information of the i-th master node and parameter information of the slave nodes to be assigned, wherein the slave nodes to be assigned include slave nodes that are not assigned to the group;
[0192] Determining a second degree of applicability between the i-th master node and each of the slave nodes to be assigned according to the parameter information of the i-th master node and the parameter information of the slave nodes to be assigned;
[0193] According to the second applicability degree, m and the number of the slave nodes to be allocated, selecting a slave node allocated to the group where the i-th master node is located from the nodes to be allocated;
[0194] Wherein, i is an integer from 1 to N, and P represents the number of the master nodes.
[0195] Optionally, the adjustment unit is specifically used for:
[0196] Obtaining a first number of nodes in each second other group, wherein the second other group includes groups other than the first group in the plurality of groups, and the first group is one of the groups having a number of nodes less than m+1;
[0197] Combine the first group with the first target group with the smallest number to obtain a merged group;
[0198] When the number of nodes in the merged group is greater than or equal to 2·(m+1), split the merged group into two groups including at least m+1 nodes, wherein each of the two groups obtained by splitting includes a master node;
[0199] When the number of nodes in the merged group is less than 2·(m+1), converting the master node in the merged group that originally belongs to the first group into a slave node;
[0200] The merging of the groups is stopped until each of the groups includes at least m+1 nodes.
[0201] Optionally, the adjustment unit is specifically used for:
[0202] Adjusting the number of nodes in the plurality of groups so that each of the groups includes at least m+1 nodes, including:
[0203] Converting a master node in each second group into a slave node to obtain a target slave node, wherein the second group is a group including only one master node;
[0204] In the third group, respectively select a second target group to be joined for each target slave node, and add the target slave node to its corresponding second target group, wherein the third group is a group including a master node and at least one slave node;
[0205] The nodes between the third groups are balanced so that each of the third groups includes at least m+1 nodes.
[0206] Optionally, the adjusting unit selects, in the third group, for each of the target slave nodes, a second target group to be added, specifically for:
[0207] Obtaining a second number of nodes in each of the third groups;
[0208] Selecting the third group with the smallest second number as the second target group that the kth target slave node needs to join;
[0209] Wherein, k is an integer from 1 to K, and K represents the number of the target slave nodes.
[0210] Optionally, the adjusting unit balances the nodes between the third groups so that each of the third groups includes at least m+1 nodes, specifically for:
[0211] In the case that there is a group with a number of nodes greater than m+1 in the third group, at least some of the nodes in the group with the largest number of nodes in the group with a number of nodes greater than m+1 are transferred to the group with the smallest number of nodes in the third group;
[0212] In the case that there is no group with a node number greater than m+1 in the third group, the groups with a node number less than m+1 are sorted in ascending order of the number of nodes, the top two groups are selected, and the master node in one of the selected groups is converted into a slave node, and the nodes in the group are transferred to another selected group.
[0213] Optionally, the parameter information includes: delay information between nodes, reliability information of nodes, and load conditions of nodes.
[0214] Optionally, the first degree of suitability or the second degree of suitability is: an average value of a degree of hardware device matching between nodes and a network connection performance index between nodes.
[0215] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0216] On the other hand, an embodiment of the present application further provides an electronic device, comprising a memory, a processor, a bus, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the above-mentioned monitoring method when executing the program.
[0217] For example, Fig.10 A schematic diagram of the physical structure of an electronic device is shown.
[0218] like Fig.10 As shown, the electronic device may include: a processor 1010, a communication interface 1020, a memory 1030 and a communication bus 1040, wherein the processor 1010, the communication interface 1020 and the memory 1030 communicate with each other through the communication bus 1040. The processor 1010 may call the logic instructions in the memory 1030, and the processor 1010 is used to execute the steps in the above-mentioned monitoring method.
[0219] In addition, the logic instructions in the above-mentioned memory 1030 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0220] On the other hand, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the monitoring method provided in the above embodiments.
[0221] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0222] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0223] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A monitoring method, characterized in that: Applied to a distributed network system, the distributed network system includes a plurality of nodes; the method includes: Establishing a monitoring relationship between the nodes in the distributed network system so that each node is monitored by at least m nodes, where m is an integer greater than or equal to 1 and less than Q, and Q represents the total number of nodes included in the distributed network system; Monitoring the operation of nodes in the distributed network system through the nodes in the distributed network system; The step of establishing a monitoring relationship between nodes in the distributed network system so that each node is monitored by at least m nodes includes: Based on the nodes included in the distributed network system, determine a plurality of groups, wherein each of the groups includes at least m+1 nodes; Establish a monitoring relationship between every two nodes in the same group; The determining of a plurality of groups based on the nodes included in the distributed network system comprises: Selecting a master node and a slave node from the nodes included in the distributed network system according to a preset ratio, wherein the preset ratio is a ratio of the number of master nodes to the total number of nodes included in the distributed network system, and among the nodes included in the distributed network system, nodes other than the master node are the slave nodes; Assign one master node to one group, and obtain multiple groups; assigning the slave nodes to the plurality of groups; Adjusting the number of nodes in the plurality of groups so that each of the groups includes at least m+1 nodes; The allocating the slave nodes to the plurality of groups comprises: Obtaining parameter information of the i-th master node and parameter information of the slave nodes to be assigned, wherein the slave nodes to be assigned include slave nodes that are not assigned to the group; Determining a second degree of applicability between the i-th master node and each of the slave nodes to be assigned according to the parameter information of the i-th master node and the parameter information of the slave nodes to be assigned; According to the second applicability degree, m and the number of the slave nodes to be allocated, selecting a slave node allocated to the group where the i-th master node is located from the nodes to be allocated; Wherein, i is an integer from 1 to N, and P represents the number of the master nodes.
2. The method according to claim 1, characterized in that: The step of establishing a monitoring relationship between nodes in the distributed network system so that each node is monitored by at least m nodes includes: The following process is performed for each node in the distributed network system to obtain the monitoring relationship between the nodes in the distributed network system: Selecting m monitoring nodes of the first node from the first other nodes, and establishing a monitoring relationship between the first node and the monitoring nodes; The first node is one of the nodes included in the distributed network system, and the first other nodes include nodes other than the first node among the nodes included in the distributed network system.
3. The method according to claim 2, characterized in that The step of selecting m monitoring nodes of the first node from the first other nodes includes: Acquire parameter information of the first node and parameter information of each of the first other nodes; determining, according to the parameter information of the first node and the parameter information of the first other nodes, a first degree of applicability between the first node and each of the first other nodes; The first other nodes are sorted in descending order of the first applicability degree, and the top m nodes are selected as monitoring nodes of the first node.
4. The method according to claim 1, characterized in that: The step of adjusting the number of nodes in the plurality of groups so that each of the groups includes at least m+1 nodes comprises: Obtaining a first number of nodes in each second other group, wherein the second other group includes groups other than the first group in the plurality of groups, and the first group is one of the groups having a number of nodes less than m+1; Combine the first group with the first target group with the smallest number to obtain a merged group; When the number of nodes in the merged group is greater than or equal to 2·(m+1), split the merged group into two groups including at least m+1 nodes, wherein each of the two groups obtained by splitting includes a master node; When the number of nodes in the merged group is less than 2·(m+1), converting the master node in the merged group that originally belongs to the first group into a slave node; The merging of the groups is stopped until each of the groups includes at least m+1 nodes.
5. The method according to claim 1, characterized in that The step of adjusting the number of nodes in the plurality of groups so that each of the groups includes at least m+1 nodes comprises: Converting a master node in each second group into a slave node to obtain a target slave node, wherein the second group is a group including only one master node; In the third group, respectively select a second target group to be joined for each target slave node, and add the target slave node to its corresponding second target group, wherein the third group is a group including a master node and at least one slave node; The nodes between the third groups are balanced so that each of the third groups includes at least m+1 nodes.
6. The method according to claim 5, characterized in that In the third group, selecting a second target group to be joined for each target slave node respectively includes: Obtaining a second number of nodes in each of the third groups; Selecting the third group with the smallest second number as the second target group that the kth target slave node needs to join; Wherein, k is an integer from 1 to K, and K represents the number of the target slave nodes.
7. The method according to claim 5, characterized in that The balancing of the nodes between the third groups so that each of the third groups includes at least m+1 nodes comprises: In the case that there is a group with a number of nodes greater than m+1 in the third group, at least some of the nodes in the group with the largest number of nodes in the group with a number of nodes greater than m+1 are transferred to the group with the smallest number of nodes in the third group; In the case that there is no group with a node number greater than m+1 in the third group, the groups with a node number less than m+1 are sorted in ascending order of the number of nodes, the top two groups are selected, and the master node in one of the selected groups is converted into a slave node, and the nodes in the group are transferred to another selected group.
8. The method according to claim 3, characterized in that The parameter information includes: delay information between nodes, reliability information of nodes, and load conditions of nodes.
9. The method according to claim 3, characterized in that: The first degree of suitability or the second degree of suitability is: an average value of a degree of hardware device matching between nodes and a network connection performance index between nodes.
10. A monitoring device, characterized in that: Applied to a distributed network system, the distributed network system includes a plurality of nodes; the device includes: An establishment module, configured to establish a monitoring relationship between nodes in the distributed network system so that each node is monitored by at least m nodes, where m is an integer greater than or equal to 1 and less than Q, and Q represents the total number of nodes included in the distributed network system; A monitoring module, used to monitor the operation process of the nodes in the distributed network system that have a monitoring relationship with the nodes; The establishment module includes: A grouping submodule, configured to determine a plurality of groups based on the nodes included in the distributed network system, wherein each of the groups includes at least m+1 nodes; The second establishment submodule is used to establish a monitoring relationship between every two nodes in the same group; The grouping submodule includes: A node division unit, configured to select a master node and a slave node from the nodes included in the distributed network system according to a preset ratio, wherein the preset ratio is a ratio of the number of master nodes to the total number of nodes included in the distributed network system, and among the nodes included in the distributed network system, nodes other than the master node are the slave nodes; A first allocation unit, configured to allocate a master node to a group to obtain a plurality of groups; A second allocating unit, configured to allocate the slave nodes to the plurality of groups; An adjusting unit, configured to adjust the number of nodes in the plurality of groups so that each of the groups includes at least m+1 nodes; Optionally, the second allocation unit is specifically used to: Obtaining parameter information of the i-th master node and parameter information of the slave nodes to be assigned, wherein the slave nodes to be assigned include slave nodes that are not assigned to the group; Determining a second degree of applicability between the i-th master node and each of the slave nodes to be assigned according to the parameter information of the i-th master node and the parameter information of the slave nodes to be assigned; According to the second applicability degree, m and the number of the slave nodes to be allocated, selecting a slave node allocated to the group where the i-th master node is located from the nodes to be allocated; Wherein, i is an integer from 1 to N, and P represents the number of the master nodes.
11. An electronic device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the monitoring method according to any one of claims 1 to 9 when executed by the processor.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the monitoring method according to any one of claims 1 to 9 are implemented.
