Dual-computer system and main-standby switching method
By transmitting hardware and network signals between the primary and backup systems, the system can sense the status of the primary system in real time and trigger the backup system switchover. This solves the memory and computing resource contention problem caused by high-frequency communication in existing technologies, and achieves fast and seamless primary-backup switching, ensuring the stability and efficiency of equipment business processing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2026-03-10
AI Technical Summary
In existing master-slave failover technologies, high-frequency communication leads to competition for memory and computing resources, affecting the performance of device business processing and causing startup delays.
By transmitting hardware signal interfaces and network signal interfaces between the primary and backup systems, the status of the primary system can be sensed in real time. The switching hardware signal is used to trigger the backup system to switch over, and the status of the primary and backup systems is confirmed by the status detection network signal, thus avoiding high-frequency communication and false triggering.
It enables fast and seamless primary/backup switching, avoids competition for memory and computing resources, and ensures stable and efficient performance of device business processing.
Smart Images

Figure CN121644331A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer technology, and in particular relates to a dual-machine system and a method for switching between primary and backup systems. Background Technology
[0002] Primary / backup failover technology is mainly used in scenarios requiring stable operation, such as data centers, database services, network services, and industrial control systems. When the primary system fails, it quickly and seamlessly switches to the backup system, reducing service interruption time and ensuring system stability.
[0003] Currently, primary / standby failover primarily involves periodically transmitting heartbeat signals or conducting timed polling between the primary and standby systems to confirm each other's operational status and initiate the takeover process, with the original standby system becoming the new primary system. This method is limited by communication frequency, and initiating the failover may be delayed. While shortening the heartbeat or polling cycle can quickly detect faults in the primary system, high-frequency communication can lead to a surge in device memory usage, impacting the device's service processing performance. Summary of the Invention
[0004] This invention aims to solve at least one of the technical problems existing in the prior art. To this end, this invention proposes a dual-machine system and a primary / standby switching method, which can sense the operating status of the primary machine in real time, and trigger the standby machine to start switching in a timely manner through an efficient primary / standby communication method. At the same time, it can avoid memory and computing resource competition caused by high-frequency communication, ensuring the stability and efficiency of the device's business processing performance.
[0005] In a first aspect, this application provides a dual-machine system, comprising: The first device is equipped with a first hardware signal interface and a first network signal interface; The second device is provided with a second hardware signal interface and a second network signal interface. The first hardware signal interface is connected to the second hardware signal interface, and the first network signal interface is connected to the second network signal interface. The first hardware signal interface and the second hardware signal interface are used to transmit hardware signals, and the first network signal interface and the second network signal interface are used to transmit network signals. In the case where the first device is in the host state and the second device is in the standby state, in response to a device abnormality event occurring in the first device, the second device receives a switching hardware signal through the second hardware signal interface. The switching hardware signal is used to trigger the second device to switch to the host state. When the second device switches to the host state in response to the switching hardware signal, the first device and the second device transmit a status detection network signal, which is used to detect whether the host / standby state of the dual-machine system is abnormal.
[0006] According to the dual-machine system of this application, the switching hardware signal is transmitted through the hardware signal interface between the first device and the second device. The second device, acting as the standby device, can sense the operating status of the master device in real time. When the first device, acting as the master device, experiences an abnormal event, the standby device is promptly triggered to start the switching through an efficient master-slave communication method. Triggering the switching does not require periodic polling operations, which can avoid memory and computing resource competition caused by high-frequency communication. At the same time, the system also detects whether the master and standby status of the dual-machine system is abnormal through status detection network signals, avoiding hardware signal mis-triggers that cause the dual-machine system to be in an abnormal state, thus ensuring the stability and efficiency of the device business processing performance in the dual-machine system.
[0007] According to one embodiment of this application, the device abnormal event includes at least one of a hardware abnormal event and a software abnormal event.
[0008] According to one embodiment of this application, the hardware abnormal event includes at least one of the following: The first device suffered a hardware failure. The hardware signal interface connection between the first device and the second device is faulty; The network signal interface connection between the first device and the second device is faulty.
[0009] According to one embodiment of this application, the software anomaly event includes the operating system of the first device detecting an anomaly signal.
[0010] According to one embodiment of this application, when the first device is in a host state and the second device is in a standby state, the first device is used to send the switching hardware signal to the second device in response to the software abnormal event.
[0011] According to one embodiment of this application, the first device is further configured to send the switching hardware signal to the second device in response to user input.
[0012] According to one embodiment of this application, the state detection network signal is a heartbeat signal.
[0013] According to one embodiment of this application, when the power-on time of the first device and the second device is the same, the first device and the second device compete for primary and backup status to determine the primary and backup devices in the dual-device system.
[0014] According to one embodiment of this application, when the power-on time of the first device is earlier than the power-on time of the second device, the first device is in the host state and the second device is in the standby state.
[0015] According to one embodiment of this application, the first device and the second device are further provided with network signal interfaces for connecting to a switch. The dual-machine system provides two network protocol addresses to the network that provides access services to the switch. The network protocol addresses are dynamically mapped to the host of the dual-machine system.
[0016] Secondly, this application provides a primary / backup switching method, which is applied to a first device in a dual-machine system. The first device is provided with a first hardware signal interface and a first network signal interface. The dual-machine system also includes a second device, which is provided with a second hardware signal interface and a second network signal interface. The first hardware signal interface is connected to the second hardware signal interface, and the first network signal interface is connected to the second network signal interface. The first hardware signal interface and the second hardware signal interface are used to transmit hardware signals, and the first network signal interface and the second network signal interface are used to transmit network signals. The method includes: When the first device is in the host state and the second device is in the standby state, in response to a device abnormality event occurring in the first device, a switchover hardware signal is sent to the second device, which is used to trigger the second device to switch to the host state; The system sends a status detection network signal to the second device and receives the status detection network signal fed back by the second device. The status detection network signal is used to detect whether the primary and backup status of the dual-machine system is abnormal.
[0017] According to the primary / standby switchover method of this application, when the first device, acting as the primary device, experiences a device malfunction event, it sends a switchover hardware signal, which immediately triggers the second device, acting as the standby device, to start the switchover. Triggering the switchover does not require periodic polling operations, which can avoid memory and computing resource contention caused by high-frequency communication. At the same time, it also detects whether the primary / standby status of the dual-machine system is abnormal through status detection network signals, which prevents the dual-machine system from being in an abnormal state due to accidental hardware signal triggering, thus ensuring the stability and efficiency of the device service processing performance in the dual-machine system.
[0018] Thirdly, this application provides a primary / backup switching method, which is applied to a second device in a dual-machine system. The second device is provided with a second hardware signal interface and a second network signal interface. The dual-machine system also includes a first device, which is provided with a first hardware signal interface and a first network signal interface. The first hardware signal interface is connected to the second hardware signal interface, and the first network signal interface is connected to the second network signal interface. The first hardware signal interface and the second hardware signal interface are used to transmit hardware signals, and the first network signal interface and the second network signal interface are used to transmit network signals. The method includes: When the first device is in the master state and the second device is in the standby state, a switchover hardware signal is received in response to the first device sending a device abnormal event; In response to the switching hardware signal, the second device is switched to host mode; The system receives a status detection network signal sent by the first device and feeds back the status detection network signal to the first device. The status detection network signal is used to detect whether the primary and backup status of the dual-machine system is abnormal.
[0019] According to the primary / standby switchover method of this application, the second device, acting as the standby machine, senses the operating status of the primary machine in real time. When the primary machine experiences an abnormal event, the second device receives the switchover hardware signal and promptly triggers the standby machine to start the switchover through an efficient primary / standby communication method. Triggering the switchover does not require periodic polling operations, which can avoid memory and computing resource contention caused by high-frequency communication. At the same time, it also detects whether the primary / standby status of the dual-machine system is abnormal through status detection network signals, avoiding hardware signal mis-triggers that cause the dual-machine system to be in an abnormal state, and ensuring the stability and efficiency of the business processing performance of the devices in the dual-machine system.
[0020] Fourthly, this application provides an electronic device including 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 primary / standby switching method as described in the second or third aspect above.
[0021] Fifthly, this application provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the primary / standby switching method as described in the second or third aspect above.
[0022] Sixthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the primary / standby switching method as described in the second or third aspect above.
[0023] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0024] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which: Figure 1 This is one of the structural schematic diagrams of the dual-machine system provided in the embodiments of this application; Figure 2 This is the second schematic diagram of the dual-machine system provided in the embodiments of this application; Figure 3 This is a flowchart illustrating the working state transition of a dual-machine system provided in an embodiment of this application; Figure 4 This is a schematic diagram of the process of master-slave switching in a dual-machine system provided in an embodiment of this application; Figure 5 This is one of the flowcharts illustrating the primary / standby switching method provided in the embodiments of this application; Figure 6 This is a second flowchart illustrating the primary / standby switching method provided in the embodiments of this application; Figure 7 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application.
[0025] Figure label: First device 100, first hardware signal interface 110, first network signal interface 120 Second device 200, second hardware signal interface 210, second network signal interface 220 Switch 300. Detailed Implementation
[0026] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0027] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0028] In related technologies, there are two methods for primary / standby switchover: First, the primary and backup systems periodically send heartbeat signals to confirm each other's operating status. If the primary system stops sending heartbeats, or if the backup system fails to receive signals multiple times in a row, the backup system initiates the takeover process, and the original backup system becomes the new primary system. Secondly, the primary and backup systems periodically poll each other to check various indicators of the primary system. If the indicators or the calculation results of the indicators of the primary system meet the preset switching conditions, the primary system will automatically be downgraded to the backup system, triggering the backup system to be upgraded to the primary system.
[0029] The primary / backup switching methods in the aforementioned related technologies have a detection or polling cycle. Due to communication frequency limitations, the initiation of primary / backup switching may be delayed. Although shortening the heartbeat or polling cycle can quickly detect faults in the primary system, high-frequency communication can lead to a surge in device memory usage, affecting the device's business processing performance.
[0030] This application provides a dual-machine system that can sense the operating status of the host machine in real time. Through an efficient master-slave communication method, it can promptly trigger the standby machine to start and switch over. The judgment of the switchover triggering abandons polling and heartbeat detection, which can avoid memory and computing resource competition caused by high-frequency communication and ensure the stability and efficiency of the device's business processing performance.
[0031] The following description, in conjunction with the accompanying drawings, details the dual-machine system, master-slave switching method, electronic device, and readable storage medium provided in this application through specific embodiments and application scenarios.
[0032] like Figure 1 As shown, the dual-machine system includes a first device 100 and a second device 200.
[0033] In actual implementation, the first device 100 and the second device 200 can be electronic devices. The electronic devices mentioned in the embodiments of this application include, but are not limited to, computers, servers, industrial control computers and network devices.
[0034] The first device 100 is provided with a first hardware signal interface 110 and a first network signal interface 120, and the second device 200 is provided with a second hardware signal interface 210 and a second network signal interface 220.
[0035] The first hardware signal interface 110 is connected to the second hardware signal interface 210, and the first hardware signal interface 110 and the second hardware signal interface 210 are used to transmit hardware signals; the first network signal interface 120 is connected to the second network signal interface 220, and the first network signal interface 120 and the second network signal interface 220 are used to transmit network signals.
[0036] The first hardware signal interface 110 may include a digital signal input port (DI) and a digital signal output port (DO) on the first device 100, and the second hardware signal interface 210 may include a digital signal input port (DI) and a digital signal output port (DO) on the second device 200.
[0037] In this embodiment, the first hardware signal interface 110 is connected to the second hardware signal interface 210. The DI port and DO port can be directly connected via a serial cable. That is, a serial cable (such as RS-232 or RS-485) is used to connect the DI port of the first device 100 to the DO port of the second device 200, and a serial cable (such as RS-232 or RS-485) is used to connect the DI port of the second device 200 to the DO port of the first device 100.
[0038] It is understood that the first hardware signal interface 110 and the second hardware signal interface 210 are used to transmit hardware signals, which can be high or low level signals. For example, the first hardware signal interface 110 of the first device 100 can output high or low level signals, and the second hardware signal interface 210 of the second device 200 can detect high or low level signals.
[0039] In this embodiment, the first network signal interface 120 is connected to the second network signal interface 220, which can establish a private network between the first device 100 and the second device 200 in the dual-machine system. Through the first network signal interface 120 and the second network signal interface 220, network signals such as keep-alive heartbeat, configuration parameters, and operating data can be transmitted to achieve data synchronization between the first device 100 and the second device 200, ensure data consistency between the primary and backup devices, and prevent service fluctuations caused by data inconsistency between the primary and backup devices after the primary and backup switchover.
[0040] In actual implementation, the synchronization method between the first device 100 and the second device 200 can be triggered configuration data synchronization or periodic heartbeat and real-time data synchronization. Incremental file synchronization can also be achieved by using a file synchronization component, and the consistency of primary and backup data can be achieved through millisecond-level data synchronization and incremental file synchronization.
[0041] In this embodiment, the first device 100 and the second device 200 are provided with hardware signal interfaces and network signal interfaces, which transmit hardware signals and network signals respectively, avoiding interference between hardware signals and network signals. The hardware signal interface is used to directly transmit the switching hardware signal, and the network signal interface is used to directly build a primary and backup private network for efficient data communication and synchronization.
[0042] It should be noted that in the normal operation of the dual-machine system, one device is in the master state (i.e., the primary system) and the other device is in the standby state (i.e., the backup system). The master machine undertakes the main processing tasks of the system, while the standby machine is in standby mode and can quickly take over the processing tasks of the master machine during the master-slave switchover.
[0043] In this embodiment, when the first device 100 is in the host state and the second device 200 is in the standby state, in response to a device abnormality event occurring in the first device 100, the second device 200 receives a switching hardware signal through the second hardware signal interface 210. The switching hardware signal is used to trigger the second device 200 to switch to the host state.
[0044] Among them, the occurrence of an equipment malfunction event in the first device 100 refers to a situation in which the first device 100 does not meet the normal working conditions during operation, resulting in the normal operation or performance degradation of the first device 100.
[0045] In actual operation, when the first device 100 experiences a device malfunction, the second device 200 can receive a tripping hardware signal that triggers the tripping through the second hardware signal interface 210. In response to the tripping hardware signal, the second device 200 switches its operating state from standby state to master state.
[0046] It should be noted that the switching hardware signal received by the second hardware signal interface 210 can be a hardware signal actively sent by the first device 100 through the first hardware signal interface 110 when the first device 100 monitors an abnormal event; or it can be a signal change detected by the second hardware signal interface 210 when an abnormal event occurs.
[0047] For example, the first hardware signal interface 110 and the second hardware signal interface 210 are connected via a serial cable. When the serial cable is disconnected, the second hardware signal interface 210 will detect a change in level, from high level to low level. The second device 200 receives the machine-switching hardware signal through the second hardware signal interface 210. At this time, the first device 100 does not need to actively send out the machine-switching hardware signal.
[0048] In actual operation, after receiving the switchover hardware signal, the second device 200 responds in milliseconds. The second device 200 first determines whether it is in standby mode. If it is in standby mode, it responds to the switchover hardware signal and switches to master mode to take over the tasks to be processed by the master in the dual-machine system. If it is already in master mode, it does not respond to the switchover hardware signal.
[0049] In this embodiment, based on the private network topology of the first device 100 and the second device 200 (the first network signal interface 120 and the second network signal interface 220 are connected), a hardware signal transmission link (the first hardware signal interface 110 and the second hardware signal interface 210 are connected) is added, so that the second device 200 can perceive the host's operating status in real time. Whether it is the switching hardware signal actively sent by the first device 100 or the switching hardware signal recognized by the second device 200, it is a triggered master-slave switchover scheme. The hardware signal triggers the standby device to start the switching, which can achieve millisecond-level response. The processing logic does not have periodic polling operations, which can avoid memory and computing resource competition caused by high-frequency communication and ensure the stability and efficiency of the device's business processing performance.
[0050] In this embodiment, when the second device 200 switches to the host state in response to the switching hardware signal, the first device 100 and the second device 200 transmit a status detection network signal.
[0051] Among them, the status detection network signal is used to detect whether the primary and backup status of the dual-machine system is abnormal.
[0052] It should be noted that after the second device 200 receives and responds to the switchover hardware signal, the first device 100 sends a status detection network signal to the second device 200 through the first network signal interface 120. The second device 200 receives the status detection network signal and sends a status detection network signal to the first device 100 through the second network signal interface 220. Through the status detection network signal transmitted between the first device 100 and the second device 200, the system detects whether the primary and backup status of the dual-machine system is abnormal, that is, whether the dual-machine system is in a primary and backup operating state, thus ensuring the stable switching and normal operation of the dual-machine system.
[0053] In actual implementation, by detecting network signals, it is possible to determine whether the second device 200 has been mistakenly disconnected. When a mistaken disconnection occurs, it can be corrected in time to reduce the impact on the device's service processing performance.
[0054] In some embodiments, the state detection network signal can be a heartbeat signal.
[0055] In this embodiment, when the second device 200 switches to the host state in response to the switching hardware signal, the first device 100 and the second device 200 transmit a heartbeat signal. The heartbeat signal may include the current status information of the device (host state / standby state). The heartbeat is used to detect whether the dual-machine system is in a one-host-one-standby operating state.
[0056] For example, after the second device 200 switches to the host state, it sends a heartbeat signal to the first device 100 to indicate that it is in normal operation. The second device 200 can also receive the heartbeat signal sent by the first device 100 to confirm whether the first device 100 is running as a backup in the dual-machine system.
[0057] Understandably, heartbeat signals can also include information such as timestamps (to detect whether the signal has expired) and resource usage.
[0058] In this embodiment, a switching hardware signal is transmitted via a hardware signal interface. When the first device 100 is in the master state and the second device 200 is in the standby state, if the first device 100 experiences a device malfunction, the second device 200, acting as the standby device, can sense the operating status of the master in the dual-machine system in real time. Utilizing the extremely fast transmission speed of the hardware signal, it can promptly trigger a master-slave switchover, ensuring a rapid and seamless switchover to the standby system when the master system fails, thereby reducing service interruption time. After the second device 200 responds to the switching hardware signal and switches to the master state, it detects the master-slave status of the dual-machine system through a status detection network signal, avoiding accidental triggering of the hardware signal that would cause the dual-machine system to be in an abnormal state, thus reducing the adverse effects of accidental triggering. The dual-machine system, through a strategy of hard switching first (i.e., hardware signal) and soft switching as a fallback (i.e., network signal), senses the master's operating status in real time and promptly triggers the standby device to start the switchover, further reducing the adverse effects of accidental triggering.
[0059] According to the dual-machine system provided in the embodiments of this application, the switching hardware signal is transmitted through the hardware signal interface between the first device 100 and the second device 200. The second device 200, acting as the standby device, can sense the operating status of the host in real time. When the first device 100, acting as the host, experiences a device abnormality event, the standby device is promptly triggered to start switching through an efficient master-slave communication method. Triggering switching does not require periodic polling operations, which can avoid memory and computing resource competition caused by high-frequency communication. At the same time, the system also detects whether the master and standby status of the dual-machine system is abnormal through status detection network signals, avoiding hardware signal mis-triggers that cause the dual-machine system to be in an abnormal state, thus ensuring the stability and efficiency of the device business processing performance in the dual-machine system.
[0060] In some embodiments, a device malfunction event includes at least one of a hardware malfunction event and a software malfunction event.
[0061] Hardware anomalies refer to malfunctions or abnormalities in the physical components or hardware systems of a device, such as component damage, disconnection, power failure, thermal runaway, etc.
[0062] Software anomalies refer to malfunctions or abnormalities in a device's software system or application, such as system failures, application errors, virus infections, and configuration errors.
[0063] In this embodiment, regardless of whether a hardware or software malfunction occurs, the first device 100, acting as the host, first triggers the second device 200 to quickly switch over via a hardware switching signal. Then, it detects whether the master / standby status of the dual-machine system is abnormal via network signals to confirm the correct execution of the hardware signal-triggered switching.
[0064] In some embodiments, hardware anomaly events include at least one of the following: Hardware failure of the first device 100; The hardware signal interface connection between the first device 100 and the second device 200 is faulty; The network signal interface connection between the first device 100 and the second device 200 is faulty.
[0065] In actual implementation, hardware failures of the first device 100 may include damage to device components, power outages, processor overheating, etc.
[0066] The hardware signal interface connection failure between the first device 100 and the second device 200 may refer to the disconnection of the serial cable between the first hardware signal interface 110 and the second hardware signal interface 210.
[0067] For example, the first hardware signal interface 110 and the second hardware signal interface 210 are connected via a serial cable. When the serial cable is disconnected, the second hardware signal interface 210 will detect a change in level, from high level to low level, and the second device 200 will receive the machine switching hardware signal through the second hardware signal interface 210.
[0068] A network signal interface connection failure between the first device 100 and the second device 200 may refer to a disconnection between the first network signal interface 120 and the second network signal interface 220.
[0069] For example, if the connection between the first network signal interface 120 and the second network signal interface 220 is broken, the first device 100, acting as the host, cannot transmit network signals with the second device 200. The first device 100 sends a machine-switching hardware signal to the second device 200 through the first hardware signal interface 110, and the second device 200 receives the machine-switching hardware signal through the second hardware signal interface 210.
[0070] In some embodiments, a software anomaly event may include the operating system of the first device 100 detecting an anomaly signal.
[0071] Among them, the operating system detecting an abnormal signal means that during the operation of the operating system, the kernel mechanism detects an abnormal situation affecting the operation of the device and notifies the relevant process or the system itself through the signal mechanism.
[0072] Taking the first device 100 as an example, which uses Linux as its operating system.
[0073] In Linux systems, when an abnormal situation occurs that affects the operation of a device, the kernel or a process will send a signal. This is a software interrupt mechanism used to asynchronously notify the occurrence of abnormal events such as system calls, user interrupts, and software failures. After the signal is generated, the operating system will actively handle it and record the context information related to the exception.
[0074] In some embodiments, when the first device 100 is in host mode and the second device 200 is in standby mode, the first device 100 is used to send a switchover hardware signal to the second device 200 in response to a software exception event.
[0075] In this embodiment, when a software abnormality event occurs in the first device 100, the first device 100 actively sends a switching hardware signal to the second device 200, triggering the second device 200, which is the standby device, to perform a primary / standby switchover.
[0076] Taking the first device 100 as an example, which uses Linux as its operating system.
[0077] In this embodiment, when an abnormal situation occurs in the Linux system that affects the operation of the device, the Linux system detects the abnormal signal, and the first device 100 actively sends a switchover hardware signal to trigger the second device 200, which is the standby device, to perform a primary-standby switchover. Compared with the related technologies that rely on the loss of the primary and standby heartbeats to trigger the switchover, the mechanism of triggering the primary-standby switchover based on the signal of the software abnormal event in this embodiment can identify the host failure and perform the switchover process more quickly, shorten the primary-standby switchover interval, and improve the overall stability of the dual-machine system.
[0078] In this embodiment, on the hardware side, when the first device 100 experiences a hardware malfunction, the second device 200 receives and responds to the switchover hardware signal, ensuring that the hot standby can take over the work in a timely manner when a hardware failure occurs in the dual-machine system, avoiding service interruption caused by a single point of failure. On the software side, the operating system identifies software malfunction events, such as instruction malfunctions, illegal address access, and abnormal exits. After the host machine identifies the malfunction, it actively notifies the standby machine to trigger a rapid switchover, triggering the primary / standby switchover with the help of the device's own health monitoring function. Regardless of whether it is a hardware or software malfunction, the rapid switchover is prioritized through hardware signals, and then the primary / standby status is detected through network signals to confirm the correct execution of the switchover.
[0079] In some embodiments, the first device 100 is further configured to send a switching hardware signal to the second device 200 in response to user input.
[0080] When the first device 100 is in the host state and the second device 200 is in the standby state, the user input is used to instruct the second device 200 to switch to the host state and to instruct the first device 100 to switch to the standby state.
[0081] In practice, user input can include touch operation, click operation, physical button input, and voice input.
[0082] For example, when a user clicks on a web page, the first device 100 receives the user input and, in response, sends a switching hardware signal to the second device 200 to trigger the second device 200 to switch to the host state. The first device 100 will also control itself to switch to the standby state.
[0083] Of course, in other embodiments, the first input may also be in other forms, including but not limited to character input, etc., which can be determined according to actual needs, and this application embodiment does not limit it.
[0084] In some embodiments, when the power-on time of the first device 100 and the second device 200 is the same, the first device 100 and the second device 200 compete for primary and backup status to determine the primary and backup devices in the dual-device system.
[0085] In this embodiment, the first device 100 and the second device 200 are powered on simultaneously. The first device 100 and the second device 200 distinguish which device is the master and which device is the backup through master-slave competition.
[0086] In some embodiments, when the power-on time of the first device 100 is earlier than the power-on time of the second device 200, the first device 100 is in the host state and the second device 200 is in the standby state.
[0087] In this embodiment, the power-on time of the first device 100 is earlier than the power-on time of the second device 200. In the dual-machine system, the device that powers on first takes priority as the master, and the device that powers on later operates as the standby machine.
[0088] Understandably, a dual-machine system consists of two devices: one as the primary machine and the other as the standby machine. The two machines are in hot standby mode, and the primary and standby machines maintain their connection through heartbeats. The operating data of the primary machine is synchronized to the standby machine in real time, and the configuration of the primary machine is also synchronized to the standby machine to ensure data consistency between the primary and standby machines and prevent business disruptions caused by data inconsistency after a switchover.
[0089] The dual-machine system in this application embodiment can adopt a dual-machine dual-network topology.
[0090] In some embodiments, the first device 100 and the second device 200 are further provided with network signal interfaces for connecting to the switch 300. The dual-machine system provides two network protocol addresses to the network that provides access services to the switch 300, and the network protocol addresses are dynamically mapped to the host of the dual-machine system.
[0091] like Figure 2 As shown, the first device 100 and the second device 200 are connected to the switch 300 to build a two-layer protection system of device redundancy (first device 100 and second device 200) and network redundancy (providing two network protocol addresses to the outside world) in the dual-machine system.
[0092] It is understandable that the network signal interface of the first device 100 connecting to the switch 300 is a network signal interface other than the first network signal interface 120, and the network signal interface of the second device 200 connecting to the switch 300 is a network signal interface other than the second network signal interface 220.
[0093] In practice, the virtual network protocol address (IP) can be dynamically shifted to enable the dual-machine system to provide two network protocol addresses to the network (the network outside the dual-machine system's private network) that provides access services to the switch 300.
[0094] For example, in a dual-machine system, network A provides one IP address to the outside world, and network B provides one IP address to the outside world. The first device 100 has two network signal interfaces that connect to network A and network B respectively, and the second device 200 has two network signal interfaces that connect to network A and network B respectively. Through virtual IP dynamic migration, the IP address of the dual-machine system migrates to the host machine, providing one IP address to network A and network B respectively. Networks outside the dual-machine system's private network are unaware of the existence of the host and backup machines in the dual-machine system. Network maintenance is simple, and the dual-machine system has high reliability.
[0095] The following is a specific example.
[0096] The dual-device system includes a first device 100 and a second device 200. The first device 100 is provided with a first hardware signal interface 110 and a first network signal interface 120. The second device 200 is provided with a second hardware signal interface 210 and a second network signal interface 220. The first hardware signal interface 110 is connected to the second hardware signal interface 210, and the first network signal interface 120 is connected to the second network signal interface 220. The first hardware signal interface 110 and the second hardware signal interface 210 are used to transmit hardware signals, and the first network signal interface 120 and the second network signal interface 220 are used to transmit network signals.
[0097] like Figure 3As shown, in the initial state of the dual-machine system, both the first device 100 and the second device 200 are in standby mode. The first device 100 and the second device 200 are powered on at the same time and compete for master and standby status. The dual-machine system enters normal working state 1, in which the first device 100 is in master mode and the second device 200 is in standby mode.
[0098] In this embodiment, when the first device 100 experiences a hardware or software malfunction, the second device 200 receives a switching hardware signal through the second hardware signal interface 210 and performs a master-slave switch. In response to the switching hardware signal, the second device 200 switches to the master state, and the dual-machine system enters the normal working state 2. The first device 100 is in the standby state, and the second device 200 is in the master state.
[0099] For example, if the first device 100 loses power, the second hardware signal interface 210 of the second device 200 senses the change in level. The second device 200 switches to the host state in response to the switchover hardware signal of the level change. After the first device 100 is repaired and powered on again, the first device 100 will run as the backup in the dual-machine system.
[0100] When a network anomaly occurs between the first device 100 and the second device 200, such as a disconnected network cable or a faulty network card, the first device 100, acting as a backup device, can receive a switchover hardware signal. In response to the switchover hardware signal, the first device 100 switches to the host state, and the dual-machine system enters a fault state, with both the first device 100 and the second device 200 in the host state.
[0101] Understandably, when the network between the first device 100 and the second device 200 is abnormal, the master device cannot send instructions to the standby device, and the master and standby devices cannot maintain data consistency. Both the first device 100 and the second device 200 are in master mode, which can ensure the normal operation of the first device 100 and the second device 200. After communication is restored, the dual-machine system will re-enter the normal working state of one master and one standby.
[0102] like Figure 4 As shown, hardware failure, software failure, and manual switching can all trigger rapid standby switching. When the host experiences hardware failure events such as power failure, disconnection of I / O connection cable, or network card malfunction, the standby can receive the hardware I / O signal that triggers the switching (i.e., the switching hardware signal).
[0103] If the host experiences a service freeze or other abnormality such as data acquisition or forwarding, or if the host experiences signal abnormalities such as command, memory, or address abnormalities, or if the host experiences device or process restart abnormalities, it can send hardware I / O signals to the standby host to trigger the standby host to switch over.
[0104] In practice, the primary / backup switch can also be triggered via a web page.
[0105] In this embodiment, when the first device 100 experiences a hardware or software malfunction, the second device 200 receives and responds to the switching hardware signal, performs a rapid switching through the hardware signal, and then performs erroneous switching detection through the software signal (i.e., the status detection network signal) to confirm that the switching was executed correctly.
[0106] This application also provides a primary / backup switching method, which is applied to the first device 100 of the aforementioned dual-machine system.
[0107] The dual-machine system includes a first device 100 and a second device 200. The first device 100 is provided with a first hardware signal interface 110 and a first network signal interface 120. The second device 200 is provided with a second hardware signal interface 210 and a second network signal interface 220. The first hardware signal interface 110 is connected to the second hardware signal interface 210, and the first network signal interface 120 is connected to the second network signal interface 220. The first hardware signal interface 110 and the second hardware signal interface 210 are used to transmit hardware signals, and the first network signal interface 120 and the second network signal interface 220 are used to transmit network signals.
[0108] like Figure 5 As shown, the primary / standby switching method includes steps 510 and 520.
[0109] Step 510: When the first device 100 is in the host state and the second device 200 is in the standby state, in response to a device abnormality event occurring in the first device 100, a switchover hardware signal is sent to the second device 200.
[0110] The switching hardware signal is used to trigger the second device 200 to switch to the host state.
[0111] In this embodiment, when the first device 100, acting as the host, experiences a hardware or software malfunction, it sends a switching hardware signal to the second device 200, which triggers the second device 200 to quickly switch off.
[0112] Step 520: Send a status detection network signal to the second device 200 and receive a status detection network signal fed back by the second device 200.
[0113] Among them, the status detection network signal is used to detect whether the primary and backup status of the dual-machine system is abnormal.
[0114] In actual operation, the first device 100 sends a status detection network signal to the second device 200 through the first network signal interface 120. The second device 200 receives the status detection network signal and feeds back the status detection network signal to the first device 100 through the second network signal interface 220. Through the status detection network signal transmitted between the first device 100 and the second device 200, the system detects whether the primary and backup status of the dual-machine system is abnormal, that is, whether the dual-machine system is in a primary and backup operating state, thus ensuring the stable switching and normal operation of the dual-machine system.
[0115] According to the primary / standby switching method provided in the embodiments of this application, when the first device 100, acting as the primary device, experiences a device malfunction event, it sends a switching hardware signal to immediately trigger the second device 200, acting as the standby device, to start the switching. Triggering the switching does not require periodic polling operations, which can avoid memory and computing resource contention caused by high-frequency communication. At the same time, it also detects whether the primary / standby status of the dual-machine system is abnormal through status detection network signals, avoiding hardware signal mis-triggers that cause the dual-machine system to be in an abnormal state, and ensuring the stability and efficiency of the device service processing performance in the dual-machine system.
[0116] This application also provides a primary / backup switching method, which is applied to the second device 200 of the aforementioned dual-machine system.
[0117] The dual-machine system includes a first device 100 and a second device 200. The first device 100 is provided with a first hardware signal interface 110 and a first network signal interface 120. The second device 200 is provided with a second hardware signal interface 210 and a second network signal interface 220. The first hardware signal interface 110 is connected to the second hardware signal interface 210, and the first network signal interface 120 is connected to the second network signal interface 220. The first hardware signal interface 110 and the second hardware signal interface 210 are used to transmit hardware signals, and the first network signal interface 120 and the second network signal interface 220 are used to transmit network signals.
[0118] like Figure 6 As shown, the primary / standby switching method includes steps 610, 620, and 630.
[0119] Step 610: When the first device 100 is in the host state and the second device 200 is in the standby state, a switchover hardware signal is received in response to the first device 100 sending a device abnormality event.
[0120] In this embodiment, the switching hardware signal received by the second hardware signal interface 210 may be a hardware signal actively sent by the first device 100 through the first hardware signal interface 110 when the first device 100 monitors an abnormal device event; or it may be a signal change detected by the second hardware signal interface 210 when an abnormal device event occurs.
[0121] For example, the first hardware signal interface 110 and the second hardware signal interface 210 are connected via a serial cable. When the serial cable is disconnected, the second hardware signal interface 210 will detect a change in level, from high level to low level, and the second device 200 will receive the machine switching hardware signal through the second hardware signal interface 210.
[0122] Step 620: In response to the switching hardware signal, switch the second device 200 to the host state.
[0123] In this step, the second device 200 switches from standby mode to master mode in response to the switchover hardware signal.
[0124] Step 630: Receive the status detection network signal sent by the first device 100 and send the status detection network signal back to the first device 100.
[0125] Among them, the status detection network signal is used to detect whether the primary and backup status of the dual-machine system is abnormal.
[0126] In actual operation, the first device 100 sends a status detection network signal to the second device 200 through the first network signal interface 120. The second device 200 receives the status detection network signal and feeds back the status detection network signal to the first device 100 through the second network signal interface 220. Through the status detection network signal transmitted between the first device 100 and the second device 200, the system detects whether the primary and backup status of the dual-machine system is abnormal, that is, whether the dual-machine system is in a primary and backup operating state, thus ensuring the stable switching and normal operation of the dual-machine system.
[0127] According to the primary / standby switching method provided in the embodiments of this application, the second device 200, acting as a standby machine, senses the operating status of the primary machine in real time. When the first device 100, acting as the primary machine, experiences a device malfunction, the second device 200 receives a switching hardware signal. Through an efficient primary / standby communication method, the standby machine is promptly triggered to start the switching. Triggering the switching does not require periodic polling operations, which can avoid memory and computing resource contention caused by high-frequency communication. At the same time, the primary / standby status of the dual-machine system is detected by a status detection network signal to prevent hardware signals from being mistakenly triggered, causing the dual-machine system to be in an abnormal state, thus ensuring the stability and efficiency of the device business processing performance in the dual-machine system.
[0128] In some embodiments, such as Figure 7 As shown, this application embodiment also provides an electronic device 700, including a processor 701, a memory 702, and a computer program stored in the memory 702 and executable on the processor 701. When the program is executed by the processor 701, it implements the various processes of the above-described primary / backup switching method embodiment and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0129] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0130] This application also provides a non-transitory computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described primary / backup switching method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0131] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0132] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described primary / standby switching method.
[0133] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0134] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described primary / standby switching method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0135] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0136] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0137] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the related technology, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0138] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
[0139] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0140] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.
Claims
1. A dual machine system, characterized by, The application relates to a dual-computer system, comprising: a first device provided with a first hardware signal interface and a first network signal interface; a second device provided with a second hardware signal interface and a second network signal interface, the first hardware signal interface being connected with the second hardware signal interface, the first network signal interface being connected with the second network signal interface, the first hardware signal interface and the second hardware signal interface being used for transmitting hardware signals, and the first network signal interface and the second network signal interface being used for transmitting network signals; wherein, when the first device is in a master state and the second device is in a backup state, in response to a device abnormal event occurring in the first device, the second device receives a switchover hardware signal through the second hardware signal interface, the switchover hardware signal being used for triggering the second device to switch to a master state; when the second device switches to the master state in response to the switchover hardware signal, a state detection network signal is transmitted between the first device and the second device, the state detection network signal being used for detecting whether the master-backup state of the dual-computer system is abnormal.
2. The dual system according to claim 1, characterized in that The device abnormal event comprises at least one of a hardware abnormal event and a software abnormal event.
3. The dual system of claim 2, wherein, The hardware abnormal event comprises at least one of the following: hardware failure of the first device; hardware signal interface connection failure of the first device and the second device; network signal interface connection failure of the first device and the second device.
4. The dual system of claim 2, wherein, The software abnormal event comprises an abnormal signal detected by an operating system of the first device.
5. The dual system of claim 2, wherein, When the first device is in the master state and the second device is in the backup state, the first device is used for sending the switchover hardware signal to the second device in response to the software abnormal event.
6. The dual system according to any one of claims 1 to 5, characterized in that The first device is further used for sending the switchover hardware signal to the second device in response to user input.
7. The dual system according to any one of claims 1 to 5, wherein The state detection network signal is a heartbeat signal.
8. The dual system according to any one of claims 1 to 5, wherein When the power-on time of the first device and the second device is the same, the first device and the second device compete for a master and a backup to determine the master and the backup in the dual-computer system.
9. The dual system according to any one of claims 1 to 5, wherein When the power-on time of the first device is earlier than that of the second device, the first device is in the master state and the second device is in the backup state.
10. The dual system according to any one of claims 1 to 5, wherein The first device and the second device are further provided with network signal interfaces used for connecting a switch, the dual-computer system provides two network protocol addresses for a network provided by the switch with access services, and the network protocol addresses are dynamically mapped to the master of the dual-computer system.
11. A method for master-backup switchover, characterized in that, The method is applied to a first device of a dual-machine system, the first device is provided with a first hardware signal interface and a first network signal interface, the dual-machine system further includes a second device, the second device is provided with a second hardware signal interface and a second network signal interface, the first hardware signal interface is connected with the second hardware signal interface, the first network signal interface is connected with the second network signal interface, the first hardware signal interface and the second hardware signal interface are used for transmitting hardware signals, and the first network signal interface and the second network signal interface are used for transmitting network signals. The method comprises: In a case that the first device is in a master state and the second device is in a backup state, a machine switching hardware signal is sent to the second device in response to a device abnormal event of the first device, the machine switching hardware signal is used for triggering the second device to switch to a master state; A state detection network signal is sent to the second device, and the state detection network signal fed back by the second device is received, the state detection network signal is used for detecting whether the master-backup state of the dual-machine system is abnormal.
12. A method for master-backup switchover, characterized in that, The method is applied to a second device of a dual-machine system, the second device is provided with a second hardware signal interface and a second network signal interface, the dual-machine system further includes a first device, the first device is provided with a first hardware signal interface and a first network signal interface, the first hardware signal interface is connected with the second hardware signal interface, the first network signal interface is connected with the second network signal interface, the first hardware signal interface and the second hardware signal interface are used for transmitting hardware signals, and the first network signal interface and the second network signal interface are used for transmitting network signals. The method comprises: In a case that the first device is in a master state and the second device is in a backup state, a machine switching hardware signal is sent to the second device in response to a device abnormal event of the first device, the machine switching hardware signal is used for triggering the second device to switch to a master state; A state detection network signal is sent to the second device, and the state detection network signal fed back by the second device is received, the state detection network signal is used for detecting whether the master-backup state of the dual-machine system is abnormal. The method is applied to a second device of a dual-machine system, the second device is provided with a second hardware signal interface and a second network signal interface, the dual-machine system further includes a first device, the first device is provided with a first hardware signal interface and a first network signal interface, the first hardware signal interface is connected with the second hardware signal interface, the first network signal interface is connected with the second network signal interface, the first hardware signal interface and the second hardware signal interface are used for transmitting hardware signals, and the first network signal interface and the second network signal interface are used for transmitting network signals. The method comprises: In a case that the first device is in a master state and the second device is in a backup state, a machine switching hardware signal is sent to the second device in response to a device abnormal event of the first device, the machine switching hardware signal is used for triggering the second device to switch to a master state; A state detection network signal is sent to the second device, and the state detection network signal fed back by the second device is received, the state detection network signal is used for detecting whether the master-backup state of the dual-machine system is abnormal.