Equipment linkage control method and system based on main and standby clusters
Through the load balancing calculation and automatic switching mechanism of the active-standby cluster, the problems of hardware resource waste and management costs in the automated linkage scenarios of the subway line equipment monitoring system are solved, the reliability and stability of equipment linkage control are achieved, and resource utilization is improved.
Patent Information
- Application Number
- CN202510800396.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-16
- Publication Date
- 2025-09-19
AI Technical Summary
In the existing subway line equipment monitoring system, the automation linkage scenarios are highly complex, hardware resources are wasted and management costs are increased. The uneven distribution of traditional linkage processing capabilities leads to poor coordination, making it difficult to meet the needs of fully automated unmanned driving.
The device linkage control method of the master-slave cluster is adopted. The device linkage control group of each node is calculated based on the load balancing principle. The master cluster node processes and sends control commands. The standby cluster node takes over the linkage control when the master node is abnormal, ensuring system stability and resource utilization.
It achieves the reliability and stability of equipment linkage control, avoids system paralysis caused by single point failure, improves hardware resource utilization, and reduces management costs and coordination difficulty.
Smart Images

Figure CN120676034A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of rail transit monitoring systems, and in particular to a device linkage control method and system based on a master-standby cluster. Background Art
[0002] Subway line equipment monitoring systems are numerous and complex, requiring greater expertise from operations and maintenance personnel. The limitations of manual operation are becoming increasingly apparent, leading to widespread adoption of automated linkage scenarios within rail transit systems. Line networks or systems integrate or interconnect multiple disciplines and systems, enabling coordinated operations across multiple disciplines or devices in different locations. These operations are triggered by predefined timeframes or signals, executing a set of control commands across multiple devices. This allows for specialized automation scenarios, such as morning station switching and platform fire response.
[0003] With the application of driverless, fully automated technology in subways, the number and complexity of automated linkage scenarios are increasing. This is particularly prominent in applications such as integrated line monitoring systems and line power dispatching systems. The scale of automated linkage scenarios has exceeded tens of thousands, placing significant pressure on the processing power and hardware resources of automated monitoring systems. This necessitates the rational and flexible allocation of hardware resources and processing power. Traditionally, linkage processing capabilities are primarily distributed across stations, resulting in poor coordination and complex definitions, leading to wasted hardware resources and increased management costs. Therefore, it is necessary to shift from a distributed processing approach to a clustered approach. Summary of the Invention
[0004] Purpose of the invention: The present invention aims to provide a device linkage control method and system based on a master-slave cluster, to realize the deployment mode of the master-slave cluster of the device linkage control function, to improve the reliability of the linkage control, to improve the utilization rate of hardware resources and to reduce management costs.
[0005] Technical solution: The present invention provides a device linkage control method based on a master-slave cluster, comprising:
[0006] The master cluster node calculates the device linkage control group that each master cluster node needs to process based on the load balancing principle; the standby cluster node calculates the device linkage control group that the standby cluster node needs to process based on the load balancing principle, and also calculates the device linkage control group that the master cluster node needs to process.
[0007] The master cluster node and the backup cluster node simultaneously receive linkage control commands and process the device linkage control of the node, generating the main processing flow and backup processing flow of the linkage. The main processing flow receives the return signal from the device to proceed to the next logic step, sending the control command to the device and sending the device return signal to the human-machine interface; the backup processing flow executes the linkage control logic but does not send the control command to the device or send the device return signal to the human-machine interface.
[0008] When the main cluster node that is processing the linkage control process exits abnormally, the standby cluster node detects the abnormal exit information of the main cluster node, and the standby processing flow corresponding to the main processing flow of the abnormally exited main cluster node in the standby cluster node is upgraded to the main processing flow, and the control command is sent to the device, and the device returns a signal to the human-machine interface to complete the subsequent linkage control process.
[0009] Furthermore, the computing device linkage control group of the master cluster node and the backup cluster node includes:
[0010] All active and standby cluster nodes are started and their node information is registered in the ZooKeeper active and standby directories respectively;
[0011] The master cluster node reads all node information in the master cluster from Zookeeper {n1, n2, ..., n i}, the number of nodes is i; the standby cluster node reads all the node information {n1,n2,......,n i}, the number of nodes is i, and all node information in the standby cluster {m1,m2,......,m j}, the number of nodes is j; all nodes read the same device linkage control keyword sequence {k1, k2, ..., k l}, the number of linkage controls is l; the master cluster node sorts the node information, and then calculates the device linkage control group that each master cluster node needs to process according to the load balancing principle, that is, the correspondence relationship between the master cluster node and the device linkage control keyword sequence g z :
[0012] g z ={n1:[k1,k2,......k x ],n2:[k x+1 ,k x+2 ,......k y ],......,n i :[k y+1 ,k y+2 ,......k l ]};
[0013] The standby cluster node sorts the node information, and then calculates the device linkage control group that each standby cluster node needs to process based on the load balancing principle, that is, the corresponding relationship between the standby cluster node and the device linkage control keyword sequence g b :
[0014] g b ={m1:[k1,k2,......k x],m2:[k x+1 ,k x+2 ,......k y ],......,m j :[k y+1 ,k y+2 ,......k l ]}, the standby cluster node simultaneously calculates the device linkage control group that each master cluster node needs to process, that is, g z .
[0015] Furthermore, the main processing flow and the backup processing flow include:
[0016] The master and backup cluster nodes simultaneously receive human-machine interface linkage control commands and read the execution status of the linkage related to the command in Redis. If it is being executed, the command is discarded. Otherwise, the command is filtered to see if the linkage associated with the command is in the device linkage control group that needs to be processed by the local device. If not, the command is discarded. If so, the master-slave processing flow is generated and the execution status of the linkage is stored in Redis. After the processing flow is completed, the linkage execution status is cleared.
[0017] The main processing flow receives the device's return signal to proceed to the next logical step, sends control commands to the device, and sends the device's return signal to the human-machine interface;
[0018] The standby processing flow receives the device's return signal to proceed to the next logical step, but does not send control commands to the device or send device return signals to the human-machine interface;
[0019] A device linkage control has one and only one processing flow in the active cluster and one and only one processing flow in the standby cluster. The steps of the two processing flows are consistent.
[0020] Furthermore, the abnormal exit of the main cluster node that is processing the linkage control process includes the abnormal exit of the main cluster node due to operating system or hardware reasons; after the abnormal exit of the main cluster node, the main cluster node and the backup cluster node recalculate the device linkage control group that the node needs to process.
[0021] The present invention also provides a device linkage control system based on a master-slave cluster, comprising:
[0022] In the redundant design module, the master cluster node calculates the device linkage control group that each master cluster node needs to process based on the load balancing principle; the standby cluster node calculates the device linkage control group that the standby cluster node needs to process based on the load balancing principle, and also calculates the device linkage control group that the master cluster node needs to process.
[0023] The device linkage module, after receiving linkage control commands from both the master cluster node and the backup cluster node, processes the device linkage control of the node, generating the main processing flow and backup processing flow of the linkage. The main processing flow receives the return signal from the device to proceed to the next logic step, sending the control command to the device and sending the device return signal to the human-machine interface; the backup processing flow executes the linkage control logic but does not send the control command to the device or send the device return signal to the human-machine interface;
[0024] The exception handling module, when the main cluster node that is processing the linkage control process exits abnormally, the standby cluster node detects the abnormal exit information of the main cluster node, and the standby processing flow corresponding to the main processing flow of the abnormally exited main cluster node in the standby cluster node is upgraded to the main processing flow, sends a control command to the device, and sends the device return signal to the human-machine interface to complete the subsequent linkage control process.
[0025] Furthermore, in the redundant design module, the main cluster node and the backup cluster node computing device linkage control group include:
[0026] All active and standby cluster nodes are started and their node information is registered in the ZooKeeper active and standby directories respectively;
[0027] The master cluster node reads all node information in the master cluster from Zookeeper {n1, n2, ..., n i}, the number of nodes is i; the standby cluster node reads all the node information {n1,n2,......,n i}, the number of nodes is i, and all node information in the standby cluster {m1,m2,......,m j}, the number of nodes is j; all nodes read the same device linkage control keyword sequence {k1, k2, ..., k l}, the number of linkage controls is l; the master cluster node sorts the node information, and then calculates the device linkage control group that each master cluster node needs to process according to the load balancing principle, that is, the correspondence relationship between the master cluster node and the device linkage control keyword sequence g z :
[0028] g z ={n1:[k1,k2,......k x ],n2:[k x+1 ,k x+2 ,......k y ],......,n i :[k y+1 ,k y+2 ,......k l ]};
[0029] The standby cluster node sorts the node information, and then calculates the device linkage control group that each standby cluster node needs to process based on the load balancing principle, that is, the corresponding relationship between the standby cluster node and the device linkage control keyword sequence g b :
[0030] g b ={m1:[k1,k2,......k x ],m2:[k x+1 ,k x+2 ,......k y ],......,m j :[k y+1 ,k y+2 ,......k l ]}, the standby cluster node simultaneously calculates the device linkage control group that each master cluster node needs to process, that is, g z .
[0031] Furthermore, in the device linkage module, the main processing flow and the backup processing flow include:
[0032] The master and backup cluster nodes simultaneously receive human-machine interface linkage control commands and read the execution status of the linkage related to the command in Redis. If it is being executed, the command is discarded. Otherwise, the command is filtered to see if the linkage associated with the command is in the device linkage control group that needs to be processed by the local device. If not, the command is discarded. If so, the master-slave processing flow is generated and the execution status of the linkage is stored in Redis. After the processing flow is completed, the linkage execution status is cleared.
[0033] The main processing flow receives the device's return signal to proceed to the next logical step, sends control commands to the device, and sends the device's return signal to the human-machine interface;
[0034] The standby processing flow receives the device's return signal to proceed to the next logical step, but does not send control commands to the device or send device return signals to the human-machine interface;
[0035] A device linkage control has one and only one processing flow in the active cluster and one and only one processing flow in the standby cluster. The steps of the two processing flows are consistent.
[0036] Furthermore, in the exception handling module, the abnormal exit of the main cluster node that is processing the linkage control process includes the abnormal exit of the main cluster node due to operating system or hardware reasons; after the main cluster node abnormally exits, the main cluster node and the backup cluster node recalculate the device linkage control group that needs to be processed by this node.
[0037] The present invention also provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0038] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0039] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages: 1. Through the deployment of the master-slave cluster, when the master cluster node exits abnormally, the standby cluster node can automatically take over the linkage control process to ensure the reliability and stability of the equipment linkage control and avoid paralysis of the entire system due to a single point failure. 2. Each node calculates the equipment linkage control group that the node needs to process based on the number of cluster nodes, thereby achieving load balancing, avoiding the situation where some nodes are overloaded while other nodes are idle, and making full use of the hardware resources of all nodes in the cluster. 3. Changing the distributed processing method to a cluster processing method changes the traditional linkage processing capacity mainly distributed in each station mode, reduces the difficulty and complexity of coordination between devices, facilitates centralized management and maintenance, and reduces management costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 This is a schematic diagram of the active-standby cluster operation of the present invention. DETAILED DESCRIPTION
[0041] The present invention will be further illustrated below with reference to the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not intended to limit the scope of the present invention. After reading the present invention, modifications of various equivalent forms of the present invention made by those skilled in the art all fall within the scope defined by the claims attached to this application.
[0042] Example 1
[0043] See also Figure 1 As shown, this embodiment provides a device linkage control method based on an active-standby cluster, specifically including:
[0044] Step S1, redundancy design of the primary cluster node and the backup cluster node, includes:
[0045] Because the node names of all nodes in the primary and standby clusters must be unique, the node names of the primary and standby cluster nodes cannot be the same. Therefore, during containerized deployment, k8s automatically assigns the node name of the container.
[0046] After the master cluster node is started, the node name of the local node is registered in the zookeeper's main directory / master; after the standby cluster node is started, the node name of the local node is registered in the zookeeper's backup directory / backup.
[0047] The master cluster node reads all node information in the master cluster from Zookeeper {n1, n2, ..., n i}, the number of nodes is i, the standby cluster node reads all the node information of the main cluster from Zookeeper {n1,n2,......,n i} and all node information in the standby cluster {m1,m2,......,m j}, the number of nodes are i and j respectively, all nodes read the same device linkage control keyword sequence {k1, k2, ..., k l}, the number of linkage controls is l.
[0048] The master cluster node sorts the node information, and then calculates the device linkage control group that each master cluster node needs to process according to the load balancing principle, that is, the correspondence between the master cluster node and the device linkage control keyword sequence g z :
[0049] g z ={n1:[k1,k2,......k x ],n2:[k x+1 ,k x+2 ,......k y ],......,n i :[k y+1 ,k y+2 ,......k l ]};
[0050] The standby cluster node sorts the node information, and then calculates the device linkage control group that each standby cluster node needs to process based on the load balancing principle, that is, the corresponding relationship between the standby cluster node and the device linkage control keyword sequence g b :
[0051] g b ={m1:[k1,k2,......k x ],m2:[k x+1 ,k x+2 ,......k y ],......,m j :[k y+1 ,k y+2 ,......k l ]};
[0052] The standby cluster node simultaneously calculates the keyword sequence correspondence g between the main cluster node and the device linkage control z ;
[0053] Step S2, the main processing flow and the backup processing flow, including:
[0054] The human-machine interface linkage control command is sent to all nodes in the active and standby clusters in a broadcast manner;
[0055] After receiving a command, all nodes in the primary and backup clusters read the execution status of the linkage operation associated with the command from Redis. If the linkage operation is currently executing, the command is discarded. If not, the associated linkage operation is filtered to determine whether it belongs to the device linkage control group that the node needs to process. If the linkage operation does not fall within the processing scope of the node, it is discarded. If it does, the primary and backup processing flow is initiated and the execution status of the linkage operation is updated in Redis.
[0056] For a device linkage control, there is only one processing flow in the active cluster and one processing flow in the standby cluster. The steps of the two processing flows are consistent.
[0057] The main processing flow receives the device's return signal to proceed to the next logical step, sends control commands to the device, and sends the device's return signal to the human-machine interface;
[0058] The standby processing flow receives the device's return signal to proceed to the next logical step, but does not send control commands to the device or send device return signals to the human-machine interface;
[0059] After the processing is completed, clear the execution status of the linkage in Redis;
[0060] Step S3: The standby cluster node automatically takes over the abnormal node processing process, including:
[0061] When a node in the active cluster exits abnormally due to operating system failure, hardware failure, or software anomaly, the active and standby cluster nodes recalculate the device linkage control group that the node needs to process. Zookeeper detects the status change of the active cluster node and sends the abnormal exit information to all cluster nodes.
[0062] The standby cluster node detects this abnormal exit information through the Zookeeper monitoring mechanism, and finds the corresponding standby processing flow according to the device linkage control group being processed by the abnormally exited master cluster node. For example, if the master node n1 is processing the device linkage control group [k1, k2, ..., k x ], the corresponding standby processing flow in the standby cluster will also be associated with the same device linkage control group [k1, k2, ..., kx ].
[0063] The backup processing flow in the standby cluster node corresponding to the abnormally exited master cluster node is upgraded to the primary processing flow, continuing to complete the remaining linkage control process until the entire linkage control task is completed. Based on the device linkage control logic, the standby cluster node generates and sends control commands to the relevant devices, receives the signals returned by the devices, performs the next logical processing based on the signals, and sends the device's response information to the human-machine interface, so that the operator can understand the current status of the device and the execution of linkage control.
[0064] The linkage process being processed in the active cluster remains in progress, and the linkage process is still being executed on the original node. After the linkage is completed, the new node calculated by the active cluster will perform the processing logic of the next cycle. The linkage process being processed in the standby cluster remains in progress, and the linkage process is still being executed on the original node of the standby cluster. After the linkage is completed, the new node calculated by the active cluster will perform the processing logic of the next cycle.
[0065] Example 2
[0066] See also Figure 1 As shown, based on the first embodiment, this embodiment provides a device linkage control system based on an active-standby cluster, which specifically includes: a redundancy design module, a device linkage module and an exception handling module.
[0067] The redundancy design module is used for the redundancy design of the main cluster node and the backup cluster node, including:
[0068] Because the node names of all nodes in the primary and standby clusters must be unique, the node names of the primary and standby cluster nodes cannot be the same. Therefore, during containerized deployment, k8s automatically assigns the node name of the container.
[0069] After the master cluster node is started, the node name of the local node is registered in the zookeeper's main directory / master; after the standby cluster node is started, the node name of the local node is registered in the zookeeper's backup directory / backup.
[0070] The master cluster node reads all node information in the master cluster from Zookeeper {n1, n2, ..., n i}, the number of nodes is i, the standby cluster node reads all the node information of the main cluster from Zookeeper {n1,n2,......,n i} and all node information in the standby cluster {m1,m2,......,m j}, the number of nodes are i and j respectively, all nodes read the same device linkage control keyword sequence {k1, k2, ..., k l}, the number of linkage controls is l.
[0071] The master cluster node sorts the node information, and then calculates the device linkage control group that each master cluster node needs to process according to the load balancing principle, that is, the correspondence between the master cluster node and the device linkage control keyword sequence g z :
[0072] g z ={n1:[k1,k2,......k x ],n2:[k x+1 ,k x+2 ,......k y ],......,n i :[k y+1 ,k y+2 ,......k l ]};
[0073] The standby cluster node sorts the node information, and then calculates the device linkage control group that each standby cluster node needs to process based on the load balancing principle, that is, the corresponding relationship between the standby cluster node and the device linkage control keyword sequence g b :
[0074] g b ={m1:[k1,k2,......k x ],m2:[k x+1 ,k x+2 ,......k y ],......,m j :[k y+1 ,k y+2 ,......k l ]};
[0075] The standby cluster node simultaneously calculates the keyword sequence correspondence g between the main cluster node and the device linkage control z ;
[0076] The device linkage module is used to start the main processing flow and the backup processing flow, including:
[0077] The human-machine interface linkage control command is sent to all nodes in the active and standby clusters in a broadcast manner;
[0078] After receiving a command, all nodes in the primary and backup clusters read the execution status of the linkage operation associated with the command from Redis. If the linkage operation is currently executing, the command is discarded. If not, the associated linkage operation is filtered to determine whether it belongs to the device linkage control group that the node needs to process. If the linkage operation does not fall within the processing scope of the node, it is discarded. If it does, the primary and backup processing flow is initiated and the execution status of the linkage operation is updated in Redis.
[0079] For a device linkage control, there is only one processing flow in the active cluster and one processing flow in the standby cluster. The steps of the two processing flows are consistent.
[0080] The main processing flow receives the device's return signal to proceed to the next logical step, sends control commands to the device, and sends the device's return signal to the human-machine interface;
[0081] The standby processing flow receives the device's return signal to proceed to the next logical step, but does not send control commands to the device or send device return signals to the human-machine interface;
[0082] After the processing is completed, clear the execution status of the linkage in Redis;
[0083] The exception handling module is used by the standby cluster node to automatically handle abnormal nodes, including:
[0084] When a node in the active cluster exits abnormally due to operating system failure, hardware failure, or software anomaly, the active and standby cluster nodes recalculate the device linkage control group that the node needs to process. Zookeeper detects the status change of the active cluster node and sends the abnormal exit information to all cluster nodes.
[0085] The standby cluster node detects this abnormal exit through the ZooKeeper monitoring mechanism and finds the corresponding standby processing flow based on the device linkage control group currently being processed by the active cluster node that exited. For example, if the active node n1 is processing the device linkage control group [k1, k2, ..., kx], the corresponding standby processing flow in the standby cluster will also be associated with the same device linkage control group [k1, k2, ..., kx].
[0086] The backup processing flow in the standby cluster node corresponding to the abnormally exited master cluster node is upgraded to the primary processing flow, continuing to complete the remaining linkage control process until the entire linkage control task is completed. Based on the device linkage control logic, the standby cluster node generates and sends control commands to the relevant devices, receives the signals returned by the devices, performs the next logical processing based on the signals, and sends the device's response information to the human-machine interface, so that the operator can understand the current status of the device and the execution of linkage control.
[0087] The linkage process being processed in the active cluster remains in progress, and the linkage process is still being executed on the original node. After the linkage is completed, the new node calculated by the active cluster will perform the processing logic of the next cycle. The linkage process being processed in the standby cluster remains in progress, and the linkage process is still being executed on the original node of the standby cluster. After the linkage is completed, the new node calculated by the active cluster will perform the processing logic of the next cycle.
Claims
1. A device linkage control method based on a master-slave cluster, characterized in that: include: The master cluster node calculates the device linkage control group that each master cluster node needs to process based on the load balancing principle; The standby cluster node calculates the device linkage control group that the standby cluster node needs to process based on the load balancing principle, and also calculates the device linkage control group that the active cluster node needs to process. The master cluster node and the backup cluster node simultaneously receive linkage control commands and process the device linkage control of the node, generating the main processing flow and backup processing flow of the linkage. The main processing flow receives the return signal from the device to perform the next logic step, send the control command to the device, and send the device return signal to the human-machine interface; The standby processing flow executes the linkage control logic but does not send control commands to the device, nor does it send device feedback to the human-machine interface; When the main cluster node that is processing the linkage control process exits abnormally, the standby cluster node detects the abnormal exit information of the main cluster node, and the standby processing flow corresponding to the main processing flow of the abnormally exited main cluster node in the standby cluster node is upgraded to the main processing flow, and the control command is sent to the device, and the device returns a signal to the human-machine interface to complete the subsequent linkage control process.
2. The device linkage control method based on the active-standby cluster according to claim 1 is characterized in that: The master cluster node and the backup cluster node computing device linkage control group include: All active and standby cluster nodes are started and their node information is registered in the ZooKeeper active and standby directories respectively; The master cluster node reads all node information in the master cluster from Zookeeper {n1, n2, ..., n i }, the number of nodes is i; the standby cluster node reads all the node information {n1,n2,......,n i }, the number of nodes is i, and all node information in the standby cluster {m1,m2,......,m j }, the number of nodes is j; all nodes read the same device linkage control keyword sequence {k1, k2, ..., k l }, the number of linkage controls is l; the master cluster node sorts the node information, and then calculates the device linkage control group that each master cluster node needs to process according to the load balancing principle, that is, the correspondence relationship between the master cluster node and the device linkage control keyword sequence g z : g z ={n1:[k1,k2,......,k x ],n2:[k x+1 ,k x+2 ,......,k y ],......,n i :[k y+1 ,k y+2 ,......,k l ]}; The standby cluster node sorts the node information, and then calculates the device linkage control group that each standby cluster node needs to process based on the load balancing principle, that is, the corresponding relationship between the standby cluster node and the device linkage control keyword sequence g b : g b ={m1:[k1,k2,......,k x ],m2:[k x+1 ,k x+2 ,......,k y ],......,m j :[k y+1 ,k y+2 ,......,k l ]}, the standby cluster node simultaneously calculates the device linkage control group that each master cluster node needs to process, that is, g z .
3. The device linkage control method based on the active-standby cluster according to claim 1 is characterized in that: The main processing flow and the backup processing flow include: The master and backup cluster nodes simultaneously receive human-machine interface linkage control commands and read the execution status of the linkage related to the command in Redis. If it is being executed, the command is discarded. Otherwise, the command is filtered to see if the linkage associated with the command is in the device linkage control group that needs to be processed by the local device. If not, the command is discarded. If so, the master-slave processing flow is generated and the execution status of the linkage is stored in Redis. After the processing flow is completed, the linkage execution status is cleared. The main processing flow receives the device's return signal to proceed to the next logical step, sends control commands to the device, and sends the device's return signal to the human-machine interface; The standby processing flow receives the device's return signal to proceed to the next logical step, but does not send control commands to the device or send device return signals to the human-machine interface; A device linkage control has one and only one processing flow in the active cluster and one and only one processing flow in the standby cluster. The steps of the two processing flows are consistent.
4. The device linkage control method based on the active-standby cluster according to claim 1 is characterized in that: The abnormal exit of the master cluster node that is processing the linkage control process includes the abnormal exit of the master cluster node due to operating system or hardware reasons; After the master cluster node exits abnormally, the master cluster node and the backup cluster node recalculate the device linkage control group that the node needs to process.
5. A device linkage control system based on a master-slave cluster, characterized in that: include: Redundant design module, the main cluster node calculates the device linkage control group that each main cluster node needs to process based on the load balancing principle; The standby cluster node calculates the device linkage control group that the standby cluster node needs to process based on the load balancing principle, and also calculates the device linkage control group that the active cluster node needs to process. The device linkage module, after receiving linkage control commands from both the master cluster node and the backup cluster node, processes the device linkage control of the node, generating the main processing flow and backup processing flow of the linkage. The main processing flow receives the return signal from the device to proceed to the next logic step, sending the control command to the device and sending the device return signal to the human-machine interface; the backup processing flow executes the linkage control logic but does not send the control command to the device or send the device return signal to the human-machine interface; The exception handling module, when the main cluster node that is processing the linkage control process exits abnormally, the standby cluster node detects the abnormal exit information of the main cluster node, and the standby processing flow corresponding to the main processing flow of the abnormally exited main cluster node in the standby cluster node is upgraded to the main processing flow, sends a control command to the device, and sends the device return signal to the human-machine interface to complete the subsequent linkage control process.
6. The device linkage control system based on the active-standby cluster according to claim 5, characterized in that: In the redundant design module, the main cluster node and the backup cluster node computing device linkage control group include: All active and standby cluster nodes are started and their node information is registered in the ZooKeeper active and standby directories respectively; The master cluster node reads all node information in the master cluster from Zookeeper {n1, n2, ..., n i }, the number of nodes is i; the standby cluster node reads all the node information in the main cluster from Zookeeper {n1,n2,......,n i }, the number of nodes is i, and all node information in the standby cluster {m1,m2,......,m j }, the number of nodes is j; all nodes read the same device linkage control keyword sequence {k1, k2, ..., k l }, the number of linkage controls is l; the master cluster node sorts the node information, and then calculates the device linkage control group that each master cluster node needs to process according to the load balancing principle, that is, the correspondence relationship between the master cluster node and the device linkage control keyword sequence g z : g z ={n1:[k1,k2,......,k x ],n2:[k x+1 ,k x+2 ,......,k y ],......,n i :[k y+1 ,k y+2 ,......,k l ]}; The standby cluster node sorts the node information, and then calculates the device linkage control group that each standby cluster node needs to process based on the load balancing principle, that is, the corresponding relationship between the standby cluster node and the device linkage control keyword sequence g b : g b ={m1:[k1,k2,......,k x ],m2:[k x+1 ,k x+2 ,......,k y ],......,m j :[k y+1 ,k y+2 ,......,k l ]}, the standby cluster node simultaneously calculates the device linkage control group that each master cluster node needs to process, that is, g z .
7. The device linkage control system based on the active-standby cluster according to claim 5, characterized in that: In the device linkage module, the main processing flow and the backup processing flow include: The master and backup cluster nodes simultaneously receive human-machine interface linkage control commands and read the execution status of the linkage related to the command in Redis. If it is being executed, the command is discarded. Otherwise, the command is filtered to see if the linkage associated with the command is in the device linkage control group that needs to be processed by the local device. If not, the command is discarded. If so, the master-slave processing flow is generated and the execution status of the linkage is stored in Redis. After the processing flow is completed, the linkage execution status is cleared. The main processing flow receives the device's return signal to proceed to the next logical step, sends control commands to the device, and sends the device's return signal to the human-machine interface; The standby processing flow receives the device's return signal to proceed to the next logical step, but does not send control commands to the device or send device return signals to the human-machine interface; A device linkage control has one and only one processing flow in the active cluster and one and only one processing flow in the standby cluster. The steps of the two processing flows are consistent.
8. The device linkage control system based on the active-standby cluster according to claim 5, characterized in that: In the exception handling module, the abnormal exit of the master cluster node that is processing the linkage control process includes the abnormal exit of the master cluster node due to operating system or hardware reasons; After the master cluster node exits abnormally, the master cluster node and the backup cluster node recalculate the device linkage control group that the node needs to process.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.