CN110971462A - Equipment switching method, device, equipment and storage medium - Google Patents

Equipment switching method, device, equipment and storage medium Download PDF

Info

Publication number
CN110971462A
CN110971462A CN201911251228.7A CN201911251228A CN110971462A CN 110971462 A CN110971462 A CN 110971462A CN 201911251228 A CN201911251228 A CN 201911251228A CN 110971462 A CN110971462 A CN 110971462A
Authority
CN
China
Prior art keywords
local
equipment
fault
state
state information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911251228.7A
Other languages
Chinese (zh)
Inventor
陈立朋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sangfor Technologies Co Ltd
Original Assignee
Sangfor Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sangfor Technologies Co Ltd filed Critical Sangfor Technologies Co Ltd
Priority to CN201911251228.7A priority Critical patent/CN110971462A/en
Publication of CN110971462A publication Critical patent/CN110971462A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0681Configuration of triggering conditions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0663Performing the actions predefined by failover planning, e.g. switching to standby network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/22Alternate routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/58Association of routers
    • H04L45/586Association of routers of virtual routers

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a method, a device, equipment and a storage medium for switching equipment, wherein the method comprises the following steps: acquiring local state information of local equipment and opposite end state information transmitted by opposite end equipment with a main-standby corresponding relation with the local equipment; judging whether a switching condition is met or not according to the local state information and the opposite end state information; if the switching condition is met, switching the local identity state of the local equipment into the identity state of the opposite terminal equipment so as to execute the operation logic of the opposite terminal equipment; and if the switching condition is not met, continuously executing the running logic corresponding to the local identity state. The method can adopt corresponding equipment switching measures aiming at the condition of double-machine uniform fault, thereby relatively ensuring the overall reliability of the network after the network equipment is switched under the double-machine hot standby scene. In addition, the application also provides a device switching device, a device and a storage medium, and the beneficial effects are as described above.

Description

Equipment switching method, device, equipment and storage medium
Technical Field
The present application relates to the field of computers, and in particular, to a device switching method, apparatus, device, and storage medium.
Background
The Virtual Router Redundancy Protocol (VRRP Protocol) is a selection Protocol, and can dynamically allocate responsibility of a Virtual Router to one of the VRRP routers on the local area network, thereby providing a dynamic failure selection mechanism.
The VRRP protocol is generally applied to a dual-computer hot standby scenario in which two network devices are deployed at the same time and perform hot standby, in this scenario, the two network devices belong to the same VRRP protocol group, and only one network device is in a host state at the same time and is used for forwarding a network data packet, while the other network device is in a standby state, and once the network device that forwards the network data packet fails, the standby state is switched to the host state to take over the network to continue forwarding the data packet. In the current dual-computer hot-standby scenario, there may be a case where both network devices fail, but in the current device switching mechanism, the occurrence of the dual-computer failure cannot be known, and then corresponding device switching measures cannot be taken for the dual-computer failure, so that it is difficult to ensure the overall reliability of the network after the network device is switched in the dual-computer hot-standby scenario.
Therefore, it is a problem to be solved by those skilled in the art to provide a device switching method to relatively ensure the overall reliability of a network after network device switching is performed in a dual-device hot standby scenario.
Disclosure of Invention
The present application aims to provide a device switching method, apparatus, device and storage medium, so as to relatively ensure the overall reliability of a network after network device switching is performed in a dual-computer hot standby scenario.
In order to solve the above technical problem, the present application provides an apparatus switching method, including:
acquiring local state information of local equipment and opposite end state information transmitted by opposite end equipment with a main-standby corresponding relation with the local equipment;
judging whether a switching condition is met or not according to the local state information and the opposite end state information;
if the switching condition is met, switching the local identity state of the local equipment into the identity state of the opposite terminal equipment so as to execute the operation logic of the opposite terminal equipment;
and if the switching condition is not met, continuously executing the running logic corresponding to the local identity state.
Preferably, when the local identity state is the host state, determining whether the switching condition is satisfied according to the local state information and the peer state information includes:
judging whether the local equipment has a fault according to the local state information;
if the local equipment has a fault, judging whether the opposite terminal equipment has the fault according to the opposite terminal state information;
if the opposite terminal equipment has faults, judging that the local equipment does not meet the switching condition;
if the opposite terminal equipment has no fault, judging that the local equipment meets the switching condition;
and if the local equipment has no fault, judging that the local equipment does not meet the switching condition.
Preferably, when both the local device and the peer device have a failure, before determining that the local device does not satisfy the handover condition, the method further includes:
respectively generating a local fault level and an opposite end fault level based on the local state information and the opposite end state information;
judging whether the local fault level is greater than the opposite end fault level;
if the local fault level is greater than the opposite-end fault level, judging that the local equipment meets the switching condition;
and if the local fault level is less than or equal to the opposite-end fault level, judging that the local equipment does not meet the switching condition.
Preferably, when the local failure level is equal to the peer failure level, the method further comprises:
judging whether the local heartbeat IP is larger than the heartbeat IP of the opposite terminal equipment or not;
if the local heartbeat IP is larger than the heartbeat IP of the opposite terminal equipment, judging that the local equipment does not meet the switching condition;
and if the local heartbeat IP is smaller than the heartbeat IP of the opposite terminal equipment, judging that the local equipment meets the switching condition.
Preferably, generating the local fault level and the peer fault level respectively based on the local state information and the peer state information includes:
acquiring fault types respectively corresponding to local state information and opposite end state information;
and obtaining a local fault grade corresponding to the fault type of the local state information and an opposite end fault grade corresponding to the fault type of the opposite end state information based on the grade corresponding relation, wherein the corresponding relation between the fault type and the fault grade is recorded in the grade corresponding relation.
Preferably, when the local device has a communication relationship with the local other device, the peer device has a communication relationship with the peer other device, and the local other device has a primary-standby correspondence relationship with the peer other device, after the local identity state of the local device is switched to the identity state of the peer device, the method further includes:
and executing state locking of preset duration on the switched local identity state.
Preferably, after performing state locking for a preset time duration on the switched local identity state, the method further includes:
and when receiving a gratuitous ARP data packet transmitted by other local equipment, releasing the locking state.
Preferably, when the local device has a communication relationship with the local other device, the peer device has a communication relationship with the peer other device, and the local other device has a primary-standby correspondence with the peer other device, after the local device has a failure of link detection failure, the method further includes:
and locking the fault state of the local equipment for a preset time.
Preferably, after performing the locking for the preset duration for the fault state of the local device, the method further includes:
and when receiving a gratuitous ARP data packet transmitted by other local equipment, releasing the fault lock, and switching the local identity state into a standby state.
In addition, the present application also provides an apparatus switching device, including:
the information acquisition module is used for acquiring local state information of the local equipment and opposite end state information transmitted by opposite end equipment which has a main-standby corresponding relation with the local equipment;
the judging module is used for judging whether the switching condition is met or not according to the local state information and the opposite end state information, if so, the switching module is called, and otherwise, the maintaining module is called;
the switching module is used for switching the local identity state of the local equipment into the identity state of the opposite terminal equipment so as to execute the operation logic of the opposite terminal equipment;
and the maintaining module is used for continuously executing the operation logic corresponding to the local identity state.
In addition, the present application also provides a network device, including:
a memory for storing a computer program;
a processor for implementing the steps of the device switching method as described above when executing the computer program.
Furthermore, the present application also provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, realizes the steps of the device switching method as described above.
The device switching method comprises the steps of firstly obtaining local state information of local devices and opposite end state information transmitted by opposite end devices which have a main-standby corresponding relation with the local devices, further jointly judging whether a switching condition is met according to the local state information and the opposite end state information, and switching the local identity state of the local devices into the identity state of the opposite end devices if the switching condition is met, so that the local identity state of the local devices is operated according to an operation logic corresponding to the identity state; and if the switching condition is not met, keeping the running logic of the local identity state to continue running. According to the method, the opposite-end state information transmitted by the opposite-end equipment is obtained, and the opposite-end state information and the local state information are jointly used as the basis for judging whether equipment switching is carried out, so that corresponding equipment switching measures can be taken aiming at the condition that the two machines are all in fault, and the overall reliability of the network after network equipment switching is carried out in the hot-standby scene of the two machines is relatively ensured. In addition, the application also provides a device switching device, a device and a storage medium, and the beneficial effects are as described above.
Drawings
In order to more clearly illustrate the embodiments of the present application, the drawings needed for the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
Fig. 1 is a flowchart of an apparatus switching method disclosed in an embodiment of the present application;
fig. 2 is a flowchart of a specific device switching method disclosed in the embodiment of the present application;
fig. 3 is a flowchart of a specific device switching method disclosed in the embodiment of the present application;
fig. 4 is a flowchart of a specific device switching method disclosed in the embodiment of the present application;
fig. 5 is a scene schematic diagram of multi-machine deployment in a specific scene disclosed in an embodiment of the present application;
fig. 6 is a schematic structural diagram of an apparatus switching device disclosed in the embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without any creative effort belong to the protection scope of the present application.
The VRRP protocol is generally applied to a dual-computer hot standby scenario in which two network devices are deployed at the same time and perform hot standby, in this scenario, the two network devices belong to the same VRRP protocol group, and only one network device is in a host state at the same time and is used for forwarding a network data packet, while the other network device is in a standby state, and once the network device that forwards the network data packet fails, the standby state is switched to the host state to take over the network to continue forwarding the data packet. In the current dual-computer hot-standby scenario, there may be a case where both network devices fail, but in the current device switching mechanism, the occurrence of the dual-computer failure cannot be known, and then corresponding device switching measures cannot be taken for the dual-computer failure, so that it is difficult to ensure the overall reliability of the network after the network device is switched in the dual-computer hot-standby scenario.
Therefore, the core of the present application is to provide a device switching method to relatively ensure the overall reliability of the network after the network device is switched in the dual-device hot-standby scenario.
Referring to fig. 1, an embodiment of the present application discloses an apparatus switching method, including:
step S10: local state information of the local device and opposite terminal state information transmitted by opposite terminal devices having a main-standby corresponding relation with the local device are obtained.
It should be noted that this embodiment may be applied to a dual-computer hot-standby scenario constructed based on a VRRP protocol, where an execution main body is a network device in a VRRP protocol group, where the network device may specifically be a switch, a firewall, or a load balancing device, and the like, and the network device in the VRRP protocol group has an identity state in the VRRP protocol group that includes a host state and a standby state, and the host state and the standby state between the network devices of the same type may be switched, and the network device in the host state can receive and transmit a service data packet, and the network device in the standby state temporarily does not receive and transmit the service data packet until the identity state is switched from the standby state to the host state.
In this embodiment, the identity state of the local device is not limited, that is, the network device in the host state or the network device in the standby state both execute the operations in this embodiment, and in addition, the network device in the host state and the network device in the standby state are opposite-end devices.
The local state information acquired in the step refers to the running state information of the local device, the peer state information transmitted by the peer device having a primary-standby correspondence with the local device refers to the running state information of the peer network device, and the peer device in the VRRP protocol group can transmit the peer state information to the local device through the heartbeat line, so that it can be ensured that the peer state information can still be provided with the local device when the peer device is in a standby state and cannot transmit and receive the service data packet.
Step S11: and judging whether the switching condition is met or not according to the local state information and the opposite end state information, if the switching condition is met, executing the step S12, and if not, executing the step S13.
Step S12: and switching the local identity state of the local equipment into the identity state of the opposite terminal equipment so as to execute the running logic of the opposite terminal equipment.
Step S13: and continuously executing the running logic corresponding to the local identity state.
The local state information and the opposite terminal state information respectively reflect respective running states of the local device and the opposite terminal device, so that whether the local identity state of the local device is switched to the identity state of the opposite terminal device can be further comprehensively judged according to the respective running states of the local device and the opposite terminal device, and when the device identity state needs to be switched, the local device can learn the running state of the opposite terminal device, so that appropriate device switching measures are further taken.
The device switching method comprises the steps of firstly obtaining local state information of local devices and opposite end state information transmitted by opposite end devices which have a main-standby corresponding relation with the local devices, further jointly judging whether a switching condition is met according to the local state information and the opposite end state information, and switching the local identity state of the local devices into the identity state of the opposite end devices if the switching condition is met, so that the local identity state of the local devices is operated according to an operation logic corresponding to the identity state; and if the switching condition is not met, keeping the running logic of the local identity state to continue running. According to the method, the opposite-end state information transmitted by the opposite-end equipment is obtained, and the opposite-end state information and the local state information are jointly used as the basis for judging whether equipment switching is carried out, so that corresponding equipment switching measures can be taken aiming at the condition that the two machines are all in fault, and the overall reliability of the network after network equipment switching is carried out in the hot-standby scene of the two machines is relatively ensured.
Referring to fig. 2, an embodiment of the present application discloses an apparatus switching method, where when a local identity state is a host state, the method includes:
step S20: local state information of the local device and opposite terminal state information transmitted by opposite terminal devices having a main-standby corresponding relation with the local device are obtained.
Step S21: and judging whether the local equipment has faults according to the local state information, if so, executing the step S22, and otherwise, executing the step S23.
Step S22: and judging whether the opposite terminal equipment has faults according to the opposite terminal state information, if so, executing step S23, otherwise, executing step S24.
Step S23: and continuously executing the running logic corresponding to the local identity state.
Step S24: and switching the local identity state of the local equipment into the identity state of the opposite terminal equipment so as to execute the operation logic of the opposite terminal equipment.
It should be noted that, the key point of this embodiment is that when the local identity state is the host state, after the local state information and the peer state information are obtained, it is first determined whether the local device has a fault according to the local state information, and then only when the local device has a fault, it is further determined whether the local identity state is switched, that is, it is determined whether the peer device has a fault according to the peer state information, and then only when the peer device has no fault, the local identity state of the local device is switched to the identity state of the peer device, so as to implement the work switching between the local device and the peer device. It can be understood that, when both the local device and the peer device have a fault, in order to avoid the local device in the host state being switched to the peer device, that is, when the identity state of the peer device is changed into the host state, a situation of failure occurs, thereby causing a waste of operation resources in the switching process.
Referring to fig. 3, an embodiment of the present application discloses an apparatus switching method, including:
step S30: local state information of the local device and opposite terminal state information transmitted by opposite terminal devices having a main-standby corresponding relation with the local device are obtained.
Step S31: and judging whether the local equipment has faults according to the local state information, if so, executing the step S32, and otherwise, executing the step S33.
Step S32: and judging whether the opposite terminal equipment has faults according to the opposite terminal state information, if so, executing step S33 and step S34, and otherwise, executing step S35.
Step S33: and respectively generating a local fault level and an opposite end fault level based on the local state information and the opposite end state information.
Step S34: and judging whether the local fault level is greater than the opposite-end fault level, if so, executing the step S35, otherwise, executing the step S36.
Step S35: and switching the local identity state of the local equipment into the identity state of the opposite terminal equipment so as to execute the running logic of the opposite terminal equipment.
Step S36: and continuously executing the running logic corresponding to the local identity state.
It should be noted that, the important point of this embodiment is that when both the local device and the peer device that determine the local identity state as the host state have a failure, further generating local fault levels and opposite terminal fault levels corresponding to the local equipment and the opposite terminal equipment respectively according to the local state information and the opposite terminal state information, wherein, the local fault level and the opposite terminal fault level respectively represent the fault degree of the local equipment and the fault degree of the opposite terminal equipment, the fault level is in direct proportion to the fault degree, and when the local fault level is greater than the opposite terminal fault level, namely, when the fault degree of the local equipment is higher than that of the opposite terminal equipment, the local identity state of the local equipment is switched to the identity state of the opposite terminal equipment, therefore, the opposite terminal equipment with lower fault degree is used as the host state to work, and the overall reliability of the network after the network equipment is switched is further ensured.
On the basis of the foregoing embodiment, as a preferred implementation, when the local failure level is equal to the peer failure level, the method further includes:
judging whether the local heartbeat IP is larger than the heartbeat IP of the opposite terminal equipment or not;
if the local heartbeat IP is larger than the heartbeat IP of the opposite terminal equipment, judging that the local equipment does not meet the switching condition;
and if the local heartbeat IP is smaller than the heartbeat IP of the opposite terminal equipment, judging that the local equipment meets the switching condition.
It should be noted that the heartbeat IP refers to an IP address based on which the local device transmits and receives status information to and from the peer device.
The embodiment is directed to a case where the local failure level is equal to the peer failure level, and in this case, it is considered that heartbeat IPs of the local device and the peer device are necessarily different, so that in this embodiment, when the local device and the peer device have a failure of the same degree, the device with a larger heartbeat IP is taken as a host state, and it is considered that the device with a larger heartbeat IP is often a network device with a core, and the device with a larger heartbeat IP is often maintained more efficiently by a technician when the failure occurs, so that the embodiment can relatively ensure the overall reliability of the network after the network device is switched.
On the basis of the foregoing embodiment, as a preferred implementation manner, generating a local failure level and an opposite-end failure level based on the local state information and the opposite-end state information respectively includes:
acquiring fault types respectively corresponding to local state information and opposite end state information;
and obtaining a local fault grade corresponding to the fault type of the local state information and an opposite end fault grade corresponding to the fault type of the opposite end state information based on the grade corresponding relation, wherein the corresponding relation between the fault type and the fault grade is recorded in the grade corresponding relation.
In the embodiment, the generation manners of the local fault level and the opposite-end fault level are specifically described, which mainly determine the fault type of the local device based on the local state information, determine the fault type of the opposite-end device based on the opposite-end state information, and further obtain the local fault level corresponding to the fault type of the local state information and the opposite-end fault level corresponding to the fault type of the opposite-end state information based on the level correspondence relationship between the recorded fault type and the corresponding fault level.
For the case that the local device and the peer device are both firewall devices, the types of the failures that can be respectively obtained through the local state information and the peer state information may include disconnection of a network interface, failure of link detection initiated by the network interface, and failure of a firewall service behavior. In the level correspondence relationship under the three failure types, the failure level of disconnection of the network interface is the highest, the failure level of failure of link detection initiated by the network interface is the highest, and the failure level of failure of firewall service behavior is the lowest. The above is only a specific description of the fault type and the level corresponding relationship when the local device and the peer device are both firewall devices, but the local device and the peer device are not limited to the firewall devices, and the fault type and the level corresponding relationship are also determined according to the specific types of the local device and the peer device, and are not limited specifically here.
Referring to fig. 4, when a local device has a communication relationship with other local devices, an opposite device has a communication relationship with other opposite devices, and a main-standby correspondence relationship exists between other local devices and other opposite devices, an embodiment of the present application discloses a device switching method, including:
step S40: local state information of the local device and opposite terminal state information transmitted by opposite terminal devices having a main-standby corresponding relation with the local device are obtained.
Step S41: and judging whether the switching condition is met or not according to the local state information and the opposite end state information, if the switching condition is met, executing the steps S42 to S43, and if not, executing the step S44.
Step S42: and switching the local identity state of the local equipment into the identity state of the opposite terminal equipment so as to execute the running logic of the opposite terminal equipment.
Step S43: and executing state locking of preset duration on the switched local identity state.
Step S44: and continuously executing the running logic corresponding to the local identity state.
It should be noted that, in the scenario used in this embodiment, the local device is connected with other local devices, the opposite device is also connected with other opposite devices, and a primary-standby correspondence exists between the other local devices and the other opposite devices, that is, the other local devices and the other opposite devices all belong to the same type of device and are in the primary-standby correspondence with each other, and at the same time, only one device executes service data interaction with the adjacent device between the other local devices and the other opposite devices.
The key point of this embodiment is to perform state locking for a preset duration on the switched local identity state after switching the local identity state of the local device to the identity state of the peer device. In this embodiment, it is considered that, in a scenario where multiple types of network devices all work cooperatively in a dual-device hot standby manner, different types of network devices are in a linkage state, and a master-slave switching between one type of network device often causes a master-slave switching to occur in other network devices related to the type of network device, but the switching of the different types of network devices is not synchronous, so that after the master-slave switching occurs in a target network device, the network device related to the target network device does not yet perform the master-slave switching, which causes the target network device to perform the master-slave switching again when considering that a fault exists in the target network device, so as to reduce the stability of the entire network, and thus after the local identity state of the local device is switched to the identity state of an opposite device, performing state locking for a preset duration on the switched local identity state, thereby ensuring the overall stability of the peer network. In addition, the local identity state may be a fault machine state or a host machine state, which is determined according to the actual situation.
On the basis of the foregoing embodiment, as a preferred implementation manner, after performing state locking for a preset time duration on the switched local identity state, the method further includes:
and when receiving a gratuitous ARP data packet transmitted by other local equipment, releasing the locking state.
It should be noted that the gratuitous ARP packet in this embodiment is another type of network device that has a communication relationship with the current type of local device, that is, a packet used for initiating link detection to the local device by another local device, and when receiving an incoming gratuitous ARP packet, it indicates that the other type of network device has completed linked switching, and in this case, the lock state is released, so as to perform primary-standby switching again, and this embodiment further ensures the overall integrity of the device switching process.
In addition, as a preferred embodiment, when the local device has a communication relationship with the local other device, the peer device has a communication relationship with the peer other device, and the local other device has a primary-standby correspondence with the peer other device, and after the local device has a failure that link detection fails, the method further includes:
and locking the fault state of the local equipment for a preset time.
It should be noted that the key point of this embodiment is to introduce a fault machine maintenance mechanism, that is, after a local device has a fault due to a link failure, the local device is locked for a preset time period, so as to ensure that the local device continuously maintains its own fault state, and avoid repeated communication switching between the local device and the peer device by the local device and the peer device, thereby ensuring the overall stability of the network.
On the basis of the foregoing embodiment, as a preferred implementation manner, after performing locking for a preset time period on the fault state of the local device, the method further includes:
and when receiving a gratuitous ARP data packet transmitted by other local equipment, releasing the fault lock, and switching the local identity state into a standby state.
It should be noted that the gratuitous ARP packet in this embodiment is another type of network device that has a communication relationship with the current type of local device, that is, the local other device initiates a packet used for link detection to the local device, and when receiving an incoming gratuitous ARP packet, it indicates that a link failure existing between the local device and the other type of network device has been resolved, so that in this case, the failure locking state is resolved to put the local device into the working logic of active-standby switching again for operation, and this embodiment further ensures the overall integrity of the device switching process.
In order to deepen understanding of the foregoing embodiments, a scenario embodiment of linkage switching under multi-machine deployment is provided below, and as shown in fig. 5, a schematic diagram of multi-machine deployment in the scenario embodiment of the present application is provided.
As shown in fig. 5, a and a ' are load balancing devices of devices that are opposite to each other, FW and FW ' are firewall devices of devices that are opposite to each other, B and B ' are internet behavior management devices of devices that are opposite to each other, and both of them operate in a dual-computer hot standby mode including a host and a standby machine, and this "square-shaped deployment is most easily established, so the deployment is most in reality.
In the above deployment in the shape of a square, the multi-machine deployment has the problem of switching after switching, for example, a detects that the switch (o) is not switched to the fault state, a 'is switched to the host state, then FW is in the host state, because it may need to switch after several failures of link detection, for example, FW detection is connected with a or not, when a is switched to the fault state, FW detection is switched to the fault after several failures, if a' detects FW 'is also not switched during this period, then a' may mistakenly think that it has a fault and switch to the fault state again, then a may be switched to the host state again immediately if a is restored to the standby state, and thus unnecessary switching for many times and the like may occur. The following solutions are proposed for this phenomenon:
1. maintenance time of fault machine
In the above scenario, the a detection switch (o) enters a fault state after failing, and since the fault machine cannot actively send a detection packet any more (the fault machine does not allow an outward packet), only the default link detection is normal, but the fault state needs to be maintained continuously, which indicates that the fault occurs. Therefore, the maintenance time of the fault machine is introduced, and the fault machine can be set to the standby state only after time-out. This prevents, to some extent, the failure of detection by a' to switch to a fault state, since a is still in the fault state.
2. New host hold time
In the above scenario, after a' is switched to the host, the host state should be maintained for a period of time, and the influence of link detection is ignored during this period of time. This time is designed to solve the problem of neighbor (FW) handoff hysteresis, providing a settling time for the redundant network.
3. Fault machine resolution mechanism
Because there is a fault machine maintaining time, it may happen that FW is in fault locking state in the above figure, but a switches to host state, in order to quickly release fault locking state, a fault release mechanism is proposed, that is, if the interface which previously caused the local machine to enter fault state receives free ARP, the fault locking state is released, and the standby state is entered, so that there is a chance to switch to host state, the fault release mechanism is only adapted to enter fault state scenario because of link detection failure, if the interface is in shutdown state, the standby state is automatically recovered after the interface is started.
Referring to fig. 6, an embodiment of the present application discloses an apparatus switching device, including:
an information obtaining module 10, configured to obtain local state information of a local device and peer state information transmitted by a peer device having a primary-standby correspondence with the local device;
the judging module 11 is used for judging whether the switching condition is met according to the local state information and the opposite end state information, if so, the switching module 12 is called, otherwise, the keeping module 13 is called;
a switching module 12, configured to switch a local identity state of a local device to an identity state of an opposite-end device, so as to execute an operation logic of the opposite-end device;
and the maintaining module 13 is configured to continue to execute the running logic corresponding to the local identity state.
The device switching device provided by the application firstly acquires local state information of local equipment and opposite end state information transmitted by opposite end equipment which has a main-standby corresponding relation with the local equipment, and further jointly judges whether a switching condition is met according to the local state information and the opposite end state information, if the switching condition is met, the local identity state of the local equipment is switched to the identity state of the opposite end equipment, and therefore the local equipment is operated according to an operation logic corresponding to the identity state; and if the switching condition is not met, keeping the running logic of the local identity state to continue running. The device acquires the opposite terminal state information transmitted by the opposite terminal equipment, and uses the opposite terminal state information and the local state information together as a basis for judging whether equipment switching is carried out, so that corresponding equipment switching measures can be taken aiming at the condition that the two terminals are all in fault, and the overall reliability of the network after network equipment switching is carried out in a hot standby scene of the two terminals is relatively ensured.
On the basis of the foregoing embodiments, the embodiments of the present application further describe and optimize the device switching apparatus. Specifically, the method comprises the following steps:
in one embodiment, when the local identity status is the host status, the determining module 11 includes:
the local judgment module is used for judging whether the local equipment has faults according to the local state information, if so, the opposite terminal judgment module is called, and otherwise, the holding module 13 is called;
and the opposite terminal judging module is used for judging whether the opposite terminal equipment has faults or not according to the opposite terminal state information, if so, the maintaining module 13 is called, and otherwise, the switching module 12 is called.
In a specific embodiment, when both the local device and the peer device have a failure, the apparatus further includes:
the grade generation module is used for respectively generating a local fault grade and an opposite end fault grade based on the local state information and the opposite end state information;
and the grade judging module is used for judging whether the local fault grade is greater than the opposite-end fault grade, if so, the switching module 12 is called, and otherwise, the keeping module 13 is called.
In one embodiment, when the local failure level is equal to the peer failure level, the apparatus further includes:
and the IP judging module is used for judging whether the local heartbeat IP is larger than the heartbeat IP of the opposite terminal equipment, if so, the maintaining module 13 is called, and otherwise, the switching module 12 is executed.
In one embodiment, the rank generation module includes:
the type acquisition module is used for acquiring the fault types corresponding to the local state information and the opposite end state information respectively;
and the corresponding acquisition module is used for acquiring a local fault grade corresponding to the fault type of the local state information and an opposite-end fault grade corresponding to the fault type of the opposite-end state information based on the grade corresponding relation, and the grade corresponding relation records the corresponding relation between the fault type and the fault grade.
In a specific embodiment, when the local device has a communication relationship with the local other device, the peer device has a communication relationship with the peer other device, and the local other device has a primary-standby correspondence with the peer other device, the apparatus further includes:
and the switching locking module is used for executing state locking of preset duration on the switched local identity state.
In a specific embodiment, when the local device has a communication relationship with the local other device, the peer device has a communication relationship with the peer other device, and the local other device has a primary-standby correspondence with the peer other device, the apparatus further includes:
and the switching unlocking module is used for unlocking the locking state when receiving the gratuitous ARP data packet transmitted by other local equipment.
In a specific embodiment, when the local device has a communication relationship with the local other device, the peer device has a communication relationship with the peer other device, and the local other device has a primary-standby correspondence with the peer other device, after the local device has a failure that link detection fails, the apparatus further includes:
and the fault locking module is used for locking the fault state of the local equipment for a preset time.
In one embodiment, the apparatus further comprises:
and the fault unlocking module is used for unlocking the fault when receiving a gratuitous ARP data packet transmitted by other local equipment and switching the local identity state into a standby state.
In addition, this embodiment also discloses a network device, including:
a memory for storing a computer program;
a processor for implementing the steps of the device switching method as described above when executing the computer program.
The device switching equipment provided by the application firstly acquires local state information of local equipment and opposite end state information transmitted by opposite end equipment which has a main-standby corresponding relation with the local equipment, and further jointly judges whether a switching condition is met according to the local state information and the opposite end state information, if the switching condition is met, the local identity state of the local equipment is switched to the identity state of the opposite end equipment, and therefore the local equipment is operated according to operation logic corresponding to the identity state; and if the switching condition is not met, keeping the running logic of the local identity state to continue running. The device acquires the opposite terminal state information transmitted by the opposite terminal device, and uses the opposite terminal state information and the local state information together as a basis for judging whether to switch the device, so that corresponding device switching measures can be taken aiming at the condition that the two terminals are all in fault, and the overall reliability of the network after the network device is switched in the hot standby scene of the two terminals is relatively ensured.
In addition, the embodiment also discloses a computer readable storage medium, on which a computer program is stored, and when being executed by a processor, the computer program implements the steps of the device switching method as described above.
The computer-readable storage medium provided by the application firstly acquires local state information of local equipment and opposite end state information transmitted by opposite end equipment which has a main-standby corresponding relationship with the local equipment, and further jointly judges whether a switching condition is met according to the local state information and the opposite end state information, if the switching condition is met, the local identity state of the local equipment is switched to the identity state of the opposite end equipment, and therefore the local equipment is operated according to an operation logic corresponding to the identity state; and if the switching condition is not met, keeping the running logic of the local identity state to continue running. The computer-readable storage medium acquires the opposite-end state information transmitted by the opposite-end device, and uses the opposite-end state information and the local state information together as a basis for judging whether to perform device switching, so that corresponding device switching measures can be taken for the condition of failure of both the two machines, and the overall reliability of the network after network device switching is relatively ensured in a hot-standby scene of the two machines.
The above details describe a device switching method, apparatus, device and storage medium provided by the present application. The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

Claims (12)

1. A device switching method, comprising:
acquiring local state information of local equipment and opposite end state information transmitted by opposite end equipment with a main-standby corresponding relation with the local equipment;
judging whether a switching condition is met or not according to the local state information and the opposite end state information;
if the switching condition is met, switching the local identity state of the local equipment into the identity state of the opposite-end equipment so as to execute the operation logic of the opposite-end equipment;
and if the switching condition is not met, continuously executing the running logic corresponding to the local identity state.
2. The device switching method according to claim 1, wherein when the local identity state is a host state, the determining whether a switching condition is satisfied according to the local state information and the peer state information includes:
judging whether the local equipment has a fault according to the local state information;
if the local equipment has a fault, judging whether the opposite-end equipment has a fault according to the opposite-end state information;
if the opposite terminal equipment has a fault, judging that the local equipment does not meet the switching condition;
if the opposite terminal equipment has no fault, judging that the local equipment meets the switching condition;
and if the local equipment has no fault, judging that the local equipment does not meet the switching condition.
3. The device switching method according to claim 2, wherein when both the local device and the peer device have a failure, before determining that the local device does not satisfy the switching condition, the method further comprises:
respectively generating a local fault level and an opposite end fault level based on the local state information and the opposite end state information;
judging whether the local fault level is greater than the opposite-end fault level;
if the local fault level is greater than the opposite-end fault level, judging that the local equipment meets the switching condition;
and if the local fault level is less than or equal to the opposite-end fault level, judging that the local equipment does not meet the switching condition.
4. The device switching method according to claim 3, wherein when the local failure level is equal to the peer failure level, the method further comprises:
judging whether the local heartbeat IP is larger than the heartbeat IP of the opposite terminal equipment or not;
if the local heartbeat IP is larger than the heartbeat IP of the opposite terminal equipment, judging that the local equipment does not meet the switching condition;
and if the local heartbeat IP is smaller than the heartbeat IP of the opposite terminal equipment, judging that the local equipment meets the switching condition.
5. The device switching method according to claim 3, wherein the generating a local failure level and an opposite-end failure level based on the local state information and the opposite-end state information respectively comprises:
acquiring fault types respectively corresponding to the local state information and the opposite end state information;
and obtaining the local fault grade corresponding to the fault type of the local state information and the opposite-end fault grade corresponding to the fault type of the opposite-end state information based on the grade corresponding relation, wherein the corresponding relation between the fault type and the fault grade is recorded in the grade corresponding relation.
6. The device switching method according to any one of claims 1 to 5, wherein when the local device has a communication relationship with other local devices, the peer device has a communication relationship with other peer devices, and the local device has the active-standby correspondence with the other peer devices, after the local identity state of the local device is switched to the identity state of the peer device, the method further includes:
and executing state locking of preset duration on the switched local identity state.
7. The device switching method according to claim 6, wherein after performing state locking on the switched local identity state for a preset time period, the method further comprises:
and when receiving gratuitous ARP data packets transmitted by the other local equipment, releasing the locking state.
8. The device switching method according to any one of claims 1 to 5, wherein when the local device has a communication relationship with other local devices, the peer device has a communication relationship with other peer devices, and the local device has the active-standby correspondence with other peer devices, after the local device has a failure of link detection failure, the method further includes:
and locking the fault state of the local equipment for a preset time.
9. The device switching method according to claim 8, wherein after the locking of the fault state of the local device is performed for a preset time period, the method further comprises:
and when receiving a gratuitous ARP data packet transmitted by other local equipment, releasing the fault lock and switching the local identity state into a standby state.
10. An apparatus switching device, comprising:
the information acquisition module is used for acquiring local state information of local equipment and opposite end state information transmitted by opposite end equipment which has a main-standby corresponding relation with the local equipment;
the judging module is used for judging whether a switching condition is met or not according to the local state information and the opposite end state information, if so, the switching module is called, and otherwise, the maintaining module is called;
the switching module is configured to switch the local identity state of the local device to the identity state of the peer device, so as to execute an operation logic of the peer device;
and the maintaining module is used for continuously executing the operation logic corresponding to the local identity state.
11. A network device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the device switching method as claimed in any one of claims 1 to 9 when executing said computer program.
12. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, carries out the steps of the device switching method according to any one of claims 1 to 9.
CN201911251228.7A 2019-12-09 2019-12-09 Equipment switching method, device, equipment and storage medium Pending CN110971462A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911251228.7A CN110971462A (en) 2019-12-09 2019-12-09 Equipment switching method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911251228.7A CN110971462A (en) 2019-12-09 2019-12-09 Equipment switching method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110971462A true CN110971462A (en) 2020-04-07

Family

ID=70033486

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911251228.7A Pending CN110971462A (en) 2019-12-09 2019-12-09 Equipment switching method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110971462A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112835749A (en) * 2021-02-24 2021-05-25 中国人民解放军32039部队 Automatic software switching control method for dual-computer hot standby disaster recovery
CN114070781A (en) * 2020-08-05 2022-02-18 北京威努特技术有限公司 Data communication method, device and system and computer equipment
CN114337944A (en) * 2022-03-16 2022-04-12 中国人民解放军海军工程大学 System-level main/standby redundancy general control method
CN114629781A (en) * 2020-11-27 2022-06-14 中国移动通信有限公司研究院 Equipment switching method, device, equipment and readable storage medium
CN115529224A (en) * 2022-09-16 2022-12-27 武汉思普崚技术有限公司 Method, system and device for switching HA (host/standby) scenes

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101145895A (en) * 2007-09-20 2008-03-19 中兴通讯股份有限公司 Master/slave device switching method
WO2010148758A1 (en) * 2009-06-24 2010-12-29 中兴通讯股份有限公司 Method and system for switching main/standby boards
CN103455005A (en) * 2013-09-06 2013-12-18 北京四方继保自动化股份有限公司 Controller redundancy and switching method
CN108153263A (en) * 2017-12-25 2018-06-12 杭州和利时自动化有限公司 A kind of DCS controllers redundancy approach and device
CN109698767A (en) * 2018-12-20 2019-04-30 杭州迪普科技股份有限公司 A kind of main/standby switching method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101145895A (en) * 2007-09-20 2008-03-19 中兴通讯股份有限公司 Master/slave device switching method
WO2010148758A1 (en) * 2009-06-24 2010-12-29 中兴通讯股份有限公司 Method and system for switching main/standby boards
CN103455005A (en) * 2013-09-06 2013-12-18 北京四方继保自动化股份有限公司 Controller redundancy and switching method
CN108153263A (en) * 2017-12-25 2018-06-12 杭州和利时自动化有限公司 A kind of DCS controllers redundancy approach and device
CN109698767A (en) * 2018-12-20 2019-04-30 杭州迪普科技股份有限公司 A kind of main/standby switching method and device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114070781A (en) * 2020-08-05 2022-02-18 北京威努特技术有限公司 Data communication method, device and system and computer equipment
CN114070781B (en) * 2020-08-05 2023-08-08 北京威努特技术有限公司 Data communication method, device, system and computer equipment
CN114629781A (en) * 2020-11-27 2022-06-14 中国移动通信有限公司研究院 Equipment switching method, device, equipment and readable storage medium
CN112835749A (en) * 2021-02-24 2021-05-25 中国人民解放军32039部队 Automatic software switching control method for dual-computer hot standby disaster recovery
CN114337944A (en) * 2022-03-16 2022-04-12 中国人民解放军海军工程大学 System-level main/standby redundancy general control method
CN115529224A (en) * 2022-09-16 2022-12-27 武汉思普崚技术有限公司 Method, system and device for switching HA (host/standby) scenes

Similar Documents

Publication Publication Date Title
CN110971462A (en) Equipment switching method, device, equipment and storage medium
CN105406980B (en) A kind of multinode backup method and device
CN101150430B (en) A method for realizing network interface board switching based heartbeat mechanism
CN103560922A (en) Disaster recovery method and system
CN101588304A (en) Implementation method of VRRP
CN105933407A (en) Method and system for achieving high availability of Redis cluster
CN109861867B (en) MEC service processing method and device
CN107276839B (en) Self-monitoring method and system of cloud platform
CN103490914A (en) Switching system and switching method for multi-machine hot standby of network application equipment
CN112511326B (en) Switching method, device, equipment and storage medium
CN111371592B (en) Node switching method, device, equipment and storage medium
CN102271058A (en) Multi-path service protecting method and device
CN105577444A (en) Wireless controller management method and wireless controller
US6145090A (en) Switch control method of redundantly structured computer system
CN102187627B (en) Method, device and broadband access server system for load share
CN109586986B (en) Method, device, equipment and storage medium for switching network equipment
CN102932249B (en) A kind of transmission method of VRRP message and device
CN112787918B (en) Data center addressing and master-slave switching method based on service routing tree
CN109104319B (en) Data storage device and method
CN115314361A (en) Server cluster management method and related components thereof
CN108011815B (en) Network control method and software defined network device and system
CN111835544B (en) Monitoring method and system of virtual router based on user mode protocol stack
CN101227378A (en) Communication service establishing method based on network storage and storage device thereof
CN111405599A (en) Wireless controller fault switching method, system, electronic equipment and storage medium
CN110855494B (en) Method for realizing high availability of agent based on distributed monitoring system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200407

RJ01 Rejection of invention patent application after publication