A node management method based on a backhaul mechanism
By deploying the red series processes in the hydropower station monitoring system and using message sequence numbers to determine the status of single nodes and master-slave nodes, the problems of untimely host failure switching and inefficient load balancing management were solved, thereby improving the stability and performance of the system.
Patent Information
- Application Number
- CN202311589100.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-24
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2043-11-24
AI Technical Summary
The existing hydropower station monitoring system suffers from untimely slave switching when the master unit fails, and its load balancing management is not efficient and reliable enough, which affects the system's performance and stability.
Deploy the red series processes in the monitoring system to realize single node status, master-slave node judgment and load balancing management through sending and receiving threads, and use message sequence numbers for fast judgment and synchronization.
It enables rapid determination of single node status and master-slave node relationship, improving the efficiency and reliability of load balancing management, and enhancing system stability and performance.
Smart Images

Figure CN117793121B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a hydropower station monitoring system, in particular to a node management method based on a backhaul mechanism. BACKGROUND
[0002] The hydropower station monitoring system automatically collects input signals such as electrical quantity, switch quantity, temperature quantity, pressure, liquid level, and flow of production equipment of the hydropower station, and completes various production processes and control over other equipment. In order to improve the operation reliability of the hydropower station monitoring system, the hydropower station monitoring system generally adopts a master-slave redundant mode design, the master is responsible for the collection, processing, and release of business data, and the slave passively receives the data released by the master. When the master fails, the slave takes over the relevant business of the master.
[0003] The load balancing function distributes the functions and pressure of the hydropower station monitoring system to different redundant servers, realizes unified scheduling and management of real-time data and computing resources through a management node, reduces the computing burden of a single function node, improves the overall performance of the large-scale hydropower station monitoring system, and makes the large-scale hydropower station monitoring system more efficient, easy to use, and stable. SUMMARY
[0004] The purpose of the present application is to provide a node management method based on a backhaul mechanism, so as to realize rapid judgment of the state of a single node and the master-slave nodes in the monitoring system, and efficient and reliable management of the load balancing nodes in the system.
[0005] The technical scheme of the present application is as follows:
[0006] red series processes are deployed on all nodes in the monitoring system, and the red series processes are used to realize the state judgment of a single node, the master-slave node judgment, and the management of the load balancing nodes in the system, and mainly include red and red_m processes; two threads are realized in the red process, which are a sending thread and a receiving thread, the sending thread sends the local state, the latest value of the received opposite message sequence number, and the current message sequence number of the local node to other nodes in the local node configuration every 200 ms, and the receiving thread blocks to listen to the messages sent by other nodes, and analyzes the opposite message sequence number and the latest sequence number of the received local message in the messages; the red_m process judges whether other nodes are online through the latest sequence number of the received local message in the current message, the current message sequence number of the local node, and the sequence number of the received local message in the previous message.
[0007] The single node state judgment includes the following steps:
[0008] Step 2.1, start the local machine, set the local machine state to "INITAL", wherein "INITAL" represents that the local machine is in an initialization state; set SN_LOCAL to 0, SN1 to -1, SN2 to -1, Flag to 0, Status to 0, Net0 to 0, Net1 to 0, Net2 to 0, Net3 to 0; wherein SN_LOCAL is used to represent the local message sequence number, SN1 is used to record the latest sequence number sent by the opposite side; SN2 is used to record the message sequence number returned by the opposite side to the local side, Flag is used to represent a new write mark, Status is used to represent the node state, and Net0-3 represent the node network card state; after the initialization is completed, the local machine state is set to "STANDALONE";
[0009] Step 2.2, the sending thread of the opposite side red process sends a UDP message to other nodes in the node configuration every 200 ms, wherein the UDP message contains the local machine state, the latest value SN2 of the received opposite side message sequence number and the current message sequence number SN1 of the local machine; the local red receiving thread receives the UDP message from other nodes, updates SN1 after receiving the message; and then judges whether the received SN2 is between SN_LOCAL and the last received SN2; if not, it is considered that there is a problem with the opposite side, and no subsequent operation is performed; if normal, update SN2, update Status, and set Flag to 1.
[0010] Step 2.3, the local red_m judges the returned SN2 of each node and the local SN_LOCAL through the message received by the red receiving thread; if the difference is more than 5, it is judged that the opposite side node network card is offline, and if all the network cards of the opposite side node are in an offline state, the state of the opposite side node in the local node configuration is set to "DEAD", wherein "DEAD" represents that the node is offline.
[0011] The master-slave node judgment comprises the following steps:
[0012] Step 3.1, start the local machine, set the local machine state to "INITAL"; set SN_LOCAL to 0, SN1 to -1, SN2 to -1, Flag to 0, Status to 0, Net0 to 0, Net1 to 0, Net2 to 0, Net3 to 0, and SFlag to 0, wherein SFlag represents a redundancy switching mark; after the initialization is completed, the local machine state is set to "STANDALONE";
[0013] Step 3.2, the sending thread of the opposite side red process sends a UDP message to other nodes in the node configuration every 200 ms; if the local node needs to switch from master to slave and the local node is the master, the state of the local node is switched to "MID" through the switching mechanism, "MID" indicating a non-working state; if the local node is the slave, the SFlag in the sent message is set to 1 when sending data to the master; the local red receiving thread receives the UDP message from other nodes, updates SN1, SN2, Status and Flag after receiving the message, and the updating process is the same as step 2.2; if the received SFlag is 1, the local node is switched to "MID";
[0014] Step 3.3, the SN2 returned by each node is compared with the local SN_LOCAL through red_m; if the difference exceeds 5, it is judged that the network card of the node is offline, and if all network cards of the node are offline, the state of the node is set to "DEAD".
[0015] The load balancing node management comprises the following steps:
[0016] Step 4.1, starting the local node, setting the state of the local node to "INITAL"; setting DIV_NOW to -1, DIV_WANT to -1, SN_LOCAL to 0, SN1 to -1, SN2 to -1, Flag to 0, Status to 0, Net0 to 0, Net1 to 0, Net2 to 0, Net3 to 0, SFlag to 0, STRATEGY to 0, and SFlag to 0; wherein DIV_NOW represents the current allocation scheme number of the local node, DIV_WANT represents the planned allocation scheme number of the local node, STRATEGY is used to represent the load balancing allocation scheme number, and SFlag represents the redundancy switching flag; generating a static load balancing allocation table according to the number of nodes in the node configuration; after the initialization is completed, the state of the local node is set to "STANDALONE";
[0017] Step 4.2, the opposite side red sending thread sends a first group of UDP messages, mainly including the state of the local node, the latest value SN2 of the received opposite side message and the current message sequence number SN1 of the local node; the local red receiving thread receives the first group of UDP messages and updates SN1, SN2, Status and Flag, and the updating process is the same as step 2.2; at the same time, the local red sending thread sends a second group of UDP messages to other nodes in the node configuration, and the second group of UDP messages mainly contain the load balancing allocation scheme number of the local node; the red sending thread updates DIV_WANT of the local node according to the state of other nodes; the receiving thread of the local red process receives the second group of UDP messages and updates the load balancing allocation scheme on the local node;
[0018] Step 4.3: red_m determines whether a node is offline based on the first group of messages received by the red receiving thread, and the determination process is the same as in step 2.3. At the same time, red_m checks the allocation scheme of all other online nodes on the local machine every 200m. If all node allocation schemes are the same, DIV_NOW is updated and the actual control policy is switched. If all online node allocation schemes are different and no update is performed for more than five cycles, an alarm is triggered.
[0019] A computer storage medium storing a computer program that, when executed by a processor, implements the aforementioned node management method based on a backhaul mechanism.
[0020] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described node management method based on a backhaul mechanism.
[0021] Beneficial effects: Compared with the prior art, the present invention has the following advantages:
[0022] 1. This invention provides a node management method based on a backhaul mechanism. The red series processes are deployed on all nodes of the system. The red series processes compare the current message sequence number with the message sequence number received by the other side to quickly determine the status of a single node and the master-slave relationship in the system.
[0023] 2. At the same time, the red series processes also enable rapid synchronization of load balancing distribution schemes, making the management of load balancing nodes in the system more efficient and reliable. Attached Figure Description
[0024] Figure 1 The flowchart for node management is as follows: SN_LOCAL is used to represent the sequence number of the local message, SN1 is used to record the latest sequence number sent by the other side, SN2 is used to record the sequence number of the message returned by the other side to the local side, Flag is used to represent the newly written flag, Status is used to represent the node status, Net0~3 represent the node network card status, and SN2_last is used to represent the sequence number of the last message returned by the other side to the local machine. Detailed Implementation
[0025] The technical solution of the present invention will be further described below with reference to the accompanying drawings.
[0026] like Figure 1 As shown, a node management method based on a backhaul mechanism includes the following steps:
[0027] The red series processes are deployed on all nodes in the monitoring system, and the single node state judgment, master-slave node judgment and load balancing node management are realized through the red series processes, which mainly include red and red_m processes. Two threads are realized in the red process, which are sending thread and receiving thread. The sending thread sends the local state, the latest value of the received opposite message sequence number and the current message sequence number of the local node to other nodes in the local node configuration every 200 ms. The receiving thread blocks to listen to the messages sent by other nodes, and analyzes the opposite message sequence number and the latest sequence number of the received local message in the message. The red_m process judges whether other nodes are online through the latest sequence number of the received local message in the current message, the current message sequence number of the local node and the sequence number of the received local message in the last message.
[0028] The single node state judgment includes the following steps:
[0029] Step 2.1, starting the local node, setting the local node state to “INITAL”, wherein “INITAL” represents that the local node is in the initialization state; setting SN_LOCAL to 0, SN1 to -1, SN2 to -1, Flag to 0, Status to 0, Net0 to 0, Net1 to 0, Net2 to 0, and Net3 to 0; wherein SN_LOCAL is used to represent the local message sequence number, SN1 is used to represent the latest sequence number sent by the opposite side; SN2 is used to record the message sequence number returned by the opposite side, Flag is used to represent the new write mark, Status is used to represent the node state, and Net0-3 represent the node network card state; after the initialization is completed, the local node state is set to “STANDALONE”;
[0030] Step 2.2, the sending thread of the opposite red process sends a UDP message to other nodes in the node configuration every 200 ms, which contains the local node state, the latest value of the received opposite message sequence number SN2 and the current message sequence number SN1 of the local node; the receiving thread of the local red receives the UDP message from other nodes, updates SN1 after receiving the message; and then judges whether the received SN2 is between SN_LOCAL and the last received SN2; if not, it is considered that there is a problem with the opposite side, and no subsequent operation is performed; if normal, update SN2, update Status, and set Flag to 1;
[0031] Step 2.3, the red_m of the local node judges the returned SN2 of each node and the local SN_LOCAL; if the difference is more than 5, it is judged that the network card of the opposite node is offline, and if all network cards of the opposite node are in the offline state, the state of the opposite node in the local node configuration is set to “DEAD”, wherein “DEAD” represents that the node is offline.
[0032] The master-slave node judgment comprises the following steps:
[0033] Step 3.1, start the local machine, set the local machine state to "INITAL"; set SN_LOCAL to 0, SN1 to -1, SN2 to -1, Flag to 0, Status to 0, Net0 to 0, Net1 to 0, Net2 to 0, Net3 to 0, SFlag to 0, wherein SFlag represents a redundancy switching flag; after completing the initialization, set the local machine state to "STANDALONE";
[0034] Step 3.2, the sending thread of the opposite side red process sends a UDP message to other nodes in the node configuration every 200 ms; if the local machine needs to perform master-slave switching and the local machine is the master, the local machine state is switched to "MID" through the switching mechanism, wherein "MID" represents a non-working state; if the local machine is the slave, when sending data to the master, set SFlag in the sent message to 1; the local red receiving thread receives the UDP message from other nodes, updates SN1, SN2, Status and Flag after receiving the message, and the updating process is synchronous with step 2.2; if the received SFlag is 1, the local machine is switched to "MID";
[0035] Step 3.3, judge the returned SN2 of each node by red_m and the local SN_LOCAL; if the difference is more than 5, judge that the node network card is offline, if all network cards of the node are in the offline state, set the node state to "DEAD".
[0036] The load balancing node management comprises the following steps:
[0037] Step 4.1, start the local machine, set the local machine state to "INITAL"; set DIV_NOW to -1, DIV_WANT to -1, SN_LOCAL to 0, SN1 to -1, SN2 to -1, Flag to 0, Status to 0, Net0 to 0, Net1 to 0, Net2 to 0, Net3 to 0, SFlag to 0, STRATEGY to 0, SFlag to 0; wherein DIV_NOW represents the current allocation scheme number of the local machine, DIV_WANT represents the planned allocation scheme number of the local machine, STRATEGY is used to represent the load balancing allocation scheme number, and SFlag represents the redundancy switching flag; generate a static load balancing allocation table according to the number of nodes in the node configuration, as shown in Table 1; after the initialization is completed, set the local machine state to "STANDALONE". In Table 1, Main1-4 represent all nodes in the system, 0 represents that the local machine does not participate in load allocation, and 1 represents that the local machine participates in load allocation, and the scheme number represents the load balancing allocation scheme between all nodes.
[0038] Table 1 Static task allocation table
[0039] Scheme No. Main1 Main2 Main3 Main4 Specific allocation scheme 0 0 0 0 0 1 1 0 0 0 2 0 1 0 0 3 1 1 0 0 4 0 0 1 0 5 1 0 1 0 6 0 1 1 0 7 1 1 1 0 8 0 0 0 1 9 1 0 0 1 10 0 1 0 1 11 1 1 0 1 12 0 0 1 1 13 1 0 1 1 14 0 1 1 1 15 1 1 1 1
[0040] Step 4.2, the peer red sends the first group of UDP messages, mainly including the local machine state, the latest value SN2 of the received peer message sequence number, and the current message sequence number SN1 of the local machine; the local red receiving thread receives the first group of UDP messages, and updates SN1, SN2, Status, and Flag, and the updating process is synchronous with step 2.2; at the same time, the local red sending thread sends the second group of UDP messages to other nodes in the node configuration, and the second group of UDP messages mainly contain the load balancing allocation scheme number of the local machine, and the allocation scheme number is obtained by looking up Table 1; the red sending thread updates DIV_WANT of the local machine according to the state of the other nodes; the receiving thread of the local red process receives the second group of UDP messages, and updates the load balancing allocation scheme on the node;
[0041] Step 4.3, red_m judges whether the node is offline according to the first group of messages received by the red receiving thread, and the judgment process is synchronous with step 2.3; at the same time, red_m judges the allocation scheme of all other online nodes in the local machine every 200m, if the allocation schemes of all nodes are the same, updates DIV_NOW, and switches the actual control strategy; if the allocation schemes of all online nodes are different, and no update is performed for more than five periods, an alarm is given.
[0042] A computer storage medium, having stored thereon a computer program, the computer program being executed by a processor to implement the above-mentioned node management method based on the backhaul mechanism.
[0043] A computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements the above-mentioned node management method based on the backhaul mechanism when executing the computer program.
Claims
1. A node management method based on a backhaul mechanism, characterized in that, The steps are as follows: In the monitoring system, the red series processes are deployed on all nodes, and the red series processes are used to realize the single node state judgment, master-slave node judgment and load balancing node management in the system, and the red series processes include red and red_m processes; two threads are realized in the red process, which are sending thread and receiving thread, the sending thread sends the local state, the latest value of the received opposite message sequence number and the current message sequence number of the local node to other nodes in the local node configuration every certain period of time; the receiving thread blocks to listen to the messages sent by other nodes, and analyzes the opposite message sequence number and the latest sequence number of the received local message in the message; the red_m process judges whether other nodes are online through the latest sequence number of the received local message in the current message, the current message sequence number of the local node and the sequence number of the received local message in the last message; The single node state judgment includes the following steps: Step 2.1, starting the local node, setting the local node state as "INITAL", wherein "INITAL" represents that the local node is in an initialization state; setting SN_LOCAL as 0, SN1 as-1, SN2 as-1, Flag as 0, Status as 0, Net0 as 0, Net1 as 0, Net2 as 0 and Net3 as 0; wherein SN_LOCAL is used to represent the local message sequence number, SN1 is used to represent the latest sequence number sent by the opposite side; SN2 is used to record the message sequence number returned by the opposite side, Flag is used to represent a new writing mark, Status is used to represent the node state, and Net0-3 represent the node network card state; after the initialization is completed, the local node state is set as "STANDALONE"; Step 2.2, the sending thread of the opposite red process sends a UDP message to other nodes in the node configuration every certain period of time, wherein the UDP message contains the local node state, the latest value of the received opposite message sequence number SN2 and the current message sequence number SN1 of the local node; the receiving thread of the local red receives the UDP message from other nodes, updates SN1 after receiving the message; and then judges whether the received SN2 is between SN_LOCAL and the last received SN2; if not, it is considered that there is a problem with the opposite side, and no subsequent operation is performed; if normal, SN2 is updated, Status is updated, and Flag is set as 1; Step 2.3, the red_m of the local node judges the returned SN2 of each node and the local SN_LOCAL through the received message of the red receiving thread; if the difference is more than 5, it is judged that the network card of the opposite node is offline, and if all the network cards of the opposite node are in an offline state, the state of the opposite node in the local node configuration is set as "DEAD", wherein "DEAD" represents that the node is offline.
2. The method of claim 1, wherein, The master-slave node judgment includes the following steps: Step 3.1, start the local machine, set the state of the local machine to "INITAL"; set SN_LOCAL to 0, SN1 to -1, SN2 to -1, Flag to 0, Status to 0, Net0 to 0, Net1 to 0, Net2 to 0, Net3 to 0, SFlag to 0, wherein SFlag represents a redundancy switching flag; after completing the initialization, set the state of the local machine to "STANDALONE"; Step 3.2, the sending thread of the opposite side red process sends a UDP message to other nodes in the node configuration every certain period of time; if the local machine needs to perform master-slave switching and the local machine is the master, the state of the local machine is switched to "MID" through a switching mechanism, wherein "MID" represents a non-working state; if the local machine is the slave, when data is sent to the master, the SFlag in the sent message is set to 1; the receiving thread of the local red receives a UDP message from other nodes, updates SN1, SN2, Status and Flag after receiving the message, and the updating process is synchronous with step 2.2; if the received SFlag is 1, the local machine is switched to "MID"; Step 3.3, judge the returned SN2 of each node and the local SN_LOCAL through red_m; if the difference exceeds 5, it is judged that the network card of the node is offline, if all network cards of the node are in an offline state, the state of the node is set to "DEAD".
3. The method of claim 1, wherein the method further comprises: The load balancing node management comprises the following steps: Step 4.1, start the local machine, set the state of the local machine to "INITAL"; set DIV_NOW to -1, DIV_WANT to -1, SN_LOCAL to 0, SN1 to -1, SN2 to -1, Flag to 0, Status to 0, Net0 to 0, Net1 to 0, Net2 to 0, Net3 to 0, SFlag to 0, STRATEGY to 0; wherein DIV_NOW represents the current allocation scheme number of the local machine, DIV_WANT represents the planned allocation scheme number of the local machine, STRATEGY is used to represent the load balancing allocation scheme number, and SFlag represents a redundancy switching flag; generate a static load balancing allocation table according to the number of nodes in the node configuration; after completing the initialization, set the state of the local machine to "STANDALONE"; Step 4.2, the opposite side red sends the first group of UDP messages, including the local state, the latest value SN2 of the received opposite side message sequence number and the local current message sequence number SN1; the local red receiving thread receives the first group of UDP messages and updates SN1, SN2, Status, Flag, the updating process is the same as step 2.2; at the same time, the local red sending thread sends the second group of UDP messages to other nodes in the node configuration, and the second group of UDP messages contains the local load balancing distribution scheme number; the red sending thread updates the DIV_WANT of the local node according to the state of other nodes; the receiving thread of the local red process receives the second group of UDP messages and updates the load balancing distribution scheme on the node; Step 4.3, the red_m judges whether the node is offline according to the first group of messages received by the red receiving thread, and the judgment process is the same as step 2.3; at the same time, the red_m judges the distribution scheme of all other online nodes in the local node every certain period of time, if the distribution schemes of all nodes are the same, the DIV_NOW is updated and the actual control strategy is switched; if the distribution schemes of all online nodes are different, no update is made for more than five periods, and an alarm is given.
4. A computer storage medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to implement the node management method based on the backhaul mechanism in any one of claims 1-3.
5. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the node management method based on the backhaul mechanism in any one of claims 1-3.
Citation Information
Patent Citations
Distributed cluster data management node monitoring method and module
CN106302726A
A dual-machine hot standby redundancy implementation system and method for a subway integrated monitoring system
CN109597723A