CN109600256B - State switching method and device - Google Patents

State switching method and device Download PDF

Info

Publication number
CN109600256B
CN109600256B CN201811476120.3A CN201811476120A CN109600256B CN 109600256 B CN109600256 B CN 109600256B CN 201811476120 A CN201811476120 A CN 201811476120A CN 109600256 B CN109600256 B CN 109600256B
Authority
CN
China
Prior art keywords
state
priority
server
multicast message
switching
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.)
Active
Application number
CN201811476120.3A
Other languages
Chinese (zh)
Other versions
CN109600256A (en
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.)
Chengdu Zhonghang Xinhong Technology Co ltd
Original Assignee
Chengdu Zhonghang Xinhong Technology 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 Chengdu Zhonghang Xinhong Technology Co ltd filed Critical Chengdu Zhonghang Xinhong Technology Co ltd
Priority to CN201811476120.3A priority Critical patent/CN109600256B/en
Publication of CN109600256A publication Critical patent/CN109600256A/en
Application granted granted Critical
Publication of CN109600256B publication Critical patent/CN109600256B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/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
    • 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

Landscapes

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

Abstract

The embodiment of the invention provides a state switching method and a state switching device, wherein the state switching method comprises the steps of receiving multicast messages sent by each second server; aiming at each multicast message, extracting the priority of a second server sending the multicast message from the multicast message; and comparing the self priority with the extracted priority in each multicast message, and switching the state when the comparison result meets the state switching condition. The invention realizes the state switching of the server based on a multicast synchronization mode, and can effectively shorten the state switching time.

Description

State switching method and device
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a state switching method and apparatus.
Background
Each server in the existing redundant backup system implements a high availability scheme for the server based on a Virtual Router Redundancy Protocol (vrrp Protocol), so as to avoid a single point failure, for example, once a main server fails or crashes, the standby server needs to be switched to a main service state to take over a Virtual IP (Internet Protocol) and continue to provide services to a client, but the existing server state detection and switching process is too long, which results in that some services or service switching requirements with higher time precision cannot be met.
Disclosure of Invention
In view of the above, an object of the embodiments of the present invention is to provide a method and an apparatus for switching states based on a multicast synchronization manner, so as to improve the above problem.
In one aspect, a preferred embodiment of the present invention further provides a status switching method, applied to a first server, where the first server is capable of communicating with a plurality of second servers, the status switching method includes:
receiving multicast messages sent by the second servers;
aiming at each multicast message, extracting the priority of a second server sending the multicast message from the multicast message;
and respectively comparing the self priority with the extracted priority in each multicast message, and switching the state when the comparison result meets the state switching condition.
Furthermore, a local priority for one-to-one comparison with the extracted priority of the second server is preset in the first server; the step of comparing the priority of the multicast message with the extracted priority of each multicast message comprises the following steps:
respectively judging whether the extracted priority in each multicast message is greater than the local priority;
if the priority contained in the multicast message is greater than the local priority, updating the local priority based on the priority contained in the multicast message, so that the updated local priority is the maximum value of the extracted priorities in each multicast message;
and comparing the self priority with the updated local priority.
Further, when the first server is a standby server in a standby state, the step of performing state switching when the comparison result satisfies a state switching condition includes:
and when the comparison result shows that the self priority is greater than the extracted priority of each second server, judging that the comparison result meets a state switching condition to switch from the current standby state to the main service state, and acquiring the virtual IP to continuously provide service for the client.
Further, after switching from the current standby state to the main service state, the state switching method further includes:
detecting whether a preset application is in a running state or whether the running state of the preset application is normal, and if the preset application is not in the running state or is abnormal in the running state, restarting the preset application to ensure that the running state of the preset application is normal.
Further, the method further comprises:
reading an initial configuration file when starting or restarting;
and initializing the state according to the initial configuration file to enter a standby state, and executing the step of receiving the multicast messages sent by the plurality of second servers when the state is in the standby state.
Further, when the first server is a main server in a main service state, the step of performing state switching when the comparison result satisfies a state switching condition includes:
and when the comparison result shows that the self priority is smaller than the extracted priority in the second server, switching the current main service state into a standby state, and deleting the virtual IP to stop providing service for the client.
Further, while receiving the multicast packet sent by each second server, the state switching method further includes:
and sending the multicast message to each second server according to a preset time interval.
In another aspect, a preferred embodiment of the present invention provides a status switching apparatus applied to a first server, where the first server is capable of communicating with a plurality of second servers, the status switching apparatus including:
the message receiving module is used for receiving the multicast messages sent by the second servers;
the information extraction module is used for extracting the priority of a second server sending the multicast message from the multicast message aiming at each multicast message;
and the state switching module is used for comparing the priority of the state switching module with the priority of the multicast message and switching the state when the comparison result meets the state switching condition.
Further, when the first server is a standby server in a standby state, the state switching module includes:
and the first switching unit is used for judging that the comparison result meets a state switching condition to switch from the current standby state to the main service state when the comparison result shows that the self priority is greater than the priority of each second server, and acquiring the virtual IP to continuously provide service for the client.
Further, when the first server is a master server in a master service state, the state switching module further includes:
and the second switching unit is used for switching the current main service state into the standby state and deleting the virtual IP to stop providing service for the client when the comparison result shows that the self priority is smaller than the priority in the second server.
Compared with the prior art, the embodiment of the invention provides a state switching method and a state switching device, wherein the state detection and the information synchronization of a server are carried out based on a multicast synchronization mode, so that the working state switching of the server is further realized, for example, when a main server fails or is down, the standby server is switched to a main service state, the switching time of the server during state switching can be greatly shortened, the switching requirement of ultra-high time precision service or service is met, and the reliability and the stability of a redundant backup system during operation are improved.
In addition, the invention also carries out service detection after the server is switched from the standby state to the main service state, can effectively avoid the phenomenon of service operation termination or abnormity caused by state switching, effectively ensures the reliability of service operation and improves the user experience.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a schematic diagram of a data interaction scenario between a conventional redundant backup system and a client.
Fig. 2 is a schematic block diagram of a redundant backup system according to an embodiment of the present invention.
Fig. 3 is a block diagram of the first server shown in fig. 2.
Fig. 4 is a flowchart illustrating a state switching method according to an embodiment of the present invention.
Fig. 5 is a sub-flowchart of step S13 shown in fig. 3.
Fig. 6 is a schematic block diagram of a state switching device according to an embodiment of the present invention.
Icon: 10-a first server; 100-state switching means; 110-a message receiving module; 120-an information extraction module; 130-state switching module; 200-a memory; 300-a memory controller; 400-a processor; 20-a second server; 30-redundant backup system.
Detailed Description
As shown in fig. 1, a schematic diagram of a data interaction scenario between a redundant Backup system and a Client (Client) in the prior art is shown, where the redundant Backup system may include a main server (Master) and a Backup server (Backup), and a keepalive application implemented based on a vrrp protocol is run in the main server and the Backup server to avoid a single point of failure.
In the data interaction scenario shown in fig. 1, for a client, a redundant backup system may be logged in through a Virtual IP (VIP) address to perform service access or service usage, and as long as one server in the redundant backup system can operate normally, normal operation of a corresponding service or service may be ensured. In the case of the redundant backup system, the redundant backup system externally appears as a VIP, that is, during the actual operation of the redundant backup system, the primary server in the primary service state owns the VIP to provide services to the client. In actual operation, in the existing redundant backup system, the primary server in the primary service state may periodically send a vrrp notification to the standby server in the standby state, and once the server in the standby state cannot receive the vrrp notification, the standby server needs to be switched to the primary service state and take over the VIP to continue to provide service for the client, thereby ensuring normal operation of external services. Specifically, the operation of the primary server and the backup server in the redundant backup system in the related art will be briefly described below.
(1) Master server
a. A timer for timing notification is arranged in the main server;
b. the master server responds to an Address Resolution Protocol (ARP) request of the router IP Address based on a vrrp virtual MAC (Media Access Control Address), and forwards a packet whose destination MAC is the vrrp virtual MAC. If the main server is the owner of the virtual IP, the data packet with the destination address being the IP of the virtual router is received, otherwise, the data packet is discarded.
e. When the main server detects a shutdown event (such as equipment failure), the timer is deleted, and a notification packet with the priority level of 0 is sent to other servers, and meanwhile, the main server enters an initialization state. Or when a timer in the main server is overtime, sending vrrp notification to other servers.
In addition, because only the main server in the existing redundant backup system sends the notification information, if the main server receives the vrrp notification and the priority contained in the received vrrp notification is 0, the received vrrp notification is directly ignored, and the vrrp notification information generated by the main server is continuously sent; when the priority contained in the received vrrp notification is higher than that of the local machine or equal to that of the local machine and the actual IP address is larger than that of the local actual IP, it is determined that other running main servers exist in the redundant Backup system, and then the current main server needs to reset the timer and enter a Backup state.
(2) Standby server
a. The standby server is provided with a host timeout timer.
b. The standby server cannot respond to the ARP request information for the virtual router IP and needs to discard all packets whose destination MAC address is the MAC address of the virtual router.
d. And when the standby server receives the shutdown event, judging that the main server is in fault or down, deleting the timeout timer of the main server, and switching to an initialization state.
e. When detecting that the host timeout timer times out, the standby server sends a vrrp notification, broadcasts ARP address information, and switches to a MASTER state.
f. When the standby server receives the vrrp notification, and the priority is 0, the standby server indicates entering MASTER election; judging whether the priority in the received vrrp notification is higher than that of the local machine, if so, admitting the MASTER to be effective, resetting the timeout timer of the host machine, and if not, discarding the vrrp notification packet.
It can be seen from the above that, in the existing redundant backup system, only the main server sends notification information to other servers, so that the server in the standby state determines whether to perform a main server qualification election state or whether to perform state switching or the like according to the received notification information, and when the main server fails or goes down, the switching time of detection switching between the main server and the standby server is too long, and therefore, some service or service switching requirements with higher time precision cannot be met. In view of this, embodiments of the present invention provide a method and an apparatus for implementing state switching based on multicast synchronization, so as to solve the above problem.
Specifically, in order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
As shown in fig. 2, a redundant backup system 30 is provided for the embodiment of the present invention, the redundant backup system 30 externally represents a virtual IP, but may include a first server 10 and a plurality of second servers 20, wherein when the first server 10 is a standby server in a standby state, the plurality of second servers 20 includes both the standby server in the standby state and a primary server in a primary service state; when the first server 10 is a main server in a main service state, all of the second servers 20 are standby servers in a standby state. It is understood that the keepalive application implemented based on the vrrp protocol runs in the first server 10 and each second server 20, and information synchronization can be performed based on multicast communication between each other.
Optionally, as shown in fig. 3, the first server 10 includes a state switching device 100, a memory 200, a storage controller 300, and a processor 400. The memory 200, the memory controller 300 and the processor 400 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, the components are electrically connected to each other through one or more communication buses or signal lines. The state switching apparatus 100 includes at least one software function module which may be stored in the memory 200 in the form of software or firmware or solidified in the operating system in the first server 10. The processor 400 accesses the memory 200 under the control of the memory controller 300 for executing executable modules stored in the memory 200, such as software functional modules and computer programs included in the state switching device 100.
It will be appreciated that the architecture shown in fig. 3 is merely illustrative and that the first server 10 may also include more or fewer components than shown in fig. 3, or have a different configuration than shown in fig. 3. In addition, the first server 10 may be, but is not limited to, a smart phone, a Personal Computer (PC), a tablet PC, a Personal Digital Assistant (PDA), a Mobile Internet Device (MID), a cloud server, a small computer, and the like.
Further, as shown in fig. 4, a schematic flow chart of a state switching method provided in an embodiment of the present invention is provided, the state switching method is applied to the first server 10, and specific steps and a flow of the state switching method will be described in detail below with reference to fig. 4. It should be understood that the state switching method given in the present embodiment is not limited by the order of the steps and the flow described below.
Step S11, receiving the multicast message sent by each second server 20;
step S12, extracting, for each multicast packet, the priority of the second server 20 that sends the multicast packet from the multicast packet;
step S13, comparing the priorities with the extracted priorities in the multicast messages, and performing state switching when the comparison result satisfies the state switching condition.
The state switching method provided in the steps S11 to S13 is a state switching method implemented based on a multicast synchronization technology, so that the switching time for switching from a standby state to a main service state or from the main service state to the standby state is greatly reduced, the server state switching requirement during operation of a service or service with ultra-high time precision can be met, the reliability and stability of the redundant backup system 30 during operation are improved, and the user experience is met.
In detail, in step S11 and step S12, the multicast message may include, but is not limited to, the operating status information, the priority information, and the like of the server itself. Wherein the priority level in the server priority information represents a probability that the corresponding server becomes the master server when the server in the master service state fails. According to the actual requirements, the invention can flexibly configure 1+ n (n is more than or equal to 1) standby servers to provide services simultaneously based on the multicast message while realizing the information synchronization among the servers based on the multicast communication, thereby effectively increasing the reliability and stability of the redundant backup system 30 in the working process.
It should be noted that, while receiving the multicast packet sent by each of the second servers 20, the first server 10 may send the multicast packet to each of the second servers 20 according to a preset time interval, so as to synchronize its current state. Wherein, the preset time interval may be, but is not limited to, 1ms, etc.
Further, in step S13, there are various ways for the first server 10 to compare the priority of the first server with the extracted priority of each multicast packet, for example, for each received multicast packet, the first server 10 may compare the server priority of the extracted multicast packet with the priority of the first server one by one. For another example, as shown in fig. 5, when the first server 10 is preset with a local priority for one-to-one comparison with the extracted priority of the second server 20, the process of the first server 10 comparing the priority of the first server with the extracted priority of each multicast packet may be implemented through steps S130 to S132, which are as follows.
Step S130, respectively judging whether the extracted priority in each multicast message is greater than the local priority;
step S131, if the priority contained in the multicast message is greater than the local priority, updating the local priority based on the priority contained in the multicast message, so that the updated local priority is the maximum value of the extracted priorities in each multicast message;
step S132, comparing the self priority with the updated local priority.
In the above step S130 and step S132, for the received multicast packet sent by each second server 20, the first server 10 compares the extracted priority of each multicast packet with the local priority one by one, and updates the local priority to the extracted priority of the multicast packet when the extracted priority of the multicast packet is greater than the local priority, and repeats the comparison operation, so that the local priority can represent the current deadline, and the priority of the server with the highest priority in each second server 20 that sends the multicast packet to the first server 10. Then, after comparing the priority of the first server 10 with the local priority, if the priority of the first server is greater than the local priority, it may be determined that the priority of the first server is the highest priority of the servers in the standby state in the current redundant backup system 30.
Further, according to the difference of the working states of the first server 10, the process of performing the state switching when the comparison result satisfies the state switching condition given in step S13 is different.
For example, when the first server 10 is a standby server in a standby state, the step of performing state switching when the comparison result satisfies the state switching condition includes: and when the comparison result shows that the self priority is greater than the extracted priority of each second server 20, judging that the comparison result meets the state switching condition and is switched from the current standby state to the main service state, and simultaneously acquiring the virtual IP to continuously provide service for the client.
For another example, when the first server 10 is a main server in a main service state, the step of performing state switching when the comparison result satisfies the state switching condition includes: and when the comparison result shows that the self priority is smaller than the extracted priority of the second server 20, judging that the comparison result meets the state switching condition and is switched from the current main service state to the standby state, and deleting the virtual IP to stop providing service for the client.
Further, after the first server 10 is switched from the standby state to the main service state, in order to avoid the situation that the other standby servers still compete for the qualification of the main server, thereby increasing the working pressure of the redundant backup system 30, after the state switching, a signal that the current state of the first server is the main service state or the standby state needs to be thrown to the other servers in a multicast message manner, especially when the first server is switched from the standby state to the main service state.
Furthermore, according to actual requirements, in order to effectively avoid the phenomenon of service operation termination or abnormality caused by state switching, the reliability of service operation is effectively ensured, and the user experience is improved. In this embodiment, after the first server 10 is switched from the standby state to the main service state, service detection is further required, for example, the first server 10 detects whether a preset application is in an operating state or whether the operating state of the preset application is normal, and if the preset application is not in the operating state or the operating state is abnormal, the preset application is restarted to ensure that the operating state of the preset application is normal. The preset application can be flexibly set according to actual requirements, and the embodiment is not limited herein.
Further, according to actual requirements, when each server in the redundant backup system 30 is started or needs to be restarted due to a failure, each started or restarted server enters a standby state by default, so as to avoid conflict with a server in a main service state in the current network. Specifically, taking the first server 10 as an example, for the case that the first server 10 is started or restarted, the state switching method further includes: the first server 10 reads an initial configuration file, performs state initialization according to the initial configuration file to enter a standby state, and executes a step of receiving multicast messages sent by a plurality of second servers 20 when the first server is in the standby state. The initial configuration file may be preset with multicast synchronization time interval, synchronization timeout times, virtual IP address information, signal type thrown during state switching, service name of running or stopping during state switching, and information such as directory, service or service monitoring period. In addition, the initialization process of the first server 10 based on the initial configuration file may include, but is not limited to, network initialization, multicast synchronization initialization, environment initialization, and the like. In actual implementation, the size of the synchronization interval, the number of synchronization timeout times, and the like in the initial configuration file may be flexibly configured, so that when a server in the main service state fails or goes down, one server may be selected from the servers in the standby state at the fastest speed to switch to the main service state, so as to ensure that the redundant backup system 30 operates normally.
It will be appreciated that, similar to the first server 10, other servers in the redundant backup system 30 may be initialized to enter a standby state based on an initial configuration file at startup or restart.
Further, as shown in fig. 6, which is a block schematic diagram of a state switching apparatus 100 according to an embodiment of the present invention, the state switching apparatus 100 is applied to the first server 10, and the state switching apparatus 100 includes a message receiving module 110, an information extracting module 120, and a state switching module 130.
The message receiving module 110 is configured to receive a multicast message sent by each second server 20; in this embodiment, the detailed description of the step S11 may be referred to for the description of the message receiving module 110, that is, the step S11 may be executed by the message receiving module 110, and therefore, no further description is provided herein.
The information extracting module 120 is configured to, for each multicast packet, extract the priority of the second server 20 that sends the multicast packet from the multicast packet; in this embodiment, the detailed description of the step S12 may be referred to for the description of the information extraction module 120, that is, the step S12 may be executed by the information extraction module 120, and thus will not be further described here.
The state switching module 130 is configured to compare the priority of the multicast message with the priority in the multicast message, and perform state switching when the comparison result meets a state switching condition. In this embodiment, the detailed description of the step S13 may be referred to for the description of the state switching module 130, that is, the step S13 may be executed by the state switching module 130, and thus, will not be further described herein. Optionally, in this embodiment, the state switching module 130 may include a first switching unit and a second switching unit, and the processing unit is configured to determine that the comparison result satisfies the state switching condition to switch from the current standby state to the main service state when the comparison result indicates that the priority of the comparison result is greater than the priority of each second server 20, and acquire the virtual IP to continue to provide the service for the client.
And the second switching unit is configured to, when the comparison result shows that the own priority is lower than the extracted priority in the second server 20, determine that the comparison result satisfies the state switching condition and switch from the current main service state to the standby state, and delete the virtual IP to stop providing the service for the client.
In addition, it should be noted that the state switching method and apparatus provided by the present invention can be applied to the first server 10 installed with LINUX, embedded LINUX, windows, wince, or dos, thereby breaking the limitation that the existing keepalived can only operate in LINUX environment at present.
In summary, embodiments of the present invention provide a method and an apparatus for switching states, where the method and the apparatus perform server state detection and information synchronization based on a multicast synchronization manner, so as to further implement switching of operating states of servers, for example, when a standby server is in a failure or downtime state, switching to a main service state is performed, so as to greatly reduce switching time when a server performs state switching, meet switching requirements of services or services with ultra-high time precision, and improve reliability and stability of a redundant backup system 30 during operation.
In addition, the invention also carries out service detection after the server is switched from the standby state to the main service state, can effectively avoid the phenomenon of service operation termination or abnormity caused by state switching, effectively ensures the reliability of service operation and improves the user experience.
In the embodiments provided in the embodiments of the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. The apparatus and method embodiments described above are illustrative only, as the flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, an electronic device, or a network device) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes. It should be noted that, in this document, 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.
The above description is only an alternative embodiment of the present invention and is not intended to limit the present invention, and various modifications and variations of the present invention may occur to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (7)

1. A state switching method applied to a first server capable of communicating with a plurality of second servers, the state switching method comprising:
receiving multicast messages sent by the second servers;
aiming at each multicast message, extracting the priority of a second server sending the multicast message from the multicast message;
comparing the self priority with the extracted priority in each multicast message respectively, and switching the state when the comparison result meets the state switching condition;
when the first server is a main server in a main service state, the step of switching the state when the comparison result meets the state switching condition includes:
when the comparison result shows that the self priority is smaller than the extracted priority in the second server, judging that the comparison result meets a state switching condition and is switched from the current main service state to a standby state, and deleting the virtual IP to stop providing service for the client;
the first server is preset with local priorities used for one-to-one comparison with the extracted priorities of the second servers; the step of comparing the priority of the multicast message with the extracted priority of each multicast message comprises the following steps:
respectively judging whether the extracted priority in each multicast message is greater than the local priority;
if the priority contained in the multicast message is greater than the local priority, updating the local priority based on the priority contained in the multicast message, so that the updated local priority is the maximum value of the extracted priorities in each multicast message;
and comparing the self priority with the updated local priority.
2. The method according to claim 1, wherein when the first server is a standby server in a standby state, the performing the state switching step when the comparison result satisfies the state switching condition includes:
and when the comparison result shows that the self priority is greater than the extracted priority of each second server, judging that the comparison result meets the state switching condition and is switched from the current standby state to the main service state, and simultaneously acquiring the virtual IP to continuously provide service for the client.
3. The method of claim 1, wherein after switching from the current standby state to the primary service state, the method further comprises:
detecting whether a preset application is in a running state or whether the running state of the preset application is normal, and if the preset application is not in the running state or is abnormal in the running state, restarting the preset application to ensure that the running state of the preset application is normal.
4. The state switching method according to claim 2, further comprising:
reading an initial configuration file when starting or restarting;
and initializing the state according to the initial configuration file to enter a standby state, and executing the step of receiving the multicast messages sent by the plurality of second servers when the state is in the standby state.
5. The stateful switchover method of claim 1, wherein while receiving the multicast packet sent by each of the second servers, the stateful switchover method further comprises:
and sending the multicast message to each second server according to a preset time interval.
6. A status switching apparatus applied to a first server capable of communicating with a plurality of second servers, the status switching apparatus comprising:
the message receiving module is used for receiving the multicast messages sent by the second servers;
the information extraction module is used for extracting the priority of a second server sending the multicast message from the multicast message aiming at each multicast message;
the state switching module is used for respectively comparing the self priority with the extracted priority in each multicast message and switching the state when the comparison result meets the state switching condition;
the state switching module is specifically configured to: when the first server is a main server in a main service state and the comparison result is that the self priority is smaller than the extracted priority in the second server, judging that the comparison result meets a state switching condition and is switched from the current main service state to a standby state, and deleting the virtual IP to stop providing service for the client;
the state switching module is specifically further configured to: the first server is preset with local priorities used for one-to-one comparison with the extracted priorities of the second servers, and whether the extracted priorities in the multicast messages are greater than the local priorities is judged respectively;
if the priority contained in the multicast message is greater than the local priority, updating the local priority based on the priority contained in the multicast message, so that the updated local priority is the maximum value of the extracted priorities in each multicast message;
and comparing the self priority with the updated local priority.
7. The apparatus according to claim 6, wherein when the first server is a standby server in a standby state, the status switching module comprises:
and the first switching unit is used for judging that the comparison result meets the state switching condition to switch from the current standby state to the main service state when the comparison result shows that the self priority is greater than the extracted priority of each second server, and acquiring the virtual IP to continuously provide service for the client.
CN201811476120.3A 2018-12-04 2018-12-04 State switching method and device Active CN109600256B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811476120.3A CN109600256B (en) 2018-12-04 2018-12-04 State switching method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811476120.3A CN109600256B (en) 2018-12-04 2018-12-04 State switching method and device

Publications (2)

Publication Number Publication Date
CN109600256A CN109600256A (en) 2019-04-09
CN109600256B true CN109600256B (en) 2022-05-10

Family

ID=65962051

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811476120.3A Active CN109600256B (en) 2018-12-04 2018-12-04 State switching method and device

Country Status (1)

Country Link
CN (1) CN109600256B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113037845B (en) * 2021-03-17 2022-05-27 青岛海信网络科技股份有限公司 Cloud platform architecture system and operation mode switching method, device, equipment and medium
WO2024187314A1 (en) * 2023-03-10 2024-09-19 新华三技术有限公司 Master-slave switching method and apparatus, and gateway device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6751674B1 (en) * 1999-07-26 2004-06-15 Microsoft Corporation Method and system for replication in a hybrid network
CN101035009A (en) * 2007-03-31 2007-09-12 华为技术有限公司 Multicast traffic redundancy protection method and device
CN101090309A (en) * 2007-07-18 2007-12-19 杭州华三通信技术有限公司 Method for implementing DHCP service redundant and DHCP server
CN101562576A (en) * 2009-05-27 2009-10-21 杭州华三通信技术有限公司 Route distribution method and equipment thereof
CN103067206A (en) * 2012-12-28 2013-04-24 无锡博欧节能科技有限公司 Internet of things across-machine room distributed type full automatic hot standby server switching system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101635648B (en) * 2009-08-05 2011-09-21 中兴通讯股份有限公司 Method for managing and rapidly switching virtual redundant route protocol group
CN105634848B (en) * 2014-11-04 2019-06-28 中国移动通信集团四川有限公司 A kind of virtual router monitoring method and device
CN106341323A (en) * 2016-10-27 2017-01-18 杭州迪普科技有限公司 VRRP state synchronizing method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6751674B1 (en) * 1999-07-26 2004-06-15 Microsoft Corporation Method and system for replication in a hybrid network
CN101035009A (en) * 2007-03-31 2007-09-12 华为技术有限公司 Multicast traffic redundancy protection method and device
CN101090309A (en) * 2007-07-18 2007-12-19 杭州华三通信技术有限公司 Method for implementing DHCP service redundant and DHCP server
CN101562576A (en) * 2009-05-27 2009-10-21 杭州华三通信技术有限公司 Route distribution method and equipment thereof
CN103067206A (en) * 2012-12-28 2013-04-24 无锡博欧节能科技有限公司 Internet of things across-machine room distributed type full automatic hot standby server switching system

Also Published As

Publication number Publication date
CN109600256A (en) 2019-04-09

Similar Documents

Publication Publication Date Title
EP3128720B1 (en) Post-cluster brain split quorum processing method and quorum storage device and system
US7107481B2 (en) Server takeover system and method
US9348706B2 (en) Maintaining a cluster of virtual machines
CN111190747A (en) Message loss detection method and device for message queue
EP1697843B1 (en) System and method for managing protocol network failures in a cluster system
CN113169895A (en) N +1 redundancy for virtualization services with low latency failover
US8108514B2 (en) High availability of internet protocol addresses within a cluster
US8943191B2 (en) Detection of an unresponsive application in a high availability system
CN111314098A (en) Method and device for realizing VIP address drift in HA system
CN109600256B (en) State switching method and device
CN111343016B (en) Cloud server cluster management method and device
CN113905005A (en) Client state updating method and device for instant messaging
CN104503861A (en) Abnormality handling method and system, agency device and control device
US7730168B2 (en) Method and apparatus for assigning packet addresses to a plurality of devices
JP6421516B2 (en) Server device, redundant server system, information takeover program, and information takeover method
CN102073523A (en) Method and device for implementing software version synchronization
CN110417599B (en) Main/standby node switching method and node server
CN111510336B (en) Network equipment state management method and device
CN111083068B (en) Aggregation link convergence method, device and storage medium
WO2020103627A1 (en) Service self-healing method and device based on virtual machine disaster recovery, and storage medium
CN110890989A (en) Channel connection method and device
US20240036968A1 (en) Managing service configuration attempts for a host in response to failure
CN111901415B (en) Data processing method and system, computer readable storage medium and processor
CN112104506B (en) Networking method, networking device, server and readable storage medium
EP4329263A1 (en) Method and system for automated switchover timer tuning on network systems or next generation emergency systems

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
GR01 Patent grant
GR01 Patent grant