CN111934909B - Main-standby machine IP resource switching method, device, computer equipment and storage medium - Google Patents

Main-standby machine IP resource switching method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN111934909B
CN111934909B CN202010670026.2A CN202010670026A CN111934909B CN 111934909 B CN111934909 B CN 111934909B CN 202010670026 A CN202010670026 A CN 202010670026A CN 111934909 B CN111934909 B CN 111934909B
Authority
CN
China
Prior art keywords
public
host
standby
machine
heartbeat 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.)
Active
Application number
CN202010670026.2A
Other languages
Chinese (zh)
Other versions
CN111934909A (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.)
Shenzhen Grid Information Technology Co ltd
Original Assignee
Shenzhen Grid Information 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 Shenzhen Grid Information Technology Co ltd filed Critical Shenzhen Grid Information Technology Co ltd
Priority to CN202010670026.2A priority Critical patent/CN111934909B/en
Publication of CN111934909A publication Critical patent/CN111934909A/en
Application granted granted Critical
Publication of CN111934909B publication Critical patent/CN111934909B/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
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route

Abstract

The application relates to a method and a device for switching IP resources of a main machine and a standby machine, computer equipment and a storage medium. The method is applied to the standby machine; the method comprises the following steps: detecting the running state of software in the standby machine, and sending heartbeat information of the standby machine to a host machine according to a preset time interval; the heartbeat information of the standby machine comprises the running state of software in the standby machine; receiving heartbeat information of the host returned by the host in response to the heartbeat information of the standby; the heartbeat information of the host comprises the running state of software in the host; detecting public IP; and when the heartbeat communication ratio with the host computer is 100% in a preset time period and the public IP is detected to be not in the standby computer and the running state of software in the host computer is abnormal, switching the public IP to the standby computer. The method can timely switch the IP resources of the main machine and the standby machine.

Description

Main-standby machine IP resource switching method, device, computer equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for switching IP resources of a host and a standby device, a computer device, and a storage medium.
Background
With the development of computer technology, it is often required to operate a server for a long period of time in many cases, however, when the server fails for some reasons, problems such as service interruption and data loss are easily caused, and it is difficult to ensure normal service. Therefore, it is necessary to set a host and a standby machine, and during the operation of one server (host), the other server (standby machine) is in a standby state, the host and the standby machine share the same public IP, and when the host fails, the IP resource of the host can be switched to the standby machine, and the standby machine continues to provide services.
In the conventional method, a standby machine generally sends information to a host machine, and then determines the running state of the host machine according to whether the response of the host machine can be received, so as to determine whether the IP resource needs to be switched. However, only the response condition of the host is considered, and the operation state of the host cannot be accurately determined by comparing one sides, so that the IP resource switching of the host and the standby can not be performed in time.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, an apparatus, a computer device, and a storage medium for switching IP resources of a host and a slave, which can switch IP resources of the host and the slave in time.
A method for switching IP resources of a main machine and a standby machine is applied to the standby machine; the method comprises the following steps:
detecting the running state of software in the standby machine, and sending heartbeat information of the standby machine to a host machine according to a preset time interval; the heartbeat information of the standby machine comprises the running state of software in the standby machine;
receiving heartbeat information of the host returned by the host in response to the heartbeat information of the standby; the heartbeat information of the host comprises the running state of software in the host;
detecting public IP;
when the heartbeat communication ratio with the host computer is 100% in a preset time period and the public IP is detected to be not in the standby computer and the running state of software in the host computer is abnormal, switching the public IP to the standby computer; the heartbeat communication ratio is a ratio between the number of times of actually receiving the heartbeat information of the host computer in a preset time period and the number of times of receiving the heartbeat information of the host computer returned by sending the heartbeat information of the standby computer according to a preset time interval.
In one embodiment, the method further comprises:
and when the heartbeat communication ratio with the host is 100% in a preset time period and the public IP is detected to be in the standby machine and the running state of software in the host machine is normal, removing the public IP from the standby machine.
In one embodiment, the heartbeat information of the standby machine further includes a first public IP resource status; the first public IP resource state is used for representing whether public IP is in the standby machine or not;
after removing the public IP from the standby, the method further comprises:
generating heartbeat information of the standby machine and feeding back the heartbeat information to the host machine; the first public IP resource state in the heartbeat information of the fed back standby machine represents that the public IP is not on the standby machine; the first public IP resource status is configured to instruct the host to switch the public IP to the host when the host detects that the access loss rate of the public IP is greater than or equal to a preset access loss rate threshold in a preset time period.
In one embodiment, the method further comprises:
when the heartbeat packet loss rate in the preset time period is greater than or equal to a preset heartbeat packet loss rate threshold value and the access loss rate of the public IP is detected to be greater than or equal to a preset access loss rate threshold value, switching the public IP to the standby machine;
the heartbeat packet loss rate is a ratio between the number of times that the heartbeat information of the host is not received in a preset time period and the number of times that the heartbeat information of the host is received in return after the heartbeat information of the standby is sent according to a preset time interval.
In one embodiment, the method further comprises:
and when the heartbeat packet loss rate in the preset time period is greater than or equal to a preset heartbeat packet loss rate threshold value and the access loss rate of the public IP is detected to be smaller than a preset access loss rate threshold value, continuing to detect the public IP until the access loss rate of the public IP in the preset time period is greater than or equal to a preset access loss rate threshold value, and switching the public IP to the standby machine.
A method for switching IP resources of a host and a standby is applied to the host; the method comprises the following steps:
receiving heartbeat information of a standby machine, which is sent by the standby machine according to a preset time interval; the heartbeat information of the standby machine comprises the running state of software in the standby machine;
responding to the heartbeat information of the standby machine, detecting the running state of software in the host machine, and sending the heartbeat information of the host machine to the standby machine; the heartbeat information of the host comprises the running state of software in the host;
detecting public IP;
and when the running state of software in the host is abnormal within a preset time period and the public IP is detected to be in the host, removing the public IP from the host.
In one embodiment, the method further comprises:
and when the running state of software in the host is normal within a preset time period and the public IP is detected not to be in the host and the access loss rate of the public IP is greater than or equal to a preset access loss rate threshold value, switching the public IP to the host.
In one embodiment, the heartbeat information of the host further includes a second public IP resource status; the second public IP resource status is used to characterize whether public IP is at the host;
the method further comprises the steps of:
when detecting that the public IP is not in the host computer in a preset time period and the access loss rate of the public IP is smaller than a preset access loss rate threshold, generating heartbeat information of the host computer and feeding back the heartbeat information to the standby computer; the second public IP resource state in the heartbeat information of the host fed back represents that the public IP is not in the host; the second public IP resource state is used for indicating the standby machine to remove the public IP from the standby machine when the standby machine detects that the public IP is in the standby machine;
and continuing to detect the public IP until the access loss rate of the public IP is greater than or equal to a preset access loss rate threshold value in a preset time period, and switching the public IP to the host.
An IP resource switching device of a main machine and a standby machine is arranged in the equipment machine; the device comprises:
the first sending module is used for detecting the running state of software in the standby machine and sending the heartbeat information of the standby machine to the host machine according to a preset time interval; the heartbeat information of the standby machine comprises the running state of software in the standby machine;
the first receiving module is used for receiving the heartbeat information of the host returned by the host in response to the heartbeat information of the standby; the heartbeat information of the host comprises the running state of software in the host;
the first detection module is used for detecting the public IP;
the first switching module is used for switching the public IP to the standby machine when the heartbeat communication ratio with the host machine is 100% in a preset time period and the public IP is detected not to be in the standby machine and the running state of software in the host machine is abnormal; the heartbeat communication ratio is a ratio between the number of times of actually receiving the heartbeat information of the host computer in a preset time period and the number of times of receiving the heartbeat information of the host computer returned by sending the heartbeat information of the standby computer according to a preset time interval.
An IP resource switching device of a host and a standby is arranged in the host; the device comprises:
the second receiving module is used for receiving heartbeat information of the standby machine, which is sent by the standby machine according to a preset time interval; the heartbeat information of the standby machine comprises the running state of software in the standby machine;
the second sending module is used for responding to the heartbeat information of the standby machine, detecting the running state of software in the host machine and sending the heartbeat information of the host machine to the standby machine; the heartbeat information of the host comprises the running state of software in the host;
the second detection module is used for detecting the public IP;
and the second switching module is used for removing the public IP from the host when the running state of software in the host is abnormal within a preset time period and the public IP is detected to be in the host.
A computer device includes a memory and a processor, where the memory stores a computer program that, when executed by the processor, causes the processor to perform the steps in the method for switching IP resources of a host-standby machine according to embodiments of the present application.
A computer readable storage medium having a computer program stored thereon, which when executed by a processor causes the processor to perform the steps in the method for switching IP resources of a host and a standby machine according to embodiments of the present application.
According to the method, the device, the computer equipment and the storage medium for switching the IP resources of the main machine and the standby machine, the standby machine detects the running state of the software in the standby machine, the heartbeat information of the standby machine containing the running state of the software in the standby machine is sent to the main machine according to the preset time interval, the heartbeat information of the running state main machine containing the software in the main machine, returned by the main machine in response to the heartbeat information of the standby machine, is received, and when the heartbeat communication ratio with the main machine is 100% in the preset time period, and the fact that the public IP is not in the standby machine and the running state of the software in the main machine is abnormal is detected, the public IP is switched to the standby machine. The heartbeat information of the host comprises the running state of software in the host, so that the running state of the host can be determined according to whether the heartbeat information can be received or not, the running state of the host can be determined more accurately according to the running state of the software in the host, and the public IP can be detected, so that the IP resources of the host and the host can be switched in time according to the running state of the software in the host and the state of the public IP. In addition, in a preset time period, when preset switching conditions are met, the IP resources can be switched in time, excessive time is not required to be consumed, and the fact that the IP resources of the main machine and the standby machine cannot be switched in time is further guaranteed.
Drawings
FIG. 1 is an application environment diagram of a method for switching primary and secondary IP resources in one embodiment;
FIG. 2 is a flow chart of a method for switching IP resources of a host and a standby in one embodiment;
FIG. 3 is a schematic overall flow chart of a method for a standby machine to perform primary-standby machine IP resource switching in one embodiment;
FIG. 4 is a flow chart of a method for switching IP resources of a host and a standby in one embodiment;
FIG. 5 is a schematic overall flow chart of a method for a host to perform a host-to-standby IP resource switching in one embodiment;
FIG. 6 is a schematic diagram illustrating interaction between a host and a standby in one embodiment;
FIG. 7 is a block diagram illustrating a configuration of a primary and secondary IP resource switching device according to an embodiment;
FIG. 8 is a block diagram illustrating a configuration of a primary and secondary IP resource switching device according to an embodiment;
fig. 9 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The method for switching the IP resources of the main machine and the standby machine can be applied to an application environment shown in figure 1. Wherein, the standby machine 102 and the host machine 104 communicate by sending heartbeat information through a network. Both the standby 102 and the host 104 may be servers. During the operation of the host, the standby machine is in a standby state, the host and the standby machine share the same public IP, and when the host fails, the IP resource of the host can be switched to the standby machine, and the standby machine continues to provide service.
In one embodiment, as shown in fig. 2, a method for switching IP resources of a primary and a secondary computers is provided, and the method is applied to the secondary computers in fig. 1 for illustration, and includes the following steps:
s202, detecting the running state of software in the standby machine, and sending heartbeat information of the standby machine to the host machine according to a preset time interval; the heartbeat information of the standby machine comprises the running state of software in the standby machine.
Wherein, the heartbeat information (i.e. heartbeat package) is used for sending the state of the heartbeat information to the opposite party at regular time between the host and the standby. The heartbeat information is sent at preset time intervals. The running state of the software in the standby machine is the running state of the software which needs to monitor the running state in the preset standby machine. The running state of the software is the running process of the software.
In one embodiment, a user may preset at least one piece of software in the machine that needs to monitor the operating state. It can be understood that the software in the preset equipment needs to monitor the running state, which is all or part of the software in the equipment.
In one embodiment, the running state of the software in the standby may include normal and abnormal.
Specifically, the standby machine detects the running state of software in the preset standby machine, which needs to monitor the running state, and sends heartbeat information of the standby machine to the host machine at regular intervals. The heartbeat information of the standby machine comprises the detected running state of software in the preset standby machine, wherein the running state of the software needs to be monitored.
S204, receiving heartbeat information of the host returned by the host in response to the heartbeat information of the standby; the heartbeat information of the host computer comprises the running state of software in the host computer.
The running state of the software in the host is the running state of the software in the preset host, which needs to be monitored.
In one embodiment, the user may preset at least one software in the host that needs to monitor the operating state. It can be understood that the software in the preset host that needs to monitor the running state is all or part of the software in the host.
In one embodiment, the running state of software in the host may include normal and abnormal.
Specifically, after receiving heartbeat information of the standby machine sent by the standby machine, the host machine responds to the heartbeat information of the standby machine, detects the running state of software in the host machine, and feeds back the heartbeat information of the host machine to the standby machine. The heartbeat information of the host computer comprises the detected running state of software in the preset host computer, wherein the running state of the software needs to be monitored. The standby machine receives the heartbeat information of the host machine returned by the host machine in response to the heartbeat information of the standby machine.
S206, detecting the public IP.
In one embodiment, detecting the public IP may include processing to read the IP local to the standby to confirm whether the public IP is on standby, and to detect whether the public IP is accessible (i.e., whether the public IP is online).
In one embodiment, the standby may remain detecting public IP at all times.
S208, when the heartbeat communication ratio with the host computer is 100% in the preset time period, and the public IP is detected to be not in the standby computer and the running state of software in the host computer is abnormal, switching the public IP to the standby computer; the heartbeat communication ratio is a ratio between the number of times heartbeat information of the host is actually received in a preset time period and the number of times heartbeat information of the host, which is returned, should be received by sending the heartbeat information of the standby at preset time intervals.
The preset time period is a preset time period for judging whether to switch the IP resources, namely, if the condition of switching the IP resources is met in the preset time period, the IP resources are switched; if the condition of switching the IP resources is not met, the IP resources are not switched, the timing is repeated, whether the condition of switching the IP resources is met in a preset time period is judged, and the like.
In one embodiment, the preset time period may be set according to the requirement, for example, the preset time period may be set to 5 seconds or 4 seconds, etc.
Specifically, when the following three conditions are simultaneously satisfied within a preset period of time: 1. the heartbeat communication ratio with the host is 100%, namely, the standby machine sends the heartbeat information of the standby machine to the host according to the preset time interval in the preset time period, and the heartbeat information of the host returned by the host can be received each time; 2. the standby machine detects that the public IP is not in the standby machine as a result of detecting the public IP; 3. the running state of software in the host computer contained in the heartbeat information of the host computer received by the standby computer is abnormal, and the standby computer switches the public IP to the standby computer (namely, the standby computer is connected with the public IP).
As shown in fig. 3, an overall flow chart of the method for the standby machine to perform the primary-standby machine IP resource switching is shown. The method in this embodiment corresponds to the method in fig. 3 that the heartbeat communication ratio between the standby machine and the host machine is 100% in the preset time period, and detects the public IP, and when detecting that the public IP is not in the standby machine and the running state of the software in the host machine is abnormal, switches the public IP to the standby machine, which is a flow path.
In one embodiment, when the heartbeat communication ratio of the standby machine and the host machine is 100% in the preset time period, and it is detected that the public IP is not in the standby machine and the running state of software in the host machine is normal, the standby machine does not switch the public IP until the running state of the software in the host machine contained in the received heartbeat information of the host machine is abnormal, and then the public IP is switched to the standby machine.
In the above method for switching the IP resources of the host and the standby machine, the running state of the software in the standby machine is detected, the heartbeat information of the standby machine including the running state of the software in the standby machine is sent to the host machine according to the preset time interval, then the heartbeat information of the running state host machine including the software in the host machine returned by the host machine in response to the heartbeat information of the standby machine is received, and when the heartbeat communication ratio with the host machine is 100% in the preset time period, and it is detected that the public IP is not in the standby machine and the running state of the software in the host machine is abnormal, the public IP is switched to the standby machine. The heartbeat information of the host comprises the running state of software in the host, so that the running state of the host can be determined according to whether the heartbeat information can be received or not, the running state of the host can be determined more accurately according to the running state of the software in the host, and the public IP can be detected, so that the IP resources of the host and the IP resources of the host can be switched in time according to the running state of the software in the host and the state of the public IP, and the accuracy of switching the IP resources of the host and the backup is improved. In addition, in the preset time period, when the preset switching condition is met, the IP resources can be switched in time, excessive time is not required to be consumed, and the failure of timely switching is caused, so that the IP resources of the main machine and the standby machine can be further ensured to be timely switched. In addition, according to the software running state in the heartbeat information, the public IP is switched in time, so that the loss of data in the switching process caused by the too slow public IP switching can be avoided, and the integrity of the data is ensured.
In one embodiment, the method further comprises the steps of: and when the heartbeat communication ratio with the host computer is 100% in the preset time period and the public IP is detected to be in the standby computer and the running state of software in the host computer is normal, removing the public IP from the standby computer.
Specifically, the standby machine may detect the public IP, and when the following 3 conditions are satisfied simultaneously within a preset period: 1. the heartbeat communication ratio of the standby machine to the host machine is 100%, namely, the standby machine sends heartbeat information of the standby machine to the host machine according to a preset time interval in a preset time period, and the heartbeat information of the host machine returned by the host machine can be received each time; 2. the standby machine detects that the public IP is in the standby machine; 3. when the running state of software in the host computer contained in the heartbeat information of the host computer received by the standby computer is normal, based on the principle of ensuring the normal service of the host computer preferentially, the public IP is removed from the standby computer (namely, the standby computer breaks the connection of the public IP), so that the host computer can normally connect the public IP, and the public IP connection conflict caused by the simultaneous connection of a plurality of servers to the public IP is avoided.
The method in this embodiment corresponds to the method in fig. 3, in which the heartbeat communication ratio between the standby machine and the host machine is 100% in the preset period, and detects the public IP, and when detecting that the public IP is in the standby machine and the running state of the software in the host machine is normal, the public IP is removed from the standby machine, which is a flow path.
In one embodiment, when the standby machine and the heartbeat communication ratio of the host machine are 100% in a preset time period, and it is detected that the public IP is in the standby machine and the running state of software in the host machine is abnormal, the public IP is not removed from the standby machine until the running state of the software in the host machine contained in the received heartbeat information of the host machine is normal, and the public IP is removed from the standby machine.
In this embodiment, when the standby machine and the heartbeat communication ratio of the host machine are 100% in the preset time period, and it is detected that the public IP is in the standby machine and the running state of software in the host machine is normal, the public IP is removed from the standby machine, and the service of the host machine is preferentially ensured under the normal state of software in the host machine, so that the host machine can be normally connected with the public IP, and the public IP connection conflict caused by that a plurality of servers are simultaneously connected with the public IP is avoided. In addition, the IP resources of the main machine and the standby machine can be switched in time according to the running state of software in the main machine and the detected public IP state. In addition, in the preset time period, when the preset switching condition is met, the IP resources can be switched in time, excessive time is not required to be consumed, and the failure of timely switching is caused, so that the IP resources of the main machine and the standby machine can be further ensured to be timely switched.
In one embodiment, the heartbeat information of the standby further includes a first public IP resource status. The first public IP resource status is used to characterize whether the public IP is on standby. After the step of removing the public IP from the standby, the method further comprises the steps of: generating heartbeat information of the standby machine and feeding back the heartbeat information to the host machine; the first public IP resource state in the heartbeat information of the standby machine fed back represents that the public IP is not on the standby machine; the first public IP resource state is used for indicating the host to switch the public IP to the host when the access loss rate of the public IP detected in the preset time period is greater than or equal to a preset access loss rate threshold value.
The access loss rate is a ratio between the number of times that the public IP is not accessed within a preset period of time and the total number of times that the public IP is attempted to be accessed. It will be appreciated that the total number of attempts to access the public IP includes the number of times the public IP was not accessed and the number of times the public IP was accessed. The preset access loss rate threshold is a preset threshold condition for determining that the public IP is not on-line (i.e., the public IP is not connected to the host and the standby) when the access loss rate is greater than or equal to the threshold.
In one embodiment, the first public IP resource status may include public IP on standby and public IP off standby.
Specifically, the standby machine may send heartbeat information to the host machine at regular intervals, and after the public IP is removed from the standby machine, the first public IP resource state in the heartbeat information generated by the standby machine and sent to the host machine characterizes that the public IP is not on the standby machine. The host may switch the public IP to the host (i.e., the host connects the public IP) when detecting that the access loss rate of the public IP is greater than or equal to a preset access loss rate threshold (i.e., it is determined that the public IP is not on-line) within a preset period of time after receiving heartbeat information sent by the standby that includes a status of a first public IP resource that characterizes the public IP is not on the standby.
In this embodiment, the heartbeat information of the standby machine further includes a first public IP resource state for indicating whether the public IP is in the standby machine, so that after the public IP is removed from the standby machine, the standby machine can feed back to the host machine that the public IP is not in the standby machine through the heartbeat information, and the standby machine can switch the public IP to the host machine in time according to the heartbeat information fed back by the standby machine. In addition, the host detects the public IP, and can further confirm that the public IP is not on-line, so that the public IP connection conflict caused by that a plurality of servers are simultaneously connected with the public IP is avoided. In addition, in the preset time period, when the preset switching condition is met, the IP resources can be switched in time, excessive time is not required to be consumed, and the failure of timely switching is caused, so that the IP resources of the main machine and the standby machine can be further ensured to be timely switched.
In one embodiment, the method further comprises the steps of: and when the heartbeat packet loss rate in the preset time period is greater than or equal to a preset heartbeat packet loss rate threshold value and the access loss rate of the public IP is detected to be greater than or equal to a preset access loss rate threshold value, switching the public IP to the standby machine.
The heartbeat packet loss rate is a ratio between the number of times that the heartbeat information of the host is not received in a preset time period and the number of times that the heartbeat information of the host, which is returned by sending the heartbeat information of the standby according to a preset time interval, is supposed to be received.
Specifically, after the standby machine sends heartbeat information of the standby machine to the host machine, when the heartbeat packet loss rate in a preset time period is greater than or equal to a preset heartbeat packet loss rate threshold value, the host machine indicates that a problem is likely to exist, and when the standby machine detects that the access loss rate of the public IP is greater than or equal to the preset access loss rate threshold value in the preset time period, the public IP is switched to the standby machine (namely, the standby machine is connected with the public IP).
The method in this embodiment corresponds to a flow path in fig. 3, where when the heartbeat packet loss rate of the standby machine in the preset time period is greater than or equal to the preset heartbeat packet loss rate threshold, and the access loss rate of the public IP detected by the public IP is greater than or equal to the preset access loss rate threshold (i.e., the public IP is not online), the public IP is switched to the standby machine.
In this embodiment, when the heartbeat packet loss rate of the standby machine in the preset time period is greater than or equal to the preset heartbeat packet loss rate threshold, the standby machine can determine that there is a possibility that the host machine has a problem in time, because the standby machine cannot receive the heartbeat information and cannot determine the running state of software in the host machine and whether the IP is in the host machine, the standby machine can determine whether to switch the public IP by detecting the public IP, and when the standby machine detects that the public IP is not online, the standby machine can switch the public IP to the standby machine in time. In addition, in a preset time period, when preset switching conditions are met, the IP resources can be switched in time, excessive time is not required to be consumed, and the fact that the IP resources of the main machine and the standby machine cannot be switched in time is further guaranteed.
In one embodiment, the method further comprises the steps of: and when the heartbeat packet loss rate in the preset time period is greater than or equal to a preset heartbeat packet loss rate threshold value and the access loss rate of the public IP is detected to be smaller than a preset access loss rate threshold value, continuing to detect the public IP until the access loss rate of the public IP in the preset time period is greater than or equal to the preset access loss rate threshold value, and switching the public IP to the standby machine.
Specifically, after the standby machine sends heartbeat information of the standby machine to the host machine, when the heartbeat packet loss rate in a preset time period is greater than or equal to a preset heartbeat packet loss rate threshold value, the host machine indicates that a problem is likely to exist, when the standby machine detects that the access loss rate of the public IP is smaller than the preset access loss rate threshold value (namely, the public IP is judged to be online) and the public IP is not in the standby machine in the preset time period, the public IP is continuously detected (the public IP is not switched) until the access loss rate of the public IP is greater than or equal to the preset access loss rate threshold value (namely, the public IP is judged to be not online) in the preset time period, and the public IP is switched to the standby machine.
It can be understood that when the heartbeat packet loss rate in the preset time period is greater than or equal to the preset heartbeat packet loss rate threshold, it indicates that there is a possibility that the host has a problem, but by detecting the public IP, it detects that the public IP is online and the public IP is not in the standby for the preset time period, which indicates that the host is normally connected with the public IP, the host has no problem, so the standby does not switch the public IP, continues to detect the public IP, and does not switch the public IP to the standby until the public IP is not online for the preset time period.
It can be understood that the heartbeat packet loss rate in the preset time period is greater than or equal to the preset heartbeat packet loss rate threshold, but the public IP is detected to be online and not in the standby, which may be caused by that the standby cannot receive the heartbeat information of the host due to the fact that the host is provided with a firewall and the like.
The method in this embodiment corresponds to a flow path in which the heartbeat packet loss rate of the standby machine in fig. 3 in a preset time period is greater than or equal to a preset heartbeat packet loss rate threshold, then the public IP is detected, and when the public IP is detected to be online and the public IP is not in the standby machine, the public IP is continuously detected.
In one embodiment, when the heartbeat packet loss rate of the standby machine in the preset time period is greater than or equal to the preset heartbeat packet loss rate threshold value, the public IP is detected, and when the access loss rate of the public IP is detected to be smaller than the preset access loss rate threshold value (i.e. the public IP is judged to be online) and the public IP is in the standby machine, the standby machine does not switch the public IP (i.e. the standby machine is kept connected with the public IP).
In this embodiment, when the heartbeat packet loss rate of the standby machine in the preset time period is greater than or equal to the preset heartbeat packet loss rate threshold, the public IP is detected, when the public IP is detected to be online and the public IP is not in the standby machine, the host machine is determined to have no problem, and the public IP is continuously detected until the public IP is not online in the preset time period, and the public IP is switched to the standby machine. The public IP is not switched on one-sided basis on whether heartbeat information is received or not, and the state of the host is further confirmed by detecting the public IP, so that the public IP can be switched more accurately, and the error switching of the public IP is avoided.
In one embodiment, as shown in fig. 4, a method for switching IP resources of a host and a standby is provided, and the method is applied to the host in fig. 1 for illustration, and includes the following steps:
s402, receiving heartbeat information of the standby machine, which is sent by the standby machine according to a preset time interval; the heartbeat information of the standby machine comprises the running state of software in the standby machine.
Specifically, the standby machine detects the running state of software in the preset standby machine, which needs to monitor the running state, and sends heartbeat information of the standby machine to the host machine at regular intervals. And the host receives the heartbeat information of the standby machine, which is sent by the standby machine. The heartbeat information of the standby machine comprises the detected running state of software in the preset standby machine, wherein the running state of the software needs to be monitored.
S404, responding to the heartbeat information of the standby machine, detecting the running state of software in the host machine, and sending the heartbeat information of the host machine to the standby machine; the heartbeat information of the host computer comprises the running state of software in the host computer.
Specifically, the host responds to the heartbeat information of the standby machine, detects the running state of software in the host, and sends the heartbeat information of the host to the standby machine. The heartbeat information of the host computer comprises the detected running state of software in the preset host computer, wherein the running state of the software needs to be monitored.
It can be understood that, if the heartbeat information of the standby machine received by the host machine includes information of which type, the host machine responds to the heartbeat information of the standby machine, and feeds back the heartbeat information including information of the corresponding type to the standby machine.
S406, detecting the public IP.
In one embodiment, detecting the public IP may include reading the IP local to the host to confirm whether the public IP is on the host, detecting whether the public IP is accessible (i.e., whether the public IP is online), and so on.
In one embodiment, the host may keep detecting public IP at all times.
S408, when the running state of the software in the host is abnormal in the preset time period and the public IP is detected to be in the host, the public IP is removed from the host.
Specifically, when the host detects that the running state of software in the host is abnormal and that the public IP is in the host within a preset period of time, the public IP is removed from the host (i.e., the host disconnects the public IP).
In one embodiment, the heartbeat information of the host further includes a second public IP resource status. The second public IP resource status is used to characterize whether public IP is on the host. And when the host detects that the running state of software in the host is abnormal in a preset time period, removing the public IP from the host, and sending a second public IP resource state which characterizes that the public IP is not in the host to the standby through heartbeat information. And the standby machine determines that the running state of software in the host machine is abnormal and the public IP is not in the host machine according to the received heartbeat information of the host machine, detects the public IP, and switches the public IP to the standby machine (namely, the standby machine is connected with the public IP) when the access loss rate of the public IP in a preset time period is larger than or equal to a preset access loss rate threshold value and the public IP is not in the standby machine.
Fig. 5 is a schematic overall flow chart of a method for executing the IP resource switching between the host and the standby. The method in this embodiment corresponds to a flow path in which the host removes the public IP from the host when the running state of the software in the host in fig. 5 is abnormal.
In the above method for switching the IP resources of the host and the standby machine, the host receives the heartbeat information of the standby machine, detects the running state of the software in the host in response to the heartbeat information of the standby machine, and sends the heartbeat information of the host including the running state of the software in the host to the standby machine. In addition, in a preset time period, when preset switching conditions are met, the IP resources can be switched in time, excessive time is not required to be consumed, and the fact that the IP resources of the main machine and the standby machine cannot be switched in time is further guaranteed.
In one embodiment, the method further comprises the steps of: and when the running state of software in the host is normal within the preset time period, the public IP is detected to be not in the host, and the access loss rate of the public IP is greater than or equal to the preset access loss rate threshold value, switching the public IP to the host.
Specifically, when the following 3 conditions are simultaneously satisfied within a preset period of time: 1. the host detects that the running state of software in the host is normal; 2. the host detects that the public IP is not in the host; 3. and if the host detects that the access loss rate of the public IP is greater than or equal to a preset access loss rate threshold (i.e. the public IP is judged to be not on-line), the public IP is switched to the host (i.e. the host is connected with the public IP).
The method in this embodiment corresponds to a flow path in which the running state of software in the host in fig. 5 is normal, and when the host detects that the public IP is not on-line, the public IP is switched to the host.
In one embodiment, when the running state of software in the host is normal and the host detects that the public IP is on-line and the public IP is on the host, then the public IP is not switched (i.e., the host remains connected to the public IP).
In this embodiment, the host computer can switch the public IP to the host computer in time according to the running state of the software in the host computer and the state of the public IP.
In one embodiment, the heartbeat information of the host further includes a second public IP resource status. The second public IP resource status is used to characterize whether public IP is on the host. The method further comprises the steps of: when detecting that the public IP is not in the host computer in a preset time period and the access loss rate of the public IP is smaller than a preset access loss rate threshold value, generating heartbeat information of the host computer and feeding back the heartbeat information to the standby computer; the second public IP resource state in the heartbeat information of the fed back host characterizes that the public IP is not in the host; the second public IP resource state is used for indicating the standby machine to remove the public IP from the standby machine when the standby machine detects that the public IP is in the standby machine; and continuing to detect the public IP until the access loss rate of the public IP is greater than or equal to a preset access loss rate threshold value in a preset time period, and switching the public IP to the host.
In one embodiment, the second public IP resource status may include public IP on-host and public IP off-host.
Specifically, when the following three conditions are simultaneously satisfied within a preset period of time: 1. the host detects that the running state of software in the host is normal; 2. the host detects that the public IP is not in the host; 3. when the host detects that the access loss rate of the public IP is smaller than a preset access loss rate threshold (namely, the public IP is judged to be online), the second public IP resource state in the heartbeat information fed back to the host of the standby machine represents that the public IP is not in the host. The standby machine receives the heartbeat information of the host machine sent by the host machine, determines that the running state of software in the host machine is normal and the public IP is not in the host machine according to the heartbeat information of the host machine, continues to detect the public IP, and removes the public IP from the standby machine when the standby machine detects that the public IP is in the standby machine (namely, the standby machine breaks the connection of the public IP). The host continues to detect the public IP until it is detected that the access loss rate of the public IP is less than the preset access loss rate threshold (i.e., it is determined that the public IP is not on-line and the standby has removed the public IP), then the public IP is switched to the host (i.e., the host connects the public IP).
In this embodiment, when the host detects that the public IP is not in the host and the public IP is online, heartbeat information including a second public IP resource state indicating that the public IP is not in the host is generated and fed back to the standby machine, so that the standby machine timely removes the public IP from the standby machine according to the second public IP resource state in the heartbeat information of the host and the state of software in the host. The host detects through the public IP, and when detecting that the public IP is not on-line, the host can switch the public IP to the host in time.
Fig. 6 is a schematic diagram of interaction between a host and a standby machine in each embodiment of the present application, where the host and the standby machine send heartbeat information to each other, and send a software state (i.e. an operation state of software in the host and the standby machine) through the heartbeat information, and both the host and the standby machine can detect a public IP.
It should be understood that, although the steps in the flowcharts of fig. 2 and 4 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least a portion of the steps in fig. 2 and 4 may include a plurality of steps or stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the execution of the steps or stages is not necessarily sequential, but may be performed in turn or alternately with at least a portion of the steps or stages in other steps or other steps.
In one embodiment, as shown in fig. 7, a master-slave IP resource switching apparatus 700 is provided, and the apparatus is disposed in a slave. The device comprises: a first transmitting module 702, a first receiving module 704, a first detecting module 706, and a first switching module 708, wherein:
The first sending module 702 is configured to detect an operation state of software in the standby machine, and send heartbeat information of the standby machine to the host machine according to a preset time interval; the heartbeat information of the standby machine comprises the running state of software in the standby machine.
A first receiving module 704, configured to receive heartbeat information of the host returned by the host in response to the heartbeat information of the standby; the heartbeat information of the host computer comprises the running state of software in the host computer.
The first detecting module 706 is configured to detect the public IP.
A first switching module 708, configured to switch the public IP to the standby when the heartbeat communication ratio with the host is 100% in the preset period of time, and the public IP is detected not to be in the standby, and the running state of software in the host is abnormal; the heartbeat communication ratio is a ratio between the number of times heartbeat information of the host is actually received in a preset time period and the number of times heartbeat information of the host, which is returned, should be received by sending the heartbeat information of the standby at preset time intervals.
In one embodiment, the first switching module 708 is further configured to remove the public IP from the standby when the heartbeat communication ratio with the host is 100% in the preset period of time, and the public IP is detected to be in the standby and the running state of the software in the host is normal.
In one embodiment, the heartbeat information of the standby further includes a first public IP resource status. The first public IP resource status is used to characterize whether the public IP is on standby. The first sending module 702 is further configured to generate heartbeat information of the standby machine and feed back the heartbeat information to the host machine; the first public IP resource state in the heartbeat information of the standby machine fed back represents that the public IP is not on the standby machine; the first public IP resource state is used for indicating the host to switch the public IP to the host when the access loss rate of the public IP detected in the preset time period is greater than or equal to a preset access loss rate threshold value.
In one embodiment, the first switching module 708 is further configured to switch the public IP to the standby when the heartbeat packet loss rate in the preset time period is greater than or equal to the preset heartbeat packet loss rate threshold and the access loss rate of the public IP is detected to be greater than or equal to the preset access loss rate threshold. The heartbeat packet loss rate is a ratio between the number of times that the heartbeat information of the host is not received in a preset time period and the number of times that the heartbeat information of the host, which is returned by sending the heartbeat information of the standby according to a preset time interval, is supposed to be received.
In one embodiment, the first switching module 708 is further configured to, when the heartbeat packet loss rate in the preset period is greater than or equal to the preset heartbeat packet loss rate threshold and the access loss rate of the public IP is detected to be less than the preset access loss rate threshold, continue to detect the public IP until the access loss rate of the public IP in the preset period is greater than or equal to the preset access loss rate threshold, and switch the public IP to the standby machine.
In one embodiment, as shown in fig. 8, a host-to-standby IP resource switching apparatus 800 is provided, which is disposed in a host. The device comprises: a second receiving module 802, a second sending module 804, a second detecting module 806, and a second switching module 808, wherein:
a second receiving module 802, configured to receive heartbeat information of the standby machine sent by the standby machine according to a preset time interval; the heartbeat information of the standby machine comprises the running state of software in the standby machine.
The second sending module 804 is configured to respond to the heartbeat information of the standby machine, detect an operation state of software in the host machine, and send the heartbeat information of the host machine to the standby machine; the heartbeat information of the host computer comprises the running state of software in the host computer.
A second detecting module 806, configured to detect the public IP.
A second switching module 806, configured to remove the public IP from the host when the running state of the software in the host is abnormal and the public IP is detected to be in the host.
In one embodiment, the second switching module 806 is further configured to switch the public IP to the host when the running state of software in the host is normal and it is detected that the public IP is not in the host and the access loss rate of the public IP is greater than or equal to the preset access loss rate threshold in a preset period of time.
In one embodiment, the heartbeat information of the host further includes a second public IP resource status. The second public IP resource status is used to characterize whether public IP is on the host. The second sending module 804 is further configured to generate heartbeat information of the host and feed the heartbeat information back to the standby when it is detected that the public IP is not in the host and the access loss rate of the public IP is less than a preset access loss rate threshold in a preset time period; the second public IP resource state in the heartbeat information of the fed back host characterizes that the public IP is not in the host; the second public IP resource state is used for indicating the standby machine to remove the public IP from the standby machine when the standby machine detects that the public IP is in the standby machine; and continuing to detect the public IP until the access loss rate of the public IP is greater than or equal to a preset access loss rate threshold value in a preset time period, and switching the public IP to the host.
In the above-mentioned master-slave IP resource switching apparatus, the running state of the software in the slave machine is detected, the heartbeat information of the slave machine including the running state of the software in the slave machine is sent to the host machine, then the heartbeat information of the host machine including the running state of the software in the host machine returned by the host machine in response to the heartbeat information of the slave machine is received, and when the public IP is detected not to be in the slave machine and the running state of the software in the host machine is abnormal, the public IP is switched to the slave machine. The heartbeat information of the host comprises the running state of software in the host, so that the running state of the host can be determined according to whether the heartbeat information can be received or not, the running state of the host can be determined more accurately according to the running state of the software in the host, and the public IP can be detected, so that the IP resources of the host and the host can be switched in time according to the running state of the software in the host and the state of the public IP. In addition, in the preset time period, when the preset switching condition is met, the IP resources can be switched in time, excessive time is not required to be consumed, and the failure of timely switching is caused, so that the IP resources of the main machine and the standby machine can be further ensured to be timely switched. In addition, according to the software running state in the heartbeat information, the public IP is switched in time, so that the loss of data in the switching process caused by the too slow public IP switching can be avoided, and the integrity of the data is ensured.
For specific limitation of the primary-standby IP resource switching apparatus, reference may be made to the limitation of the primary-standby IP resource switching method hereinabove, and no further description is given here. All or part of the modules in the above-mentioned master-slave IP resource switching device may be implemented by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 9. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing service data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program when executed by a processor implements a method for switching between primary and secondary IP resources.
It will be appreciated by those skilled in the art that the structure shown in fig. 9 is merely a block diagram of a portion of the structure associated with the present application and is not limiting of the computer device to which the present application applies, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, carries out the steps of the method embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (10)

1. The method is characterized in that the method is applied to the standby machine; the method comprises the following steps:
detecting the running state of software in the standby machine, and sending heartbeat information of the standby machine to a host machine according to a preset time interval; the heartbeat information of the standby machine comprises the running state of software in the standby machine;
receiving heartbeat information of the host returned by the host in response to the heartbeat information of the standby; the heartbeat information of the host comprises the running state of software in the host;
Detecting public IP; the detecting public IP includes reading the local IP of the standby machine to confirm whether the public IP is in the standby machine and detecting the access loss rate of the public IP;
when the heartbeat communication ratio with the host computer is 100% in a preset time period and the public IP is detected to be not in the standby computer and the running state of software in the host computer is abnormal, switching the public IP to the standby computer; the heartbeat communication ratio is the ratio between the number of times of actually receiving the heartbeat information of the host computer in a preset time period and the number of times of receiving the returned heartbeat information of the host computer, which is required to be received by sending the heartbeat information of the standby computer according to a preset time interval;
when the heartbeat packet loss rate in the preset time period is greater than or equal to a preset heartbeat packet loss rate threshold value and the access loss rate of the public IP is detected to be greater than or equal to a preset access loss rate threshold value, switching the public IP to the standby machine; the heartbeat packet loss rate is a ratio between the number of times that the heartbeat information of the host is not received in a preset time period and the number of times that the heartbeat information of the host is received in return after the heartbeat information of the standby is sent according to a preset time interval;
And when the heartbeat packet loss rate in the preset time period is greater than or equal to a preset heartbeat packet loss rate threshold value and the access loss rate of the public IP is detected to be smaller than a preset access loss rate threshold value, continuing to detect the public IP until the access loss rate of the public IP in the preset time period is greater than or equal to a preset access loss rate threshold value, and switching the public IP to the standby machine.
2. The method according to claim 1, wherein the method further comprises:
and when the heartbeat communication ratio with the host is 100% in a preset time period and the public IP is detected to be in the standby machine and the running state of software in the host machine is normal, removing the public IP from the standby machine.
3. The method of claim 2, wherein the heartbeat information of the standby further includes a first public IP resource status; the first public IP resource state is used for representing whether public IP is in the standby machine or not;
after removing the public IP from the standby, the method further comprises:
generating heartbeat information of the standby machine and feeding back the heartbeat information to the host machine; the first public IP resource state in the heartbeat information of the fed back standby machine represents that the public IP is not on the standby machine; the first public IP resource status is configured to instruct the host to switch the public IP to the host when the host detects that the access loss rate of the public IP is greater than or equal to a preset access loss rate threshold in a preset time period.
4. A method for switching the IP resources of a host and a standby is characterized in that the method is applied to the host; the method comprises the following steps:
receiving heartbeat information of a standby machine, which is sent by the standby machine according to a preset time interval; the heartbeat information of the standby machine comprises the running state of software in the standby machine;
responding to the heartbeat information of the standby machine, detecting the running state of software in the host machine, and sending the heartbeat information of the host machine to the standby machine; the heartbeat information of the host comprises the running state of software in the host and the state of a second public IP resource; the second public IP resource status is used to characterize whether public IP is at the host;
detecting public IP; the detecting public IP includes reading the local IP of the standby machine to confirm whether the public IP is in the standby machine and detecting the access loss rate of the public IP;
when the running state of software in the host is abnormal within a preset time period and the public IP is detected to be in the host, the public IP is removed from the host;
when the running state of software in the host is normal within a preset time period and the public IP is detected not to be in the host and the access loss rate of the public IP is greater than or equal to a preset access loss rate threshold value, switching the public IP to the host;
When detecting that the public IP is not in the host computer in a preset time period and the access loss rate of the public IP is smaller than a preset access loss rate threshold, generating heartbeat information of the host computer and feeding back the heartbeat information to the standby computer; the second public IP resource state in the heartbeat information of the host fed back represents that the public IP is not in the host; the second public IP resource state is used for indicating the standby machine to remove the public IP from the standby machine when the standby machine detects that the public IP is in the standby machine; and continuing to detect the public IP until the access loss rate of the public IP is greater than or equal to a preset access loss rate threshold value in a preset time period, and switching the public IP to the host.
5. The device is characterized in that the device is arranged in the equipment; the device comprises:
the first sending module is used for detecting the running state of software in the standby machine and sending the heartbeat information of the standby machine to the host machine according to a preset time interval; the heartbeat information of the standby machine comprises the running state of software in the standby machine;
the first receiving module is used for receiving the heartbeat information of the host returned by the host in response to the heartbeat information of the standby; the heartbeat information of the host comprises the running state of software in the host;
The first detection module is used for detecting the public IP; the detecting public IP includes reading the local IP of the standby machine to confirm whether the public IP is in the standby machine and detecting the access loss rate of the public IP;
the first switching module is used for switching the public IP to the standby machine when the heartbeat communication ratio with the host machine is 100% in a preset time period and the public IP is detected not to be in the standby machine and the running state of software in the host machine is abnormal; the heartbeat communication ratio is the ratio between the number of times of actually receiving the heartbeat information of the host computer in a preset time period and the number of times of receiving the returned heartbeat information of the host computer, which is required to be received by sending the heartbeat information of the standby computer according to a preset time interval;
the first switching module is further configured to switch the public IP to the standby machine when the heartbeat packet loss rate in the preset time period is greater than or equal to a preset heartbeat packet loss rate threshold and the access loss rate of the public IP is detected to be greater than or equal to a preset access loss rate threshold; the heartbeat packet loss rate is a ratio between the number of times that the heartbeat information of the host is not received in a preset time period and the number of times that the heartbeat information of the host is received in return after the heartbeat information of the standby is sent according to a preset time interval;
The first switching module is further configured to continuously detect the public IP when the heartbeat packet loss rate is greater than or equal to a preset heartbeat packet loss rate threshold in a preset time period and the access loss rate of the public IP is detected to be less than a preset access loss rate threshold, until the access loss rate of the public IP is greater than or equal to a preset access loss rate threshold in the preset time period, and switch the public IP to the standby machine.
6. The apparatus of claim 5, wherein the first switching module is further configured to remove the public IP from the standby when the heartbeat communication ratio with the host is 100% and the public IP is detected to be normal in the standby and the running state of software in the host is detected within a preset period of time.
7. The apparatus of claim 6, wherein the heartbeat information of the standby further comprises a first public IP resource status; the first public IP resource state is used for representing whether public IP is in the standby machine or not;
the first sending module is further configured to generate heartbeat information of the standby machine and feed back the heartbeat information to the host machine; the first public IP resource state in the heartbeat information of the fed back standby machine represents that the public IP is not on the standby machine; the first public IP resource status is configured to instruct the host to switch the public IP to the host when the host detects that the access loss rate of the public IP is greater than or equal to a preset access loss rate threshold in a preset time period.
8. The device is characterized in that the device is arranged in a host; the device comprises:
the second receiving module is used for receiving heartbeat information of the standby machine, which is sent by the standby machine according to a preset time interval; the heartbeat information of the standby machine comprises the running state of software in the standby machine;
the second sending module is used for responding to the heartbeat information of the standby machine, detecting the running state of software in the host machine and sending the heartbeat information of the host machine to the standby machine; the heartbeat information of the host comprises the running state of software in the host and the state of a second public IP resource; the second public IP resource status is used to characterize whether public IP is at the host;
the second detection module is used for detecting the public IP; the detecting public IP includes reading the local IP of the standby machine to confirm whether the public IP is in the standby machine and detecting the access loss rate of the public IP;
the second switching module is used for removing the public IP from the host when the running state of software in the host is abnormal and the public IP is detected to be in the host within a preset time period;
the second switching module is further configured to switch the public IP to the host when the running state of software in the host is normal and the public IP is detected not to be in the host within a preset time period and the access loss rate of the public IP is greater than or equal to a preset access loss rate threshold;
The second switching module is further configured to generate heartbeat information of the host and feed the heartbeat information back to the standby when it is detected that the public IP is not in the host and the access loss rate of the public IP is less than a preset access loss rate threshold in a preset time period; the second public IP resource state in the heartbeat information of the host fed back represents that the public IP is not in the host; the second public IP resource state is used for indicating the standby machine to remove the public IP from the standby machine when the standby machine detects that the public IP is in the standby machine; and continuing to detect the public IP until the access loss rate of the public IP is greater than or equal to a preset access loss rate threshold value in a preset time period, and switching the public IP to the host.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 4 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 4.
CN202010670026.2A 2020-07-13 2020-07-13 Main-standby machine IP resource switching method, device, computer equipment and storage medium Active CN111934909B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010670026.2A CN111934909B (en) 2020-07-13 2020-07-13 Main-standby machine IP resource switching method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010670026.2A CN111934909B (en) 2020-07-13 2020-07-13 Main-standby machine IP resource switching method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111934909A CN111934909A (en) 2020-11-13
CN111934909B true CN111934909B (en) 2023-06-13

Family

ID=73312873

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010670026.2A Active CN111934909B (en) 2020-07-13 2020-07-13 Main-standby machine IP resource switching method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111934909B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113596197B (en) * 2021-09-26 2021-12-21 武汉四通信息服务有限公司 Address switching method and device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2400726A1 (en) * 2010-06-25 2011-12-28 Societé Française du Radiotéléphone Method for identifying a local network identified by a public IP address
CN103731294A (en) * 2013-03-28 2014-04-16 深圳市金溢科技有限公司 Method, device and system for two-machine hot-standby communication
CN104243719A (en) * 2013-06-08 2014-12-24 中国移动通信集团公司 Heartbeat period determining method, system and device for long connection in mobile communication network
CN104660441A (en) * 2013-11-25 2015-05-27 北京信威通信技术股份有限公司 Method, device and system for achieving high reliability of server
CN106559267A (en) * 2016-11-25 2017-04-05 聚好看科技股份有限公司 The master-slave switching method of Redis, device and redis systems
CN111162941A (en) * 2019-12-26 2020-05-15 浪潮云信息技术有限公司 Method for automatically managing virtual IP (Internet protocol) in Kubernetes environment

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080198740A1 (en) * 2007-02-20 2008-08-21 Inventec Corporation Service take-over system of multi-host system and method therefor
CN103490914A (en) * 2012-06-08 2014-01-01 华耀(中国)科技有限公司 Switching system and switching method for multi-machine hot standby of network application equipment
CN106095526A (en) * 2016-06-06 2016-11-09 腾讯科技(深圳)有限公司 Virtual Server Cluster and the dispositions method of server, device and system
CN108259629B (en) * 2016-12-28 2021-07-23 阿里巴巴集团控股有限公司 Virtual internet protocol address switching method and device
CN107919994B (en) * 2017-12-13 2021-06-08 南京熊猫电子股份有限公司 Method and server for realizing hot standby of network service dual-computer
CN109344014B (en) * 2018-09-26 2022-02-11 新华三大数据技术有限公司 Main/standby switching method and device and communication equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2400726A1 (en) * 2010-06-25 2011-12-28 Societé Française du Radiotéléphone Method for identifying a local network identified by a public IP address
CN103731294A (en) * 2013-03-28 2014-04-16 深圳市金溢科技有限公司 Method, device and system for two-machine hot-standby communication
CN104243719A (en) * 2013-06-08 2014-12-24 中国移动通信集团公司 Heartbeat period determining method, system and device for long connection in mobile communication network
CN104660441A (en) * 2013-11-25 2015-05-27 北京信威通信技术股份有限公司 Method, device and system for achieving high reliability of server
CN106559267A (en) * 2016-11-25 2017-04-05 聚好看科技股份有限公司 The master-slave switching method of Redis, device and redis systems
CN111162941A (en) * 2019-12-26 2020-05-15 浪潮云信息技术有限公司 Method for automatically managing virtual IP (Internet protocol) in Kubernetes environment

Also Published As

Publication number Publication date
CN111934909A (en) 2020-11-13

Similar Documents

Publication Publication Date Title
US10095576B2 (en) Anomaly recovery method for virtual machine in distributed environment
CN109274544B (en) Fault detection method and device for distributed storage system
US20080288812A1 (en) Cluster system and an error recovery method thereof
CN112217658B (en) Stacking and splitting processing method and device
CN111880906A (en) Virtual machine high-availability management method, system and storage medium
CN112769652B (en) Node service monitoring method, device, equipment and medium
CN111901176B (en) Fault determination method, device, equipment and storage medium
CN109768884A (en) The implementation method of communication system and its high availability, device and computer equipment
CN111934909B (en) Main-standby machine IP resource switching method, device, computer equipment and storage medium
CN114168071B (en) Distributed cluster capacity expansion method, distributed cluster capacity expansion device and medium
CN108924772B (en) Short message sending method and device, computer equipment and storage medium
US8533528B2 (en) Fault tolerant power sequencer
CN111064613B (en) Network fault detection method and device
CN111949384B (en) Task scheduling method, device, equipment and computer readable storage medium
CN114978871B (en) Node switching method and node switching device of service system and electronic equipment
CN115686951A (en) Fault processing method and device for database server
CN113157493A (en) Backup method, device and system based on ticket checking system and computer equipment
CN110321261B (en) Monitoring system and monitoring method
CN111211924A (en) Method and device for controlling single point high availability of computing node
CN113051143A (en) Detection method, device, equipment and storage medium for service load balancing server
CN111651294B (en) Node abnormality detection method and device
CN115695532B (en) Method and device for processing message by message middleware and computer equipment
CN115103006A (en) Heartbeat message sending method under distributed storage cluster scene and related components thereof
JP2007026038A (en) Path monitoring system, path monitoring method and path monitoring program
CN116668335A (en) Cluster service processing method, server and 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
GR01 Patent grant
GR01 Patent grant