CN103944698B - A kind of double hot standby method - Google Patents

A kind of double hot standby method Download PDF

Info

Publication number
CN103944698B
CN103944698B CN201410143004.5A CN201410143004A CN103944698B CN 103944698 B CN103944698 B CN 103944698B CN 201410143004 A CN201410143004 A CN 201410143004A CN 103944698 B CN103944698 B CN 103944698B
Authority
CN
China
Prior art keywords
client
service response
standby host
main frame
bag
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
CN201410143004.5A
Other languages
Chinese (zh)
Other versions
CN103944698A (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.)
Huayan Intelligent Technology (Group) Co., Ltd
Original Assignee
Sichuan Whayer Information Industry 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 Sichuan Whayer Information Industry Co Ltd filed Critical Sichuan Whayer Information Industry Co Ltd
Priority to CN201410143004.5A priority Critical patent/CN103944698B/en
Publication of CN103944698A publication Critical patent/CN103944698A/en
Application granted granted Critical
Publication of CN103944698B publication Critical patent/CN103944698B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

Include the present invention relates to a kind of double hot standby method:Main frame receives the service data of client, produces corresponding service response data, and the link information between service response data and main frame and client is sent into standby host;The link information includes:The sequence number that IP, port numbers, MAC Address and the main frame of client and the TCP of client are linked;Standby host is received after service response data and the link information transmitted by main frame, the service response data and the link information is backed up, and the service response data are sent into client with the identity of main frame;When main frame breaks down, the IP address of itself is changed to the IP address of main frame by standby host;The sequence number that standby host is linked using the TCP of the main frame and client sends service response data to client.Double hot standby method provided by the present invention, can normally be used after hot standby switch, it is ensured that the TCP between standby host and client, which is linked, to be terminated.

Description

A kind of double hot standby method
Technical field
The present invention relates to computer realm, more particularly, to a kind of double hot standby method.
Background technology
Server reliability of operation and continuity be it is vital, more particularly, to Base communication, electric power, monitoring, The key facility system such as traffic.These important systems are required for certain hot backup redundancy mechanism, i.e., when server crash, energy Enough ensure the normal operation of these important systems, prevent the catastrophic effect produced due to server crash.
Double hot standby method is specifically referred to while make two servers of identical work, wherein based on a server simultaneously Server, also known as main frame;An other server is standby server, also known as standby host.Once main frame breaks down, system is automatic Switch to standby host so that standby host takes over the work of main frame, so as to ensure the normal operation of system.
Current double hot standby method is:Main frame is connected to after the service request bag of customer side transmission, can produce corresponding clothes Business response bag, main frame sends all response bags for being sent to client while service response bag is sent into client Backed up, gone wrong when client detects main frame to standby host, to standby host initiate TCP link, standby host with client it Between set up TCP link after, to client provide service.
But, this two-node cluster hot backup switching method only focus on data in magnetic disk, database synchronization it is hot standby, do not account for net The hot standby needs of network link itself, it means that after the work that standby host takes over main frame, client must again be sent out to standby host Rise and establish the link, linking between client before and main frame is invalid.Initiated again to standby host in time once client is no Set up new link, then communication will be terminated.
The content of the invention
It is an object of the invention to provide a kind of double hot standby method, to solve the above problems.
In order to achieve the above object, the technical proposal of the invention is realized in this way:
A kind of double hot standby method, including:
Main frame receives the service data of client, produces corresponding service response data, and by service response data And the link information between main frame and client is sent to standby host;The link information includes:The IP of client, port numbers with And the sequence number that main frame and the TCP of client are linked;
Standby host is received after service response data and the link information transmitted by main frame, by the service response Data and link information backup, and the service response data are sent to client with the identity of main frame;
When main frame breaks down, the IP address of itself is changed to the IP address of main frame by standby host;
The sequence number that standby host is linked using the TCP of the main frame and client sends service response data to client.
The double hot standby method that the present invention is provided, compared to existing technologies, passes through all clothes for being sent main frame Business reply data forwarding flows through standby host, standby host is kept the real-time synchronization with mainframe network data.Simultaneously also by main frame and client Link information between end is also sent to standby host., should after standby host receives this service response data and link information Link information of the answer according to this and between client and main frame is backed up, in link information, includes IP, the end of client The sequence number that slogan and main frame and the TCP of client are linked, when standby host completes the standby of service response data and link information After part, service response data are issued client by standby host with the identity of main frame, therefore client will be considered that its service received Reply data comes from main frame.When main frame breaks down, standby host seizes the IP address of main frame, i.e., be changed to the IP of itself Host ip, while after the service data transmitted by client is received, producing corresponding service response data, using master The sequence number that machine and the TCP of client are linked sends service response data to client.Then client can think that it is received always To service response data be to be sent by main frame, eliminate redialing for client, accomplish that the nothing of client is discovered, this causes Many clients for not redialing mechanism also can normally be used after hot standby switch, it is ensured that linking between standby host and client It will not be terminated.
This design framework that standby machine is cascaded proposed in the present invention, can make full use of Transmission Control Protocol The reliability mechanisms of itself ensure the reliable synchronization of hot standby network data, but add certain network burden.Any one Moment, if client sends request and do not receive response, then it can repeat requests.When client have received response, then Represent that backed up in synchronization crosses the TCP bag datas to standby host.Therefore, theoretically, data are that overall safety is reliable.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is the accompanying drawing used required in technology description to make one simply to introduce, it should be apparent that, drawings in the following description are these Some embodiments of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can be with Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is the schematic flow sheet for the double hot standby method that the embodiment of the present invention one is provided;
During Fig. 2 is the double hot standby method that the embodiment of the present invention two is provided, main frame is by service response data and main frame Link information between client is sent to the schematic flow sheet of the detailed process of standby host.
Fig. 3 is that on the basis of embodiment two, in the double hot standby method that the embodiment of the present invention three is provided, standby host is by institute State the specific flow chart that service response data are sent to client with the identity of main frame;
During Fig. 4 is the double hot standby method that the embodiment of the present invention four is provided, another main frame by service response data with And the link information between main frame and client is sent to the schematic flow sheet of standby host;
Fig. 5 is that on the basis of example IV, in the double hot standby method that the embodiment of the present invention five is provided, standby host is by institute State the specific flow chart that service response data are sent to client with the identity of main frame;
During Fig. 6 is the double hot standby method that the embodiment of the present invention six is provided, another main frame by service response data with And the link information between main frame and client is sent to the schematic flow sheet of standby host;
Fig. 7 is that on the basis of embodiment six, in the double hot standby method that the embodiment of the present invention seven is provided, standby host is by institute State the specific flow chart that service response data are sent to client with the identity of main frame;
During Fig. 8 is the double hot standby method that the embodiment of the present invention eight is provided, standby host uses the main frame and client The sequence number of TCP links sends the flow chart of service response data to client;
During Fig. 9 is the double hot standby method that the embodiment of the present invention nine is provided, another standby host uses the main frame and visitor The sequence number of the TCP links at family end sends the flow chart of service response data to client;
Figure 10 is the standby host of the offer of the embodiment of the present invention ten sending service response bag to client and receives client During transmitted service request bag, the specific method that the TCP sequence number to service response bag and service request bag is changed Flow chart.
Embodiment
To make the target, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is A part of embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
Fig. 1 is the schematic flow sheet for the double hot standby method that the embodiment of the present invention one is provided.It is shown in Figure 1, this hair The double hot standby method that bright embodiment is provided includes:
Step 101:Main frame receives the service data of client, produces corresponding service response data, and will service Link information between reply data and main frame and client is sent to standby host;The link information includes:The IP of client, The sequence number that port numbers and main frame and the TCP of client are linked;
Step 102:Standby host is received after service response data and the link information transmitted by main frame, will be described Service response data and link information backup, and the service response data are sent to client with the identity of main frame End;
Step 103:When main frame breaks down, the IP address of itself is changed to the IP address of main frame by standby host;
Step 104:The sequence number that standby host is linked using the TCP of the main frame and client sends service response to client Data.
The double hot standby method that the present invention is provided, compared to existing technologies, passes through all clothes for being sent main frame Business reply data forwarding flows through standby host, standby host is kept the real-time synchronization with mainframe network data.Simultaneously also by main frame and client Link information between end is also sent to standby host., should after standby host receives this service response data and link information Link information of the answer according to this and between client and main frame is backed up, in link information, includes IP, the end of client The sequence number that slogan and main frame and the TCP of client are linked, when standby host completes the standby of service response data and link information After part, service response data are issued client by standby host with the identity of main frame, therefore client will be considered that its service received Reply data comes from main frame.When main frame breaks down, standby host seizes the IP address of main frame, i.e., be changed to the IP of itself Host ip, while after the service data transmitted by client is received, producing corresponding service response data, using master The sequence number that machine and the TCP of client are linked sends service response data to client.Then client can think that it is received always To service response data be to be sent by main frame, eliminate redialing for client, accomplish that the nothing of client is discovered, this causes Many clients for not redialing mechanism also can normally be used after hot standby switch, it is ensured that linking between standby host and client It will not be terminated.
In the present invention, main frame wants runtime server program, the clothes that service data is run by client to main frame The request server that business device program is sent is provided for it in data of service, such as communication system, asks the number of request of call According to etc., and server program(That is main frame)This request data according to transmitted by client, the reply data sent, as Service response data.
Fig. 2 be in the double hot standby method that the embodiment of the present invention two is provided main frame by service response data and main frame with Link information between client is sent to the schematic flow sheet of the detailed process of standby host.On the basis of embodiment one, it has Body is:
Step 201:The service response data are formed corresponding service response bag by main frame;
Step 202:The Target IP of the service response bag is revised as the IP of standby host by main frame, and source IP is revised as into client IP, destination port number is revised as to the port numbers of standby host, source port number is revised as to the port numbers of client, constitute in the middle of take Business response bag;
Step 203:The intermediary service response bag is sent to standby host by main frame.
In the double hot standby method provided in the present embodiment, the service response bag data produced by main frame, and formed After corresponding service response bag, according to normal flow, the Target IP of the service response bag produced by the main frame, destination port number are equal Should be IP, the port numbers of client;Source IP, source should be IP, the port numbers of main machine with port numbers and.However, in order that Service response bag produced by obtaining main frame can smoothly reach standby host, and simultaneously by the link information between main frame and client Standby host is sent to, therefore the source IP of modification service response bag is the IP of client, source port number is the port numbers of client, and repaiies The Target IP for changing service response bag is the IP of standby host, and destination port number is the port numbers of standby host, constitutes intermediary service response bag, to Standby host is sent.
In addition, main frame can also do the MAC Address of service response bag accordingly after corresponding service response bag is formed Modification.For example, the MAC Address of service response bag is revised as the MAC Address of standby host by main frame, modification source MAC is client MAC Address.If client is located at wide area network, and main frame and standby host are then located at same LAN, then make service response bag Source MAC be local gateway MAC Address.In the present embodiment, the service response data produced by main frame are formed In service response bag, source IP, source port number and source MAC that data are the service response bag, and the service are linked During response bag formation, the sequence number that the TCP of the main frame carried automatically and client is linked.So, service response data and chain Connecing information just can smoothly issue the follow-up backup and forwarding of standby host progress.
During Fig. 3 is the double hot standby method that the embodiment of the present invention three is provided, standby host is by the service response data with master The identity of machine is sent to the specific flow chart of client, on the basis of above-described embodiment two, specifically includes:
Step 301:The Target IP of the intermediary service response bag is revised as client ip by standby host, source IP is changed based on Machine IP, client end slogan is revised as by destination port number, and source port number is revised as into host side slogan, is reduced to the service Response bag;
Step 302:The standby host sends the amended service response bag to client.
Because standby host is after the intermediary service response bag of reception, intermediary service response bag is parsed, and will be corresponding Main frame be sent to the reply data of client, and the link information between client and main frame is backed up, and then again will Service response bag originally is sent to client.In the former service response bag, its source IP, source port number for client IP, Port numbers.Simultaneously because the process of this forwarding need not allow what client was known, but client is allowed to think, it is received Service response bag should be that it is sent to by main frame, therefore when service response bag is sent to client by standby host Wait, the source IP of intermediary service response bag is revised as to the IP of main frame, source port number is revised as the port numbers of main frame.Meanwhile, it is standby The Target IP of intermediary service response bag is revised as the IP of client by machine in order to which service response bag is issued into client, Destination port number is revised as the port numbers of client, and intermediary service response bag is reduced to original service response bag, so, when Client have received after service response bag, just will be considered that its service response bag received is sent by main frame.Here in Between service response be data for being used to back up transmitted by from main frame to standby host, include the service response data produced by main frame with And the link information between main frame and client.
For example:The conversion process of main frame response bag:
Host ip:192.168.1.10 port numbers 10000
Standby host IP:192.168.1.20 port numbers 20000
Client ip:192.168.1.30 port numbers 30000
Main frame is received after the service request from client, sends a service response bag, and its Target IP is 192.168.1.30, destination port number 30000, source IP is 192.168.1.10, source port number 10000;Main frame is revised as Target IP 192.168.1.20, destination port number 20000, source IP is 192.168.1.30, source port number 30000;
Standby host is received after the bag and Backup Data, recovers bag, reverts to its Target IP for 192.168.1.30, target port Numbers 30000, source IP is 192.168.1.10, source port number 10000.It is sent to client.
This design framework that standby machine is cascaded proposed in the present invention, can make full use of Transmission Control Protocol The reliability mechanisms of itself ensure the reliable synchronization of hot standby network data, but add certain network burden.Any one Moment, if client sends request and do not receive response, then it can repeat requests.When client have received response, then Represent that backed up in synchronization crosses the TCP bag datas to standby host.Therefore, theoretically, data are that overall safety is reliable.
In addition, it is necessary to explanation, if the route system provided using operating system, then MAC Address is repaiied Changing to be automatically performed, it is only necessary to change IP and port numbers.
Fig. 4 be in the double hot standby method that the embodiment of the present invention four is provided main frame by service response data and main frame with Link information between client is sent to the schematic flow sheet of the another way of standby host.It is specially:
Step 401:The service response data are formed corresponding service response bag by main frame;The service response bag includes Head and data segment;
Step 402:Main frame preserves the link information in the data segment of service response bag;
Step 403:The Target IP of the service response bag is revised as the IP of standby host by main frame, is standby host by destination port number Port numbers, formed intermediary service response bag;
Step 404:Main frame sends the intermediary service response bag to standby host.
Service response data are sent to by another main frame provided in the present embodiment four different from embodiment two The method of standby host, in the present embodiment four, main frame does not change the source IP of service response bag, source port number, only need to be by service response The Target IP of bag, destination port number are revised as the IP of standby host, port numbers, and by the IP of client, port numbers, main frame and standby host The sequence number of TCP links is maintained in the data segment of current service response bag, new intermediary service response bag is formed, when standby host connects Receive after the intermediary service response bag, directly by the information such as the IP of client, port numbers from take business response bag data segment solution Separate out, then backed up.
Shown in Figure 5 on the basis of the present embodiment four, the embodiment of the present invention five additionally provides a kind of standby host and will serviced Reply data is sent to client approach with the identity of main frame, specifically includes:
Step 501:Standby host deletes the link information being stored in the intermediary service response bag data segment;
Step 502:The Target IP of the intermediary service response bag is revised as the IP of client by standby host, by destination port number The port numbers of client are revised as, the service response bag is reduced to;
Step 503:Standby host sends the service response bag to client.
Standby host is after the intermediary service response bag transmitted by main frame is received, by corresponding service response data and link Information parses backup from middle service response bag, simultaneously as link information is stored in intermediary service response bag Data segment, and this link information will not issue client, therefore, standby host will be stored in the intermediary service response bag data Link information in section is deleted, simultaneously as when intermediary service response bag is sent to standby host by main frame, service originally The source IP of response bag, source port number are the IP of main frame, port numbers, and the Target IP of former response bag, destination port number are standby host The IP of client, port numbers, therefore the Target IP of intermediary service response bag is revised as to the IP of client, target port should be repaiied The port of client is changed to, so that intermediary service response bag to be reduced to original service response bag, is sent to client.
In addition, in addition it is also necessary to which the MAC Address of intermediary service response bag is revised as to the MAC Address of client.
Main frame can also can not also change the source IP of service response bag, source port number, source MAC, it is only necessary to change Its Target IP, destination port number and destination-mac address, while service response bag directly is issued into standby host, directly by visitor The information such as IP, port numbers and the MAC Address at family end are sent to standby host by extra communication.
Fig. 6 be in the double hot standby method that the embodiment of the present invention six is provided main frame by service response data and main frame with Link information between client is sent to the schematic flow sheet of the another way of standby host.It is specifically included:
Step 601:The service response data are formed corresponding service response bag by main frame;The service response bag includes Head and data segment;Source IP, source port number and the source MAC of the service response bag are preserved in the head, also protect There are Target IP, destination port number and the destination-mac address of the service response bag;
Step 602:The service response bag is being increased into one layer of head in addition, new service response bag is formed;It is described another The source IP address that outer increased one layer of head is preserved is the IP of main frame, and Target IP is the IP of standby host, and source port number is main frame Port numbers, destination port number is the port numbers of standby host;Source MAC is the MAC Address of main frame, and destination-mac address is standby host MAC Address;
Step 603:Main frame sends the new service response bag to standby host.
In the present embodiment, the service response bag that main frame forms service response data, the response bag is TCP data bag, Include head and data segment, in TCP data bag, preserve the source IP of service response bag, source port number, source MAC, The information such as Target IP, target port destination-mac address, the source IP of what main frame was formed will the issue service response bag of client, Source port and source MAC are IP, port and the MAC Address of main frame, and its Target IP, target port and target MAC Address should be IP, port and the MAC Address of client, and this service response bag will issue standby host and be backed up, this Sending is sent with the delivery of IP mechanism actually, and its destination address should be IP, port numbers and the MAC Address of standby host.Therefore In order to which service response bag smoothly is sent into standby host, the service response formed in standby host, which is wrapped, is further added by one layer of head Portion, forms new service response bag.The source IP address preserved in the head is the IP of main frame, and Target IP is the IP of standby host, source Port numbers are the port numbers of main frame, and destination port number is the port numbers of standby host;Source MAC is the MAC Address of main frame, target MAC Address is the MAC Address of standby host.So, service response bag can be issued standby host.
Meanwhile, referring to Fig. 7, reply data is sent to the side of client by another standby host that the embodiment of the present invention seven is provided In method,
Step 701:Standby host is by the new service response bag received by it, and increased one layer of head is deleted in addition, also It is former into not increasing the service response bag on head;
Step 702:Standby host sends the service response bag to client.
On the basis of above-described embodiment six, standby host is after the new service response bag is received, by service response data Peer link information is parsed from new service response bag, after being backed up, and will in addition be increased in the new service response bag Plus one layer of head delete, being reduced into does not increase the service response bag on head, then again by this for increase head service response Bag is sent to client.The service response bag for not increasing head is to be sent to the service response of client produced by main frame Bag.
During Fig. 8 is the double hot standby method that the embodiment of the present invention eight is provided, standby host uses the main frame and client The sequence number of TCP links sends the flow chart of service response data to client, specifically includes:
Step 801:Standby host constructs TCP handshake request bags, the source IP address of the TCP handshake request bags for client IP Location, source port number is the port numbers of client;
Step 802:Standby host sends the TCP handshake requests bag constructed to itself, and standby host and client are set up at itself Between TCP link;
Step 803:Standby host is after the TCP links are set up, in the kernel of itself operating system, by the TCP chains The sequence number connect is revised as the sequence number that the TCP of the main frame and client is linked;
Step 804:Standby host is linked using the TCP, and service response data are sent to client.
In the present embodiment eight, main frame sends service response data to standby host, and by standby host that the service response data are standby After part, it is during being forwarded to client, between standby host and client and does not set up TCP and link, but entered with IP mechanism Row is directly delivered and sent.It is this it is direct deliver when sending need not the side of being delivered fed back.Thus when the IP address of standby host Be changed to after the IP address of main frame, the service data that client is sent can all be sent to standby host, if not standby host with If TCP links are set up between client, standby host makes feedback also without to this service data.Thus, in order to protect Card is gone wrong in main frame, and the IP of standby host is changed to after the IP of main frame, and standby host can replace main frame, be provided normally for client Service links it is necessary to set up corresponding TCP between standby host and client.But meanwhile, standby host does not allow client to know, is that it is carried Changed for the main frame of service, thus standby host construction TCP handshake request bags, and by the TCP handshake requests bag of construction to itself Send.Because the former IP of the TCP handshake request bags is client ip, source port number is the port numbers of client, therefore, and its institute is complete Into TCP links be to be set up at itself actually, client is not aware that.The sequence number and host-client of this TCP links TCP links sequence number it is different.
In order that obtaining two link docking, i.e. standby host be able to can not be discovered in client provides the main frame of service for it It is replaced with the requirement of standby host, standby host is after the TCP links are set up, in the kernel of itself operating system, by the TCP The sequence number of link is revised as the sequence number that the TCP of the main frame and client is linked;Then standby host is linked using the TCP, Service response data are sent to client.
In addition, during Fig. 9 is the double hot standby method that the embodiment of the present invention nine is provided, another standby host uses the main frame The sequence number linked with the TCP of client sends the flow chart of service response data to client, specifically includes:
Step 901:Standby host constructs TCP handshake request bags, the source IP address of the TCP handshake request bags for client IP Location, source port number is the port numbers of client;
Step 902:Standby host sends the TCP handshake requests bag constructed to itself, and standby host and client are set up at itself Between TCP link;
Step 903:Standby host to client sending service response bag and receives service request bag transmitted by client When, the TCP sequence number to service response bag and service request bag is changed;
Wherein, the service of being preserved in service response data, the service request bag is preserved in the service response bag please Seek data;
The TCP sequence number includes SEQ sequence numbers and ACK sequence numbers.
In order that obtaining two link docking, i.e. standby host be able to can not be discovered in client provides the main frame of service for it Be replaced with the requirement of standby host, standby host after TCP link is set up, standby host to client send service response bag and When receiving the service request bag transmitted by client, the TCP sequence number to service response bag and service request bag is changed; Wherein, preserved in the service response bag in service response data, the service request bag and preserve service data;Institute Stating TCP sequence number includes SEQ sequence numbers and ACK sequence numbers.
Referring to Figure 10, the embodiment of the present invention ten provides a kind of standby host and is sending service response bag and receiving to client During service request bag transmitted by client, the tool that the TCP sequence number to service response bag and service request bag is changed Body method, including:
Step 1001:Standby host receives first service request bag of the client using the TCP chain sending and receiving of main frame and client When, the TCP of its TCP sequence number and standby host and client is linked into sequence number and made the difference, the difference is designated as deviant;
Step 1002:Network bottom layer capture client links the service for issuing standby host using the TCP of original host and client Request bag, deviant is subtracted by its sequence number;
Step 1003:The standby host and the TCP of client that network bottom layer capture standby host is set up using standby host end, which are linked, to be sent out To the service response bag of client, its sequence number is added into deviant.
During TCP links are set up, even the link between same server and client side, different chains Connect, its sequence number is also different.Therefore, linked even establishing the TCP between standby host and client at standby host end, its Sequence number between TCP of the sequence number also between original host and client is linked is different, therefore, if not to standby host and visitor Between the end of family TCP link sequence number be corrected, that is, cause rebuild standby host-client TCP link sequence number with The sequence number docking of the TCP links of original host-client, if making its sequence number between original host-client identical, visitor Family end still will recognise that the client communicated with has been changed.
For example:When outside service request bag(Connect using old chain)Come in, his Serial No. SEQ=1000, ACK= 1000;The service request packet number that last time is received inside standby host(Use new url)For SEQ=100, ACK=100;So When external service request bag enters fashionable, deviant is calculated first, be SEQ_OFFSET=1000-100=900, ACK_OFFSET= 1000-100=900;The sequence number of service request bag is converted again, i.e. SEQ=1000-900=100, ACK of service request bag= 1000-900=100;Thus become internal sequence order.When service response bag is sent, such as SEQ=110, ACK= 110, now plus deviant, it is changed into SEQ=1010, ACK=1010, as external sequence order.Data all afterwards please Bag is sought, enters fashionable, deviant can be all subtracted, service response bag sends Shi Douhui plus deviant.
Backed up in realtime from existing unlike whole host TCP protocol stack method, this sequence number calibration method is to institute Need the data of backup considerably less, greatly reduce the load of main frame and network.
In various embodiments of the present invention, after hot standby switch can by calibrate TCP sequence number by it is new and old link be docked at one Rise.The method of two kinds of calibration TCP sequence numbers all without synchronous TCP protocol stack internal state, such as retransmission state, timer state, Window size etc., but this relatively simple method is enough for conventional application.For the applied field of some specific demands Close, can be with real-time synchronization kernel TCP protocol stack related data, by related data after standby host switching is reached the standard grade according to real needs Kernel relevant position is covered, such as:tcp_sock、inet_connection_sock、inet_sock、sock、sock_ Common, request_sock, listen_sock and/or request_sock_queue etc..But synchrodata amount is larger, Bear larger in heavy traffic condition lower network.
In addition, when main frame breaks down, the IP address that the IP address of itself is changed to main frame is specially by standby host:
Whether standby host breaks down every preset time detection main frame, surpasses if the heartbeat between such as main frame and standby host is linked When, and the multiple ping main frames failure of standby host, then show that severely subnormal has occurred in host operating system, main frame event should be determined as Barrier;
When certain detection of standby host, it is found that main frame breaks down, standby host will call what linux operating systems were provided Local IP address is changed to the IP address of main frame by ifconfig interfaces, notification gateway, and now original host will be forced down by gateway Line;
Host application program maintains the data of a current operating conditions information, including existing customer number, each client The important information such as information state, the data will be by backed up in synchronization to standby host(I.e. above-mentioned data message), work as hostdown, it is standby Machine is reached the standard grade and set up after all TCP links, and standby host will cover the running state information of current application program using the data message Data, make application program realize redirecting for running status.
Monitor hot standby example
Two computers are configured first, wherein one is main frame, another is standby host.Main frame is different with MAC with standby host IP, Same general switch is connected to, without using ARP(Address Resolution Protocol)Binding.Standby machine loading heat Standby kernel module, for supervision network state.Standby machine runs identical server program, only exists some small differences, is used for Distinguish standby machine and auxiliary hot standby switch.Standby host also needs to run hot standby main program, and the program mainly completes detection main frame and heat The work of standby switching.
Two monitoring servers configure good related setting by above-mentioned requirements, and main frame opens normal service.Host detection is to standby Machine, this aft engine is received after the request bag of client, and the bag that service port number is sent is issued standby host backup end by kernel module Original bag is issued into client after slogan, standby host backup related data.When client initiates primary video request after the meeting, main frame should Answer, and video data is forwarded directly to by client by UDP, it is not necessary to pass through standby host;TCP response bags will flow through standby host.
Work as machine when main frame breaks down, standby host will seize the IP address of main frame, standby host turns into new main frame.New main frame is internally Quick to rebuild TCP links, calibrating sequence number makes client TCP normally run, and nothing is discovered.Meanwhile, Backup Data will also be notified should Work as machine moment state with program host, because main frame is transmitting UDP video datas when machine, therefore standby host turns into new main frame Afterwards, it will continue to send UDP video datas toward client.In this way, client is in standby machine hot standby switch, several seconds interim cards are only existed Time, it will recover normal afterwards, all TCP/UDP communications of client need not be rebuild.
Finally it should be noted that:The above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although The present invention is described in detail with reference to the foregoing embodiments, it will be understood by those within the art that:It still may be used To be modified to the technical scheme described in foregoing embodiments, or equivalent substitution is carried out to which part technical characteristic; And these modification or replace, do not make appropriate technical solution essence depart from various embodiments of the present invention technical scheme spirit and Scope.

Claims (8)

1. a kind of double hot standby method, it is characterised in that including:
Main frame receives the service data of client, produces corresponding service response data, and by service response data and Link information between main frame and client is sent to standby host;The link information includes:IP, port numbers and the master of client The sequence number that machine and the TCP of client are linked;
Standby host is received after service response data and the link information transmitted by main frame, by the service response data And the link information backup, and the service response data are sent to client with the identity of main frame;
When main frame breaks down, the IP address of itself is changed to the IP address of main frame by standby host;
The sequence number that standby host is linked using the TCP of the main frame and client sends service response data to client;
Wherein, the heartbeat between main frame and standby host links time-out, and the multiple ping main frames failure of standby host, then hostdown.
2. double hot standby method according to claim 1, it is characterised in that it is described by service response data and main frame with Link information between client is sent to standby host, specifically includes:
The service response data are formed corresponding service response bag by main frame;
The Target IP of the service response bag is revised as the IP of standby host by main frame, and source IP is revised as to the IP of client, by target Port numbers are revised as the port numbers of standby host, and source port number is revised as to the port numbers of client, constitute intermediary service response bag;
The intermediary service response bag is sent to standby host by main frame.
3. double hot standby method according to claim 2, it is characterised in that it is described by the service response data with main frame Identity be sent to client, specifically include:
The Target IP of the intermediary service response bag is revised as client ip by standby host, and source IP is revised as into host ip, by target Port numbers are revised as client end slogan, and source port number is revised as into host side slogan, are reduced to the service response bag;
The standby host sends the service response bag to client.
4. double hot standby method according to claim 1, it is characterised in that it is described by service response data and main frame with Link information between client is sent to standby host, specifically includes:
The service response data are formed corresponding service response bag by main frame;The service response bag includes head and data Section;
Main frame preserves the link information in the data segment of service response bag;
The Target IP of the service response bag is revised as the IP of standby host by main frame, by the port numbers that destination port number is standby host, shape Into intermediary service response bag;
Main frame sends the intermediary service response bag to standby host.
5. double hot standby method according to claim 4, it is characterised in that it is described by service response data with the body of main frame Part is sent to client, specifically includes:
Standby host deletes the link information being stored in the intermediary service response bag data segment;
The Target IP of the intermediary service response bag is revised as the IP of client by standby host, and destination port number is revised as into client Port numbers, be reduced to the service response bag;
Standby host sends the service response bag to client.
6. the double hot standby method according to claim 1-5 any one, it is characterised in that the standby host uses the master The sequence number that machine and the TCP of client are linked sends service response data to client, specifically includes:
Standby host constructs TCP handshake request bags, and the source IP address of the TCP handshake request bags is the IP address of client, source port number For the port numbers of client;
Standby host sends the TCP handshake requests bag constructed to itself, itself is setting up the TCP chains between standby host and client Connect;
In the kernel of itself operating system, the TCP sequence numbers linked are repaiied after the TCP links are set up for standby host It is changed to the sequence number that the TCP of the main frame and client is linked;
Standby host is linked using the TCP, and service response data are sent to client.
7. the double hot standby method according to claim 1-5 any one, it is characterised in that the standby host uses the master The sequence number that machine and the TCP of client are linked sends service response data to client, specifically includes:
Standby host constructs TCP handshake request bags, and the source IP address of the TCP handshake request bags is the IP address of client, source port number For the port numbers of client;
Standby host sends the TCP handshake requests bag constructed to itself, itself is setting up the TCP chains between standby host and client Connect;
Standby host to client when sending service response bag and receiving the service request bag transmitted by client, to service response The TCP sequence number of bag and service request bag is changed;
Wherein, preserved in the service response bag in service response data, the service request bag and preserve service request number According to;
The TCP sequence number includes SEQ sequence numbers and ACK sequence numbers.
8. double hot standby method according to claim 7, it is characterised in that the standby host is answered to client transmission service When answering bag and receiving the service request bag transmitted by client, to the TCP sequence number of service response bag and service request bag Changed, specifically included:
Standby host receive client using the TCP chain sending and receiving of main frame and client first service request bag when, by its TCP sequence Number linking sequence number with the TCP of standby host and client makes the difference, and the difference is designated as deviant;
Network bottom layer capture client links the service request bag for issuing standby host using the TCP of main frame and client, by its sequence Number subtract deviant;
Standby host and the TCP of client that network bottom layer capture standby host is set up using standby host end link the service of issued client Response bag, deviant is added by its sequence number.
CN201410143004.5A 2014-04-10 2014-04-10 A kind of double hot standby method Active CN103944698B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410143004.5A CN103944698B (en) 2014-04-10 2014-04-10 A kind of double hot standby method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410143004.5A CN103944698B (en) 2014-04-10 2014-04-10 A kind of double hot standby method

Publications (2)

Publication Number Publication Date
CN103944698A CN103944698A (en) 2014-07-23
CN103944698B true CN103944698B (en) 2017-10-03

Family

ID=51192202

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410143004.5A Active CN103944698B (en) 2014-04-10 2014-04-10 A kind of double hot standby method

Country Status (1)

Country Link
CN (1) CN103944698B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104243473B (en) * 2014-09-12 2018-11-30 华为技术有限公司 A kind of method and device of data transmission
CN105812169B (en) * 2014-12-31 2019-08-20 华为软件技术有限公司 A kind of switch between master and slave machines method and device
CN104615511B (en) * 2015-02-05 2018-01-26 中国工商银行股份有限公司 One kind recovers processing method and processing device based on bicentric host batch
CN105337762A (en) * 2015-09-28 2016-02-17 浪潮(北京)电子信息产业有限公司 File sharing method supporting automatic failover
CN106230747B (en) * 2016-08-30 2020-01-31 迈普通信技术股份有限公司 Method, device and system for recovering TCP connection sequence number
CN108055163A (en) * 2018-01-06 2018-05-18 北京特立信电子技术股份有限公司 A kind of dual-homed equipment and its protection switching method
CN110011767B (en) * 2019-04-17 2022-09-27 北京百度网讯科技有限公司 Method and apparatus for TCP connection backup
CN110890984B (en) * 2019-11-27 2022-07-22 山东九州信泰信息科技股份有限公司 Dual-computer hot standby switching method based on isolation device
CN111726391B (en) * 2020-05-09 2023-03-24 深圳震有科技股份有限公司 Method, system and storage medium for smoothly exiting cluster system
EP3910882B1 (en) * 2020-05-14 2023-12-13 ise Individuelle Software und Elektronik GmbH Fail-safe operation of a network
CN113176969A (en) * 2021-04-23 2021-07-27 杭州迪普科技股份有限公司 Service providing method, device, equipment and computer readable storage medium
CN115378557B (en) * 2022-10-25 2023-02-17 成都星联芯通科技有限公司 Hot standby implementation method, device, system, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6108300A (en) * 1997-05-02 2000-08-22 Cisco Technology, Inc Method and apparatus for transparently providing a failover network device
CN1391378A (en) * 2001-06-11 2003-01-15 华为技术有限公司 Connection switching system at front end of server cluster and its switching method
CN102510408A (en) * 2011-11-30 2012-06-20 武汉烽火网络有限责任公司 Method for realizing TCP (transmission control protocol) application main and standby changeover
CN103346903A (en) * 2013-06-20 2013-10-09 北京捷成世纪科技股份有限公司 Dual-machine backup method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8958282B2 (en) * 2009-12-10 2015-02-17 Verizon Patent And Licensing Inc. 1-for-N redundancy in private IP session border control networks

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6108300A (en) * 1997-05-02 2000-08-22 Cisco Technology, Inc Method and apparatus for transparently providing a failover network device
CN1391378A (en) * 2001-06-11 2003-01-15 华为技术有限公司 Connection switching system at front end of server cluster and its switching method
CN102510408A (en) * 2011-11-30 2012-06-20 武汉烽火网络有限责任公司 Method for realizing TCP (transmission control protocol) application main and standby changeover
CN103346903A (en) * 2013-06-20 2013-10-09 北京捷成世纪科技股份有限公司 Dual-machine backup method and device

Also Published As

Publication number Publication date
CN103944698A (en) 2014-07-23

Similar Documents

Publication Publication Date Title
CN103944698B (en) A kind of double hot standby method
US9032240B2 (en) Method and system for providing high availability SCTP applications
US8503288B1 (en) Silent failover from a primary control unit to a backup control unit of a network device
CN101557317B (en) Active dialogue backup system, equipment and method in dual-server hot-backup network
CN101924771B (en) Core-level TCP adhering junction method for accelerating application proxy
CN102510408B (en) Method for realizing TCP (transmission control protocol) application main and standby changeover
CN105897486B (en) A kind of method of Stream Control Transmission Protocol Service hot backup
WO2017219779A1 (en) Device active/standby switchover method and apparatus based on link protocol, and storage medium
CN103227725B (en) A kind of method and device of dual-server backup of firewall
EP2259500A1 (en) Method and device for failover of a L2TP connection
CN105790903A (en) Terminal and terminal call soft handover method
CN103546427B (en) Method and system for realizing high availability of encryption machine application
CN108270593B (en) Dual-computer hot backup method and system
US10135985B1 (en) Immediate reconnection of a call to an agent in a contact center
CN102255716A (en) Method and system for protocol state backup between equipment
CN109257444B (en) Load sharing method, device and system
JP4757719B2 (en) Network system, IP telephone terminal, and network device switching method used therefor
WO2002103969A1 (en) Method of implementing ip telephone gatekeeper group and a gatekeeper system
KR20180099143A (en) Apparatus and method for recovering tcp-session
EP2523480B1 (en) Method and system for emergency switching
CN110890984B (en) Dual-computer hot standby switching method based on isolation device
CN108347705A (en) CMPP SMS platforms and its application process
JP2018078482A (en) Transfer device, transfer method, and program
Ayuso et al. FT-FW: efficient connection failover in cluster-based stateful firewalls
JPH0764812A (en) Synchronism control method for dual computer system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C53 Correction of patent for invention or patent application
CB03 Change of inventor or designer information

Inventor after: Pan Shengjie

Inventor after: Bao Qingjie

Inventor after: Pan Shuwen

Inventor before: Pan Shengjie

Inventor before: Tang Huiming

Inventor before: Pan Shuwen

COR Change of bibliographic data

Free format text: CORRECT: INVENTOR; FROM: PAN SHENGJIE TANG HUIMING PAN SHUWEN TO: PAN SHENGJIE BAO QINGJIE PAN SHUWEN

CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Pan Shengjie

Inventor after: Bao Qingjie

Inventor after: Tang Huiming

Inventor before: Pan Shengjie

Inventor before: Bao Qingjie

Inventor before: Pan Shuwen

GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder

Address after: Two Lu Tian Hua high tech Zone of Chengdu City, Sichuan province 610041 No. 219 Tianfu Software Park C District 10 Building 16 layer

Patentee after: Huayan Intelligent Technology (Group) Co., Ltd

Address before: Two Lu Tian Hua high tech Zone of Chengdu City, Sichuan province 610041 No. 219 Tianfu Software Park C District 10 Building 16 layer

Patentee before: Sichuan Whayer Information Industry Co., Ltd.

CP01 Change in the name or title of a patent holder