Device switching method and apparatus, electronic device, and storage medium

By monitoring the device to receive heartbeat information and select the slave device with high priority as a backup, the problem of poor system stability when the host device fails is solved, and fast and simple master-slave device switching is achieved, saving resources.

CN113297013BActive Publication Date: 2025-10-10ALIBABA GROUP HOLDING LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010340888.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-26
Publication Date
2025-10-10
Estimated Expiration
2040-04-26

AI Technical Summary

Technical Problem

In a distributed master-slave architecture system, when a host device fails, if there are insufficient slave devices, they cannot quickly switch to the host device, resulting in poor system stability and waste of device resources.

Method used

The monitoring device receives heartbeat information to determine the device status. When the master device is abnormal, the backup device is selected according to the priority of the slave device and sent a master command to switch it to the master device. At the same time, the identification of the abnormal master device is ignored to avoid switching again.

Benefits of technology

It realizes fast and simple master-slave device switching in any number of slave device systems, saves device resources, ensures system stability, and avoids waste of device resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113297013B_ABST
    Figure CN113297013B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a device switching method and device, an electronic device and a storage medium. The method comprises: receiving heartbeat information of a device, determining a device state according to the heartbeat information, wherein the device comprises a master device and a slave device; in a case where it is detected that the device state of the master device is abnormal, selecting a candidate device from the slave devices with normal device states according to priority information; and sending a master setting instruction to the candidate device, so that the candidate device switches to the master device. Device resources of the slave devices can be saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a device switching method, a device switching apparatus, an electronic device, and a storage medium. Background Art

[0002] In a distributed master-slave architecture system, there is typically a master device and multiple slave devices. The master device performs many responsibilities, while the slave devices simply cooperate and execute the master's instructions. Therefore, the master device is indispensable to the system. Due to high availability requirements, if the master device fails or the network environment it is in fails, a slave device must be upgraded to the master device to ensure normal system operation.

[0003] One switching method is: the master device and the slave device monitor each other. When the slave device finds that the master device has an abnormality, each slave device initiates a vote to select itself as the master to be switched and notifies other slave devices. The slave device that first obtains enough votes is upgraded to the master device, and the remaining slave devices become slave devices of the master device.

[0004] With this approach, voting is required when a master device experiences an anomaly. If only two slave devices are configured and one of them experiences an anomaly, the remaining healthy slave device will not receive enough votes, resulting in the slave being unable to switch to the master device and poor system stability. Therefore, for each master device, at least three slave devices must be configured, resulting in a waste of device resources. Summary of the Invention

[0005] An embodiment of the present application provides a device switching method to reduce the waste of device resources.

[0006] Correspondingly, an embodiment of the present application also provides a device switching apparatus, an electronic device and a storage medium to ensure the implementation and application of the above system.

[0007] In order to solve the above problems, an embodiment of the present application discloses a device switching method, including: receiving heartbeat information of a device, determining the device status based on the heartbeat information, wherein the device includes a master device and a slave device; when it is detected that the device status of the master device is abnormal, selecting a backup device from the slave devices with normal device status according to priority information; and sending a master command to the backup device to switch the backup device to the master device.

[0008] In order to solve the above problems, an embodiment of the present application discloses a device switching method, which is applied to a slave device, including: sending heartbeat information to a monitoring device, and the monitoring device is used to determine the device status based on the heartbeat information; in the event of a failure of the master device, receiving a master-setting instruction sent by at least one monitoring device; and switching the operating state to the operating state of the master device according to at least one master-setting instruction.

[0009] In order to solve the above problems, an embodiment of the present application discloses a device switching method, which is applied to a master device, including: sending heartbeat information to a monitoring device, and the monitoring device is used to determine the device status based on the heartbeat information; when the device status of the master device is abnormal, receiving a slave instruction sent by the monitoring device; according to the slave instruction, switching the device operating state to the operating state of the slave device.

[0010] In order to solve the above problems, an embodiment of the present application discloses a device switching device, including: an information receiving module, used to receive heartbeat information of a device, and determine the device status based on the heartbeat information, wherein the device includes a master device and a slave device; a slave device selection module, used to select a backup device from slave devices with normal device status according to priority information when detecting that the device status of the master device is abnormal; and a master processing module, used to send a master instruction to the backup device to switch the backup device to the master device.

[0011] In order to solve the above problems, an embodiment of the present application discloses a device switching device, including: a slave device information output module, used to send heartbeat information to a monitoring device, and the monitoring device is used to determine the device status based on the heartbeat information; a master information receiving module, used to receive a master instruction sent by at least one monitoring device in the event of a master device failure; and a master switching module, used to switch the operating state to the operating state of the master device according to at least one master instruction.

[0012] In order to solve the above problems, an embodiment of the present application discloses a device switching device, including: a master device information output module, used to send heartbeat information to a monitoring device, and the monitoring device is used to determine the device status based on the heartbeat information; a slave information receiving module, used to receive a slave instruction sent by the monitoring device when the device status of the master device is abnormal; and a slave switching module, used to switch the device operating state to the operating state of the slave device according to the slave instruction.

[0013] In order to solve the above problems, an embodiment of the present application discloses an electronic device, including: a processor; and a memory, on which executable code is stored. When the executable code is executed, the processor executes the method described in one or more of the above embodiments.

[0014] In order to solve the above problems, embodiments of the present application disclose one or more machine-readable media on which executable codes are stored. When the executable codes are executed, the processor executes the method described in one or more of the above embodiments.

[0015] Compared with the prior art, the embodiments of the present application include the following advantages: the slave device and the master device send heartbeat information to the monitoring device, and the monitoring device determines whether an abnormality occurs in the device status based on the heartbeat information. In the event of an abnormality in the master device, the monitoring device quickly and easily determines an alternative device from the normal slave devices according to the priority of the slave device. The monitoring device then sends a master-set instruction to the alternative device, and the alternative device switches to the master device in response to the master-set instruction to provide services. The embodiments of the present application can perform master-slave switching on a device switching system including any number of slave devices, which can save the device resources of the slave devices. In addition, there is no need for complex coordination between the monitoring devices, and the addition and removal of monitoring devices is simpler. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 This is a schematic diagram of the structure of a device switching system according to an embodiment of the present application;

[0017] Figure 2 is a structural diagram of a device switching system according to another embodiment of the present application;

[0018] Figure 3 This is a flow chart of a device switching method according to an embodiment of the present application;

[0019] Figure 4 is a flow chart of a device switching method according to another embodiment of the present application;

[0020] Figure 5 is a flow chart of a device switching method according to another embodiment of the present application;

[0021] Figure 6 is a flow chart of a device switching method according to another embodiment of the present application;

[0022] Figure 7 is a flow chart of a device switching method according to another embodiment of the present application;

[0023] Figure 8 This is a schematic structural diagram of a device switching apparatus according to an embodiment of the present application;

[0024] Figure 9 is a structural diagram of a device switching apparatus according to another embodiment of the present application;

[0025] Figure 10 This is a schematic structural diagram of a device switching apparatus according to another embodiment of the present application;

[0026] Figure 11 It is a structural diagram of an exemplary device according to an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0028] The embodiments of the present application can be applied to scenarios of device clusters including one master device and multiple slave devices, such as systems with a distributed architecture. They can also be applied to scenarios of one master device and one slave device (or backup device), such as hot backup scenarios for critical machines. Hot backup scenarios for critical machines can include: a database cluster with master and slave read-write separation, a master-slave virtual server, virtual server (Virtual Server) load balancing, hot backup of critical machines that calculate scheduling strategies in scheduling systems such as virtual machines, containers, and CDN (Content Delivery Network) traffic. The device switching system is described below using the example of applying the device switching system to a scenario with one master device and multiple slave devices.

[0029] This application provides a device switching system, such as Figure 1 As shown, the device switching system includes a master device, a slave device, and a monitoring device. The master device is used to provide services; the slave device is used to cooperate with the master device to provide services. The monitoring device can also be called a sentinel, a monitoring sentinel, etc. The monitoring device is used to monitor the operating status of the master device and the slave device. It can be regarded as a sentinel in the system to monitor the operation of other devices. Therefore, the monitoring device can collect the heartbeat information of the master device and the slave device and determine the device status of the master device and the slave device. The monitoring device can also determine the alternative device from the normal slave device according to the priority of the slave device when the master device is abnormal. Among them, the heartbeat message is a message that is sent periodically and repeatedly to notify the receiving device (such as the monitoring device in this example) that the sending source (such as the master device and slave device in this example) is operating normally. Therefore, when the heartbeat information is abnormal, it is usually possible that the device is abnormal.

[0030] After determining a backup device, the monitoring device sends a Set Master command to the backup device. In response to the Set Master command, the backup device switches its operating state to that of the master device. The new master device then returns heartbeat information to the monitoring device. Based on the heartbeat information, the monitoring device sends a Set Slave command to the previous master device. In response to the Set Slave command, the previous master device switches its operating state to that of the slave device.

[0031] In an embodiment of the present application, if a monitoring device detects an abnormality in the master device, it can more conveniently determine a backup device based on the priority information of the slave device and send a master-set command to the backup device, causing the slave device to switch to the master device. This embodiment of the present application can switch devices in a device switching system that includes any number of slave devices, thereby conserving slave device resources. Furthermore, the monitoring device does not need to configure complex coordination methods, making it easier to add or remove monitoring devices.

[0032] Specifically, such as Figure 1 As shown, in step 102, the monitoring device receives the heartbeat information of the device and determines the device status based on the heartbeat information, wherein the device includes a master device and a slave device. The heartbeat information may include a device identifier and a timestamp. The device identifier may be a host identifier that indicates that the device is a master device or a slave identifier that indicates that the device is a slave device. In an optional example, the master device and the slave device may periodically actively send heartbeat information to the monitoring device. In another optional example, the master device and the slave device may send heartbeat information to the monitoring device based on a solicitation instruction periodically sent by the monitoring device. Specifically, the step of receiving the heartbeat information of the device includes: the monitoring device sends a solicitation instruction to the device and receives heartbeat information corresponding to the solicitation instruction. The monitoring device may periodically send a solicitation instruction to the master device and the slave device, and the master device and the slave device send heartbeat information to the monitoring device in response to the solicitation instruction.

[0033] In an optional example, for a master device and a slave device, the status of the master device can be determined based on the difference between the timestamp in the heartbeat information and the current time. Specifically, the monitoring device obtains the timestamp from the heartbeat information of the device and determines the difference between the timestamp and the current time; when the difference is less than the duration threshold, the device status of the device is determined to be normal; when the difference is greater than or equal to the duration threshold, the device status of the device is determined to be abnormal.

[0034] In one optional example, to more accurately determine whether an abnormality has occurred on the master device, a test instruction may be sent to the master device to test whether an abnormality has occurred on the master device. Specifically, the device switching method further includes: after determining that the difference corresponding to the master device is greater than or equal to a duration threshold, sending a test instruction to the master device; if no feedback information corresponding to the test instruction is received within a preset duration, determining that the master device's device status is abnormal. The test instruction is sent to the master device. In response to the test instruction, the master device returns corresponding feedback information to the monitoring device. The test instruction may be a master-set instruction, and the feedback information may be feedback on whether the device has successfully switched to the master device. If the monitoring device receives the feedback information within the preset duration, the master device's device status is determined to be normal. If the monitoring device does not receive the feedback information within the preset duration, the master device's device status is determined to be abnormal. For a slave device, sending a test instruction to the slave device may also be used to determine whether the slave device is abnormal; this will not be discussed further here. This embodiment further determines whether an abnormality has occurred on the master device by sending a test instruction to the master device, thereby improving the accuracy of the abnormality determination result.

[0035] There are also some ways in the prior art to monitor the operation of master and slave devices in the system using multiple monitoring devices. However, in this way, multiple monitoring devices will monitor the master and slave devices in the system at the same time. When any monitoring device finds that the master device has an abnormality, the monitoring device needs to collect status judgment information of the master device from other monitoring devices, and judge whether the master device has an abnormality by voting. For the slave device to be switched to the master device, voting is also required. This method of using multiple monitoring devices to cooperate with each other has a complex design of the monitoring equipment, and the abnormality determination and device switching process are also relatively complex. It usually requires three or more monitoring sub-devices for the device, which will also cause a waste of device resources.

[0036] The method of the embodiment of the present application can reduce the complexity of the monitoring device. In step 104, when the monitoring device detects that the device status of the main device is abnormal, the monitoring device selects an alternative device from the slave devices with normal device status according to the priority information. The priority levels from high to low may include: first level, second level, third level, and nth level. For multiple slave devices, a priority level can be set for each slave device, and the priority level of each slave device is different. If the device status of the main device is abnormal, the monitoring device determines that the slave device with normal device status is selected, and selects the slave device with the highest priority information as the alternative device. The monitoring device can be set as one or multiple (such as Figure 2(As shown), for multiple monitoring devices, the priority information of the slave device is the same for each monitoring device. Therefore, when determining a candidate device, each monitoring device will receive the same result, eliminating the need for collaboration between different monitoring devices to determine a candidate, making the selection of candidates simpler and more convenient. This reduces the complexity of the monitoring devices and facilitates the addition and removal of monitoring devices. Furthermore, for multiple monitoring devices, a slave device can respond to a master command from a monitoring device to switch its operating state. Alternatively, a slave device can receive master commands from multiple monitoring devices and vote on them, switching states based on the voting results.

[0037] After determining the backup device, the monitoring device sends a master command to the backup device in step 106, causing it to switch to the primary device. The monitoring device sends the master command to the backup device, and the backup device responds to the master command by switching its operating state to that of the primary device. The primary device then provides services to the user.

[0038] The following describes a device switching method in detail with reference to an embodiment. The method is applied to monitoring devices, such as Figure 3 As shown, the device switching method includes the following steps:

[0039] Step 302: Determine if the master device is abnormal. First, determine the difference between the timestamp in the latest heartbeat information of the master device and the current time, and then determine if the master device's status is abnormal based on whether the difference is greater than or equal to a duration threshold.

[0040] Step 304: Send a test instruction to the master device. The test instruction may be a set master instruction. After receiving the set master instruction, the master device returns feedback information to the monitoring device.

[0041] Step 306: Determine whether feedback information is received within the preset time. If the monitoring device receives feedback information within the preset time, it means that the device status of the master device is normal, and the execution ends. If the monitoring device does not receive feedback information within the preset time, execute step 308.

[0042] Step 308: Determine whether a normal slave device exists. If so, determine the candidate device according to the priority information of the slave device and execute step 310. If not, terminate the execution.

[0043] Step 310: Send a master command to the standby device. After receiving the master command, the standby device switches its operating state to the master state in response to the master command, and returns feedback information to the monitoring device.

[0044] Step 312: Determine whether feedback information from the candidate device is received within the preset time period. If feedback information is received, the execution ends. If no feedback information is received, step 308 is executed to switch the next priority slave device to the master device.

[0045] In this embodiment, if an abnormality occurs in the master device, a test command is first sent to the master device to confirm whether an abnormality has occurred in the master device. If the device status of the master device is determined to be abnormal, a backup device can be determined from the normal slave devices more simply and quickly according to the priority of the slave device. A master-set command is then sent to the backup device, and the backup device switches to the master device in response to the master-set command to provide services. This embodiment of the present application can perform master-slave switching on a device switching system including any number of slave devices, which can save device resources of the slave devices. In addition, there is no need for complex coordination between monitoring devices, making it easier to add or remove monitoring devices.

[0046] After the alternative device is switched to the master device, the device switching system now includes two master devices, the master device before the switch and the master device after the switch. In order to switch the master device before the switch (the master device where the abnormality occurs) to a slave device, in an optional example, the heartbeat monitoring device receives the heartbeat information of the master device after the switch, and sends a slave instruction to the master device before the switch, so that the master device before the switch is switched to a slave device. The heartbeat information of the master device includes a host identifier and a timestamp. After the monitoring device receives the heartbeat information of the master device after the switch, the host identifiers of two master devices exist in the monitoring device at the same time. At this time, the slave instruction can be sent to the master device corresponding to the host identifier received earlier according to the later received host identifier. After the master device receives the slave instruction, the operating state of the device is switched to the operating state of the slave device according to the slave instruction.

[0047] Since there is a transmission time between the master device and the monitoring device, after the monitoring device sends a slave command to the master device before the switch, it may also receive the heartbeat information sent by the master device before the switch before receiving the slave command. After receiving the heartbeat information, the monitoring device will switch the master device switched from the slave device to the slave device again according to the heartbeat information. In order to avoid the problem of incorrect switching of the monitoring device due to receiving the heartbeat information of the master device before the switch, in an optional example, the monitoring device is also used to ignore the host identifier in the heartbeat information of the master device before the switch according to the heartbeat information of the master device after the switch. Specifically, the monitoring device can generate an identifier ignore instruction based on the heartbeat information of the master device after the switch. And according to the identifier ignore instruction, the host identifier of the master device before the switch is ignored. In this way, the problem of switching the master device after the switch to the slave device again is avoided, thereby ensuring the normal operation of the system.

[0048] The following describes in detail the process of switching from a master device to a slave device when an abnormality occurs, with reference to an embodiment. Figure 4 As shown, the process includes the following steps:

[0049] Step 402: Receive a second host identifier. After the standby device switches to the master device, it returns a heartbeat message to the monitoring device. This heartbeat message includes a host identifier and a timestamp. The timestamp is used to determine whether an abnormality has occurred in the switched master device. Before the abnormal master device switches to the slave device, the monitoring device stores the host identifier of the abnormal master device. Therefore, when the second host identifier is received, the monitoring device stores two host identifiers.

[0050] Step 404: Determine whether there is a flag ignore instruction in the monitoring device. If not, proceed to step 406. If so, proceed to step 408.

[0051] Step 406: Send a slave command to the master device corresponding to the first host identifier and generate an identifier ignore command. The master device that has an abnormality switches to a slave device operating state according to the slave command.

[0052] Step 408: The monitoring device ignores the host identifier in the heartbeat information of the abnormal master device according to the identifier ignoring instruction, and only records the timestamp.

[0053] In this embodiment, after the backup device is switched to the master device, a set-slave command is sent to the abnormal master device, causing it to switch to the slave device. Furthermore, by marking the ignore command to ignore the host command of the abnormal master device, the problem of the master device being switched to the slave device again after switching can be avoided, ensuring the normal operation of the system.

[0054] The above embodiments are described using an application scenario of one master device and multiple slave devices as an example. In actual processing, the embodiments of the present application can also be applied to one master device and one slave device.

[0055] Among them, existing master-slave switching methods (such as the master-slave switching algorithm using the key-value database Redis) typically deploy sentinel machines in the device. The sentinel machines of the slave devices are used to monitor the status of the master device. After a sentinel machine detects that the master device has failed, it collects the judgment of the master device's status from the sentinel machines of other slave devices. If a sufficient number of sentinel machines confirm that the master device has failed, the master device is taken offline and a master switch is performed. However, using this method, in a scenario with one master device and two slave devices in the cluster, if one of the two slave devices fails, the sentinel machine of the slave device cannot output the judgment result of the master device's status. Therefore, the other slave device cannot obtain two votes to determine that the master device has failed, and the master-slave switch cannot be completed. In addition, if a slave device determines that the master device has failed based on only one vote and takes the master device offline, it will lead to poor cluster stability. In summary, this master-slave switching method requires at least three sentinel machines. Therefore, this master-slave switching method should be applied to scenarios with one master device and at least three slave devices. This master-slave switching method cannot be applied to application scenarios with one master device and one slave device.

[0056] Some master-slave switching methods, such as those using distributed consensus cluster leader election algorithms like Paxos and Raft, typically involve the master device periodically sending status information to slave devices. If a slave device fails to receive status information within a certain period of time, it initiates a leader election vote to obtain sufficient votes and switch to the master position. For a slave device to obtain sufficient votes for a master switch, this master-slave switching method requires at least two slave devices. Therefore, this master-slave switching method is suitable for scenarios with one master and at least two slave devices, and cannot be applied to scenarios with only one master and one slave.

[0057] The embodiment of the present application can be applied to a cluster scenario with one master device and one slave device. The monitoring device can monitor the heartbeat information of the master device and the slave device, and in the event of an abnormality in the master device, the slave device can be switched to the master device according to the priority information of the slave device to provide services.

[0058] In the embodiment of the present application, when two hosts are found, the original master device is switched to a slave device, and the host identifier of the original master device is ignored once, which can avoid the problem of asynchronous timing. During the device switching process, the method of the embodiment of the present application does not require collaboration such as voting between slave devices to confirm master device failure and voting to elect a master. Therefore, in a scenario with one master device and one slave device, the method of the embodiment of the present application can switch.

[0059] Based on the above embodiments, the present application also provides a device switching method, which is applied to monitoring devices, such as Figure 5 As shown, the specific steps include:

[0060] Step 502: Receive heartbeat information of the device, where the heartbeat information includes a device identifier and a timestamp, and the device identifier includes a master identifier and a slave identifier.

[0061] Step 504: Obtain a timestamp from the heartbeat information of the device, and determine the difference between the timestamp and the current time.

[0062] Step 506: After determining that the difference value corresponding to the master device is greater than or equal to the duration threshold, send a test instruction to the master device.

[0063] Step 508: If no feedback information corresponding to the test instruction is received within the preset time period, it is determined that the device status of the master device is abnormal.

[0064] Step 510: When it is detected that the device status of the master device is abnormal, select a backup device from the slave devices with normal device status according to the priority information.

[0065] Step 512: Send a master command to the standby device to switch the standby device to the master device.

[0066] Step 514: Receive the heartbeat information of the switched master device, send a slave instruction to the previous master device, and generate a flag ignore instruction. The slave instruction is used to switch the previous master device to a slave device.

[0067] Step 516: Ignore the host identifier of the master device before the switch according to the identifier ignoring instruction.

[0068] In this embodiment, when the device status of the master device is abnormal, a test instruction is first sent to the master device to confirm whether an abnormality has occurred in the master device. And when it is determined that the device status of the master device is abnormal, according to the priority of the slave device, an alternative device can be determined from the normal slave devices more simply and quickly. Then, a master-set instruction is sent to the alternative device, and the alternative device switches to the master device in response to the master-set instruction to provide services. This embodiment can perform master-slave switching on a device switching system including any number of slave devices, which can save device resources of the slave device. In addition, there is no need for complex coordination methods between monitoring devices, and it is simpler to increase or decrease monitoring devices. After the alternative device is switched to the master device, a slave-set instruction is sent to the master device that has an abnormality, so that it is switched to a slave device. And by marking the ignore instruction to ignore the host instruction of the master device that has an abnormality, the problem of the switched master device switching to a slave device again can be avoided, thereby ensuring the normal operation of the system.

[0069] Based on the above embodiments, the present application also provides a device switching method, which is applied to a slave device, such as Figure 6As shown, the following steps are specifically included: Step 602: Send heartbeat information to the monitoring device, and the monitoring device is used to determine the device status based on the heartbeat information. Step 604: In the event of a failure of the master device, receive a master-set instruction sent by at least one monitoring device; Step 606: Switch the operating state to the operating state of the master device based on the at least one master-set instruction.

[0070] In this embodiment, the slave device and the master device send heartbeat information to the monitoring device, and the monitoring device determines whether the device status is abnormal based on the heartbeat information. In the case that the device status of the master device is abnormal, the monitoring device quickly and easily determines the backup device from the normal slave devices according to the priority of the slave devices. The monitoring device then sends a master-set instruction to the backup device, and the backup device switches to the master device in response to the master-set instruction to provide services. The embodiment of the present application can perform master-slave switching on a device switching system including any number of slave devices, which can save the device resources of the slave devices. In addition, there is no need for complex coordination between the monitoring devices, and the addition and removal of monitoring devices is simpler.

[0071] Optionally, as an embodiment, the step of switching the operating state to the operating state of the master device according to at least one set master instruction includes: voting according to at least three set master instructions, and switching the operating state to the operating state of the master device according to the voting result. If there are multiple monitoring devices, voting can be conducted according to the set master instructions of the multiple monitoring devices to obtain a voting result. If the voting result meets a preset standard, the operating state of the device is switched to the operating state of the master device.

[0072] Optionally, as an embodiment, the device switching method further includes: after completing the state switching, sending heartbeat information to the monitoring device, and the monitoring device sends a slave instruction to the master device before the switching according to the heartbeat information after the switching, so that the master device before the switching is switched to a slave device.

[0073] After a slave device is switched to a master device, the switched master device sends heartbeat information to the monitoring device. Based on the heartbeat information of the switched master device and the heartbeat information of the abnormal master device, the monitoring device sends a reset command to the abnormal master device. In response to the reset command, the master device switches its operating state to that of a slave device.

[0074] Based on the above embodiments, the present application also provides a device switching method, which is applied to a master device, such as Figure 7 As shown, the specific steps include:

[0075] Step 702: Send heartbeat information to the monitoring device, and the monitoring device is used to determine the device status based on the heartbeat information.

[0076] Step 704: When the device status of the master device is abnormal, receive a slave setting instruction sent by the monitoring device.

[0077] Step 706: According to the set slave instruction, the device operation state is switched to the slave device operation state.

[0078] In this embodiment, the slave and master devices send heartbeat information to the monitoring device. The monitoring device then determines whether a device status abnormality has occurred based on the heartbeat information. If an abnormality occurs in the master device, the monitoring device sends a slave-state instruction to the abnormal master device. In response to the slave-state instruction, the abnormal master device switches its operating state to that of a slave device, preventing the abnormal master device from providing user services.

[0079] Optionally, as an embodiment, the device switching method further includes: before receiving the slave instruction, receiving test information of the monitoring device; and returning feedback information to the monitoring device within a preset time period based on the test information.

[0080] Before confirming an anomaly on the master device, the monitoring device can send a test message to the master device to test whether the master device is anomaly. If the master device is normal, the master device can return feedback to the monitoring device within a preset time period based on the test message. If the monitoring device does not receive feedback within the preset time period, it confirms that the master device is anomaly. By testing whether the master device returns feedback within the preset time period, it can more accurately determine whether the master device is anomaly.

[0081] It should be noted that for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the order of the actions described, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.

[0082] Based on the above embodiment, this embodiment also provides a device switching device, such as Figure 8 As shown, the following modules may be included:

[0083] The information receiving module 802 is configured to receive heartbeat information of a device and determine the device status according to the heartbeat information, wherein the device includes a master device and a slave device.

[0084] The slave device selection module 804 is configured to select a candidate device from the slave devices in normal status according to the priority information when detecting that the device status of the master device is abnormal.

[0085] The master processing module 806 is configured to send a master instruction to the standby device to switch the standby device to the master device.

[0086] In summary, the slave device and the master device send heartbeat information to the monitoring device, and the monitoring device determines whether the device status is abnormal based on the heartbeat information. In the case that the device status of the master device is abnormal, the monitoring device quickly and easily determines the alternative device from the normal slave devices according to the priority of the slave device. The monitoring device then sends a master-set instruction to the alternative device, and the alternative device switches to the master device in response to the master-set instruction to provide services. The embodiment of the present application can perform master-slave switching on a device switching system including any number of slave devices, which can save the device resources of the slave devices. In addition, there is no need for complex coordination between the monitoring devices, and the addition and removal of monitoring devices is simpler.

[0087] Based on the above embodiment, this embodiment further provides a device switching apparatus, which may specifically include the following modules:

[0088] An information receiving module is used to receive heartbeat information of a device, wherein the heartbeat information includes a device identifier and a timestamp, and the device identifier includes a host identifier and a slave identifier;

[0089] The difference determination submodule is used to obtain a timestamp from the heartbeat information of the device and determine the difference between the timestamp and the current time.

[0090] The normal judgment submodule determines that the device status of the device is normal when the difference is less than the duration threshold.

[0091] The test instruction output submodule is used to send a test instruction to the main device after determining that the difference value corresponding to the main device is greater than or equal to the duration threshold.

[0092] The abnormality judgment submodule is used to determine that the device status of the main device is abnormal if no feedback information corresponding to the test instruction is received within a preset time period.

[0093] A slave device selection module is used to select a backup device from slave devices with normal device status according to priority information when detecting that the device status of the master device is abnormal;

[0094] The master processing module is used to send a master instruction to the standby device to switch the standby device to the master device.

[0095] The slave processing module is used to receive the heartbeat information of the switched master device, send a slave instruction to the master device before the switch, and generate an identification ignore instruction. The slave instruction is used to switch the master device before the switch to a slave device.

[0096] The identification ignoring module is used to ignore the host identification of the main device before switching according to the identification ignoring instruction.

[0097] In this embodiment, when an abnormality occurs in the master device, a test instruction is first sent to the master device to confirm whether an abnormality occurs in the master device. And when it is determined that the device status of the master device is abnormal, the alternative device can be determined from the normal slave devices more simply and quickly according to the priority of the slave device. Then, a master-set instruction is sent to the alternative device, and the alternative device switches to the master device in response to the master-set instruction to provide services. The embodiment of the present application can perform master-slave switching on a device switching system including any number of slave devices, which can save device resources of the slave device. In addition, there is no need for complex coordination methods between monitoring devices, and it is simpler to increase or decrease monitoring devices. After the alternative device is switched to the master device, a slave-set instruction is sent to the master device that has an abnormality, so that it is switched to a slave device. And by marking the ignore instruction to ignore the host instruction of the master device that has an abnormality, the problem of the switched master device switching to a slave device again can be avoided, thereby ensuring the normal operation of the system.

[0098] Optionally, as an embodiment, the information receiving module specifically includes:

[0099] An information collection submodule, configured to send a collection instruction to the device;

[0100] The information receiving submodule is used to receive the heartbeat information corresponding to the solicitation instruction.

[0101] Based on the above embodiment, this embodiment also provides a device switching device, such as Figure 9 As shown, the following modules may be included:

[0102] A slave device information output module 902 is configured to send heartbeat information to a monitoring device, and the monitoring device is configured to determine the device status based on the heartbeat information;

[0103] A master information receiving module 904 is configured to receive a master command sent by at least one monitoring device when a master device fails;

[0104] The master switching module 906 is configured to switch the running state to the running state of the master device according to at least one master instruction.

[0105] In summary, the slave device and the master device send heartbeat information to the monitoring device, and the monitoring device determines whether the device status is abnormal based on the heartbeat information. In the event of an abnormality in the master device, the monitoring device quickly and easily determines an alternative device from the normal slave devices according to the priority of the slave device. The monitoring device then sends a master-set instruction to the alternative device, and the alternative device switches to the master device in response to the master-set instruction to provide services. The embodiment of the present application can perform master-slave switching on a device switching system including any number of slave devices, which can save the device resources of the slave devices. In addition, there is no need for complex coordination between the monitoring devices, and the addition and removal of monitoring devices is simpler.

[0106] Optionally, as an embodiment, the master switching module 906 includes:

[0107] The voting master submodule is used to vote according to at least three master commands, so as to switch the running state to the running state of the master device according to the voting results.

[0108] Optionally, as an embodiment, the device further includes:

[0109] The information sending module is used to send heartbeat information to the monitoring device after completing the state switching. The monitoring device sends a slave instruction to the master device before the switching according to the heartbeat information after the switching, so that the master device before the switching is switched to a slave device.

[0110] Based on the above embodiment, this embodiment also provides a device switching device, such as Figure 10 As shown, the following modules may be included:

[0111] The main device information output module 1002 is used to send heartbeat information to the monitoring device, and the monitoring device is used to determine the device status according to the heartbeat information;

[0112] The slave setting information receiving module 1004 is configured to receive a slave setting instruction sent by the monitoring device when the device status of the master device is abnormal;

[0113] The set-slave switching module 1006 is configured to switch the device operation state to the slave device operation state according to the set-slave instruction.

[0114] In summary, the slave and master devices send heartbeat information to the monitoring device, which then determines whether the device status is abnormal based on the heartbeat information. If the master device's status is abnormal, the monitoring device sends a "set slave" command to the abnormal master device. In response to the "set slave" command, the abnormal master device switches its operating state to that of a slave device, preventing the abnormal master device from providing services to users.

[0115] Optionally, as an embodiment, the device further includes:

[0116] A test information receiving module, configured to receive test information of the monitoring device before receiving the set slave instruction;

[0117] The feedback information output module is used to return feedback information to the monitoring device within a preset time period based on the test information.

[0118] An embodiment of the present application further provides a non-volatile readable storage medium, which stores one or more modules (programs). When the one or more modules are applied to a device, the device can execute instructions (instructions) of each method step in the embodiment of the present application.

[0119] The present application provides one or more machine-readable media having instructions stored thereon, which, when executed by one or more processors, cause an electronic device to perform one or more of the methods described in the above embodiments. In the present application, the electronic device includes a server, a terminal device, and the like.

[0120] The embodiments of the present disclosure may be implemented as a device configured as desired using any appropriate hardware, firmware, software, or any combination thereof, and the device may include electronic devices such as a server (cluster), a terminal, etc. Figure 11 An exemplary apparatus 1100 that can be used to implement various embodiments described in this application is schematically illustrated.

[0121] For one embodiment, Figure 11 An exemplary apparatus 1100 is shown having one or more processors 1102, a control module (chip set) 1104 coupled to at least one of the processor(s) 1102, a memory 1106 coupled to the control module 1104, a non-volatile memory (NVM) / storage device 1108 coupled to the control module 1104, one or more input / output devices 1110 coupled to the control module 1104, and a network interface 1112 coupled to the control module 1104.

[0122] The processor 1102 may include one or more single-core or multi-core processors, and the processor 1102 may include any combination of general-purpose processors or dedicated processors (e.g., graphics processors, application processors, baseband processors, etc.). In some embodiments, the apparatus 1100 can serve as a server, terminal, or other device described in the embodiments of the present application.

[0123] In some embodiments, the apparatus 1100 may include one or more computer-readable media (e.g., memory 1106 or NVM / storage 1108) having instructions 1114 and one or more processors 1102 configured in conjunction with the one or more computer-readable media to execute the instructions 1114 to implement a module to perform the actions described in the present disclosure.

[0124] For one embodiment, the control module 1104 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 1102 and / or any suitable device or component in communication with the control module 1104 .

[0125] The control module 1104 may include a memory controller module to provide an interface to the memory 1106. The memory controller module may be a hardware module, a software module, and / or a firmware module.

[0126] The memory 1106 may be used, for example, to load and store data and / or instructions 1114 for the device 1100. For one embodiment, the memory 1106 may include any suitable volatile memory, such as a suitable DRAM. In some embodiments, the memory 1106 may include double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).

[0127] For one embodiment, the control module 1104 may include one or more input / output controllers to provide an interface to the NVM / storage device 1108 and the input / output device(s) 1110 .

[0128] For example, NVM / storage 1108 may be used to store data and / or instructions 1114. NVM / storage 1108 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives (HDDs), one or more compact disk (CD) drives, and / or one or more digital versatile disk (DVD) drives).

[0129] The NVM / storage device 1108 may include storage resources that are part of the device on which the apparatus 1100 is installed, or it may be accessible to the device without being part of the device. For example, the NVM / storage device 1108 may be accessed via the input / output device(s) 1110 over a network.

[0130] The input / output device(s) 1110 can provide an interface between the apparatus 1100 and any other suitable device, and can include a communication component, an audio component, a sensor component, etc. The network interface 1112 can provide an interface between the apparatus 1100 and one or more networks, and the apparatus 1100 can communicate wirelessly with one or more components of a wireless network in accordance with any of one or more wireless network standards and / or protocols, such as to access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, etc., or a combination thereof.

[0131] For one embodiment, at least one of the processor(s) 1102 can be packaged together with logic of one or more controllers of the control module 1104, such as a memory controller module. For one embodiment, at least one of the processor(s) 1102 can be packaged together with logic of one or more controllers of the control module 1104 to form a system in a package (SiP). For one embodiment, at least one of the processor(s) 1102 can be fabricated together with logic of one or more controllers of the control module 1104 on the same die. For one embodiment, at least one of the processor(s) 1102 can be fabricated together with logic of one or more controllers of the control module 1104 on the same die to form a system on a chip (SoC).

[0132] In various embodiments, the apparatus 1100 can be, but is not limited to, a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet, a netbook, etc.) an end device. In various embodiments, the apparatus 1100 can have more or less components, and / or different architectures. For example, in some embodiments, the apparatus 1100 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an application-specific integrated circuit (ASIC), and a speaker.

[0133] In various embodiments, the apparatus 1100 can be, but is not limited to, a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet, a netbook, etc.) an end device. In various embodiments, the apparatus 1100 can have more or less components, and / or different architectures. For example, in some embodiments, the apparatus 1100 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an application-specific integrated circuit (ASIC), and a speaker.

[0134] The embodiments of the present application also provide an electronic device, comprising: a processor; and a memory having stored therein executable code that, when executed, causes the processor to perform the method according to any one or more of the embodiments of the present application.

[0135] The embodiments of the present application further provide one or more machine-readable media on which executable codes are stored. When the executable codes are executed, the processor executes one or more methods described in the embodiments of the present application.

[0136] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0137] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0138] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0139] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0140] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.

[0141] Although preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic inventive concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0142] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.

[0143] The above is a detailed introduction to a device switching method, a device switching device, an electronic device and a storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A device switching method, characterized in that: Applied to a monitoring device, the monitoring device is used to monitor the operating status of a master device and a slave device, the method comprising: Receive heartbeat information of a device, the heartbeat information including a timestamp, wherein the device includes a master device and a slave device, and the heartbeat information of the master device also includes a host identifier; Determine the device status based on the difference between the timestamp in the heartbeat information and the current time; After determining that the difference value corresponding to the master device is greater than or equal to the duration threshold, sending a test instruction to the master device; If no feedback information corresponding to the test instruction is received within a preset time period, determining that the device status of the master device is abnormal; When it is detected that the device status of the master device is abnormal, a backup device is selected from the slave devices with normal device status according to the priority information; Sending a master command to the standby device to switch the standby device to the master device; Receive heartbeat information from the switched master device; Determine whether there is a flag ignore instruction in the monitoring device; If there is no flag ignore instruction, a set slave instruction is sent to the master device where the exception occurs, and a flag ignore instruction is generated; If there is an identifier ignore instruction, the host identifier in the heartbeat information of the abnormal master device is ignored according to the identifier ignore instruction, and only the timestamp is recorded.

2. The method according to claim 1, characterized in that Determining the master device status based on the difference between the timestamp in the heartbeat information and the current time includes: Obtaining a timestamp from the heartbeat information of the device, and determining a difference between the timestamp and the current time; When the difference is less than the duration threshold, determining that the device status of the device is normal; When the difference is greater than or equal to the duration threshold, it is determined that the device status of the device is abnormal.

3. The method according to claim 1, characterized in that Also includes: Receive the heartbeat information of the master device after the switch, and send a slave instruction to the master device before the switch, so that the master device before the switch is switched to the slave device.

4. The method according to claim 3, characterized in that Also includes: According to the heartbeat information of the master device after the switch, the host identifier in the heartbeat information of the master device before the switch is ignored.

5. The method according to claim 4, characterized in that The step of ignoring the host identifier in the heartbeat information of the master device before the switching based on the heartbeat information of the master device after the switching includes: Generate an identification ignore instruction based on the heartbeat information of the switched master device; According to the identification ignoring instruction, the host identification of the master device before the switching is ignored.

6. A device switching method, applied to a slave device, characterized in that: include: Sending heartbeat information to a monitoring device, the monitoring device is used to determine the device status based on the heartbeat information, the monitoring device determines the device status based on the difference between the timestamp in the heartbeat information and the current time, after determining that the difference corresponding to the master device is greater than or equal to the duration threshold, sending a test instruction to the master device, if no feedback information corresponding to the test instruction is received within a preset duration, determining that the device status of the master device is abnormal, selecting an alternative device from the slave devices with normal device status according to the priority information, and sending a master-set instruction to the alternative device to switch the alternative device to the master device; the heartbeat information also includes a host identifier, if there is no identifier ignore instruction in the monitoring device, sending a slave-set instruction to the master device where the abnormality occurs, and generating an identifier ignore instruction, if there is an identifier ignore instruction in the monitoring device, then ignoring the host identifier in the heartbeat information of the master device where the abnormality occurs according to the identifier ignore instruction, and only recording the timestamp; In the event of a failure of the master device, receiving a reset instruction sent by at least one monitoring device; According to at least one master-setting instruction, the operating state is switched to the operating state of the master device.

7. The method according to claim 6, characterized in that The switching of the operating state to the operating state of the master device according to at least one master setting instruction includes: Voting is performed according to at least three master-setting instructions, so as to switch the operating state to the operating state of the master device according to the voting result.

8. The method according to claim 6, characterized in that Also includes: After the state switching is completed, the heartbeat information is sent to the monitoring device, and the monitoring device sends a slave instruction to the master device before the switching according to the heartbeat information after the switching, so that the master device before the switching is switched to a slave device.

9. A device switching method, applied to a master device, characterized in that: include: Sending heartbeat information to a monitoring device, the monitoring device being configured to determine a device state based on the heartbeat information, the monitoring device determining the device state based on a difference between a timestamp in the heartbeat information and a current time, and after determining that the difference corresponding to the master device is greater than or equal to a duration threshold, sending a test instruction to the master device; if no feedback information corresponding to the test instruction is received within a preset duration, determining that the device state of the master device is abnormal, selecting a standby device from slave devices with normal device states according to priority information, and sending a master-set instruction to the standby device to switch the standby device to the master device; When the device state of the master device is abnormal, receiving a slave-setting instruction sent by the monitoring device, the slave-setting instruction including a slave-setting instruction generated after no identifier-ignoring instruction exists in the monitoring device, the monitoring device sending the slave-setting instruction and generating an identifier-ignoring instruction, ignoring the host identifier in the heartbeat information of the abnormal master device according to the identifier-ignoring instruction and recording only the timestamp; According to the set slave instruction, the device operation state is switched to the operation state of the slave device.

10. The method according to claim 9, characterized in that Also includes: Before receiving the set slave instruction, receiving test information of the monitoring device; Based on the test information, feedback information is returned to the monitoring device within a preset time period.

11. A device switching device, applied to a monitoring device, wherein the monitoring device is used to monitor the operating status of a master device and a slave device, characterized in that: include: An information receiving module is configured to receive heartbeat information from a device, the heartbeat information including a timestamp, wherein the device includes a master device and a slave device, and the heartbeat information of the master device also includes a host identifier; determine a device status based on a difference between the timestamp in the heartbeat information and the current time; after determining that the difference corresponding to the master device is greater than or equal to a duration threshold, send a test instruction to the master device; if no feedback information corresponding to the test instruction is received within a preset duration, determine that the device status of the master device is abnormal; A slave device selection module is used to select a backup device from slave devices with normal device status according to priority information when detecting that the device status of the master device is abnormal; The master setting processing module is used to send a master setting instruction to the backup device to switch the backup device to the master device; receive the heartbeat information of the switched master device; determine whether there is an identification ignore instruction in the monitoring device; if there is no identification ignore instruction, send a slave setting instruction to the master device where the abnormality occurs, and generate an identification ignore instruction; if there is an identification ignore instruction, ignore the host identification in the heartbeat information of the master device where the abnormality occurs according to the identification ignore instruction, and only record the timestamp.

12. A device switching device, characterized in that: include: A slave device information output module is configured to send heartbeat information to a monitoring device, the monitoring device being configured to determine a device state based on the heartbeat information, the monitoring device determining the device state based on a difference between a timestamp in the heartbeat information and a current time, and after determining that the difference corresponding to the master device is greater than or equal to a duration threshold, sending a test instruction to the master device; if no feedback information corresponding to the test instruction is received within a preset duration, determining that the device state of the master device is abnormal, selecting an alternative device from slave devices with normal device states according to priority information, and sending a set-master instruction to the alternative device to switch the alternative device to the master device; the heartbeat information also includes a host identifier; if an identifier ignore instruction does not exist in the monitoring device, sending a set-slave instruction to the master device where the abnormality occurs, and generating an identifier ignore instruction; if an identifier ignore instruction exists in the monitoring device, ignoring the host identifier in the heartbeat information of the master device where the abnormality occurs according to the identifier ignore instruction, and only recording the timestamp; A master information receiving module, configured to receive a master command sent by at least one monitoring device in the event of a master device failure; The master switching module is used to switch the operating state to the operating state of the master device according to at least one master instruction.

13. A device switching device, characterized in that: include: A master device information output module is configured to send heartbeat information to a monitoring device, the monitoring device being configured to determine a device state based on the heartbeat information. The monitoring device determines the device state based on a difference between a timestamp in the heartbeat information and a current time. After determining that the difference corresponding to the master device is greater than or equal to a duration threshold, the monitoring device sends a test instruction to the master device. If no feedback information corresponding to the test instruction is received within a preset duration, the master device is determined to be abnormal in state. A standby device is selected from slave devices with normal state according to priority information, and a master-set instruction is sent to the standby device to switch the standby device to the master device. a slave-setting information receiving module, configured to receive, when the device state of the master device is abnormal, a slave-setting instruction sent by the monitoring device, the slave-setting instruction including a slave-setting instruction generated after the absence of an identifier-ignoring instruction in the monitoring device, the monitoring device sending the slave-setting instruction and generating an identifier-ignoring instruction, ignoring the host identifier in the heartbeat information of the abnormal master device according to the identifier-ignoring instruction and recording only the timestamp; The set-slave switching module is used to switch the device operation state to the slave device operation state according to the set-slave instruction.

14. An electronic device, characterized in that: include: processor; and The memory stores executable codes thereon, and when the executable codes are executed, causes the processor to perform the method according to any one of claims 1 to 5.

15. One or more machine-readable media having executable codes stored thereon, which, when executed, cause a processor to perform the method according to any one of claims 1 to 5.

16. An electronic device, characterized in that: include: processor; and The memory stores executable codes thereon, and when the executable codes are executed, causes the processor to perform the method according to any one of claims 6 to 8.

17. One or more machine-readable media having executable codes stored thereon, which, when executed, cause a processor to perform the method according to any one of claims 6 to 8.

18. An electronic device, characterized in that: include: processor; and The memory stores executable codes thereon, and when the executable codes are executed, causes the processor to perform the method according to any one of claims 9 to 10.

19. One or more machine-readable media having executable codes stored thereon, which, when executed, cause a processor to perform the method according to any one of claims 9 to 10.

Citation Information

Patent Citations

  • Communication switching method and device, coordinating server and readable storage medium

    CN108040108A

  • Master-slave switching method and device for message server and message service system

    CN108667576A