Embodiment
The embodiment of the present invention provides a kind of two-node cluster hot backup communication means, and the method realizes based on multicasting technology, makes both sides' equipment of communication can consult each other principal and subordinate's type separately, thereby can improve the reliabilty and availability of system.The embodiment of the present invention also provides corresponding equipment.Below in conjunction with accompanying drawing, be elaborated respectively.
Embodiment mono-,
A kind of two-node cluster hot backup communication means of the embodiment of the present invention, the method can be applied to intelligent transportation or Dedicated Short Range Communications, (Dedicated Short Range Communication, DSRC) field, specifically can be applied to two-node cluster hot backup communication system.
Please refer to Fig. 1, described two-node cluster hot backup communication system 100 comprises the first equipment 110 and the second equipment 120 that add respectively different multicast groups, and described the first equipment 110 intercoms by mutual multicast packets mutually with the second equipment 120.Physically, described the first equipment 110 can be realized and being connected by multiple connected mode, the connected modes such as such as serial ports, Ethernet or parallel port with the second equipment 120.
Please refer to Fig. 2, the two-node cluster hot backup communication means that the embodiment of the present invention provides, comprising:
210, the first equipment sends the first negotiation data bag to the second equipment, and the principal and subordinate's type that identifies described the first equipment in described the first negotiation data bag is undefined.
220,, according to the response results of described the second equipment, it is main frame or standby host that described the first equipment is set.
Wherein, if described the first equipment is set, be main frame, as shown in Figure 3, described method also comprises:
230, send the 3rd negotiation data bag to described the second equipment, the principal and subordinate's type that identifies described the first equipment in described the 3rd negotiation data bag is main frame, to indicate described the second equipment setting certainly as standby host.
Adopt said method, both sides' equipment of two-node cluster hot backup communication can be realized arbitration and the negotiation of active and standby identity in other words of principal and subordinate's type.Said principal and subordinate's type comprises master and slave and undefined three types, and wherein, host type refers to main frame, from type, refers to standby host.
In said method, described the first equipment and the mutual multicast packets of the second equipment, as said first or the frame format of the 3rd negotiation data bag as shown in table 1:
Table 1
Length |
Principal and subordinate's type |
Command type |
State |
BCC verification |
Data |
Explanation to each data field in above-mentioned frame format is as shown in table 2:
Table 2
When the value of described command type data field is 0, this multicast packets is exactly described negotiation data bag.
In a kind of execution mode, described in 220 according to the response results of described the second equipment, it is that main frame or standby host specifically can comprise that described the first equipment is set:
If do not receive the second negotiation data bag of described the second device responds in Preset Time, it is main frame that described the first equipment is set;
If received the second negotiation data bag of described the second device responds in Preset Time, principal and subordinate's type of obtaining described the second equipment from described the second negotiation data bag, according to principal and subordinate's type of described the second equipment, described the first equipment being set is main frame or standby host.
Further, described the first equipment is set is that main frame or standby host can comprise to the described principal and subordinate's type according to described the second equipment:
If principal and subordinate's type of described the second equipment is standby host, it is main frame that described the first equipment is set;
If principal and subordinate's type of described the second equipment is main frame, it is standby host that described the first equipment is set;
If principal and subordinate's type of described the second equipment is undefined, further obtain and the IP address of more described the first equipment and the second equipment, when the IP address numerical value of described the first equipment is larger, it is main frame that described the first equipment is set, hour, it is standby host that described the first equipment is set to the IP address numerical value of described the first equipment.
In a kind of execution mode, after 220 or 230, can also comprise:
240, the first heartbeat data packets of health status that the first equipment periodic sends first equipment that identifies is to the second equipment, receives the second heartbeat data packets of the health status that identifies the second equipment that the second equipment periodic sends; And the first equipment can also, according to both sides' health status or principal and subordinate's type, redefine principal and subordinate's type.
Please refer to table 1 and table 2, when the value of the command type data field in described multicast packets is 1, be heartbeat data packets, as described in the first or second heartbeat data packets.The first equipment and the second equipment can be known principal and subordinate's type and the health status of self, the heartbeat data packets that can send from the other side, know the other side's principal and subordinate's type and health status, thereby can be when both sides' health status and principal and subordinate's type change, according to preset strategy, carry out corresponding deliberate action, specific as follows described in.
If the first equipment fails to receive at the appointed time described the second heartbeat data packets, or, although received at the appointed time described the second heartbeat data packets, find that described the second equipment health status is abnormal, the first equipment is reported abnormal information to host computer.
At the first equipment when as main frame, if find, the health status of self is abnormal, self is set to standby host, send subsequently and identify the first heartbeat data packets that principal and subordinate's type of described the first equipment is standby host to described the second equipment, to indicate described second equipment the second equipment to be set to main frame and by the health status exception reporting host computer of described the first equipment.
At the first equipment current while being main frame, if receive the active and standby switching command that host computer sends, self is re-set as to standby host, and send and identify the first heartbeat data packets that principal and subordinate's type of described the first equipment is standby host to described the second equipment, to indicate described second equipment the second equipment to be set to main frame.Above-mentioned active and standby switching command can manually send by host computer, thus, can realize the identity of the active and standby machine of manual intervention and exchange.
Optionally, if the first equipment is after transmission identifies the first heartbeat data packets that principal and subordinate's type of described the first equipment is standby host, the second heartbeat data packets that second equipment of not receiving in Preset Time returns,, the first equipment self is set to main frame again, and the first heartbeat data packets that the principal and subordinate's type that sends subsequently sign self is main frame is to described the second equipment.
Described the first equipment is current while being standby host, if do not receive the second heartbeat data packets that the second equipment sends in Preset Time, or, receive and identify the second heartbeat data packets that principal and subordinate's type of described the second equipment is standby host, the first equipment is changed and is made as main frame.Principal and subordinate's type that sign comes from body in the first heartbeat data packets that sends to the other side is subsequently main frame.In a kind of execution mode, can restart current main frame, cause standby host in Preset Time, can not receive the heartbeat data packets of main frame, standby host will initiatively switch to main frame.
Above, the embodiment of the present invention provides a kind of two-node cluster hot backup communication means, and the method realizes based on multicasting technology, makes both sides' equipment of communication to consult each other principal and subordinate's type separately by mutual multicast packets, has improved the reliabilty and availability of system.Adopt the method, specifically can realize following technique effect: the realization that (1) is simple and reliable arbitration and the negotiation of active and standby identity; (2) realized reliably the transmission of health information in heartbeat data packets and shared; (3) having realized active and standby identity initiatively exchanges.
Embodiment bis-,
The embodiment of the present invention provides a kind of equipment, and this equipment the method can be applied to intelligent transportation or DSRC field, specifically can be for two-node cluster hot backup communication system 100 as shown in Figure 1.This equipment can be the first equipment 110 or second equipment 120 of this system.
Please refer to Fig. 4, described equipment comprises: sending module 310, and for sending the first negotiation data bag to another equipment, the principal and subordinate's type that identifies described equipment in described the first negotiation data bag is undefined; Module 320 is set, and for according to the response results of described another equipment, it is main frame or standby host that described equipment is set.
Optionally, as shown in Figure 5, described equipment can also comprise: receiver module 330.
Described receiver module 330, can be for receiving the second negotiation data bag of described another device responds; The described module 320 that arranges comprises: the first setting unit, and for when described receiving element fails to receive described the second negotiation data bag in Preset Time, it is main frame that described equipment is set; The second setting unit, for obtain principal and subordinate's type of described another equipment from described the second negotiation data bag, according to principal and subordinate's type of described another equipment, described equipment being set is main frame or standby host.
Optionally, described the second setting unit, if can be specifically standby host for principal and subordinate's type of described another equipment, it be main frame that described equipment is set; If principal and subordinate's type of described another equipment is main frame, it is standby host that described equipment is set; If principal and subordinate's type of described another equipment is undefined, further obtain and the IP address of more described equipment and another equipment, when the IP address numerical value of described equipment is larger, it is main frame that described equipment is set, hour, it is standby host that described equipment is set to the IP address numerical value of described equipment.
In a kind of execution mode, described sending module 310, if also module 320 is set described equipment is set is main frame for described, send the 3rd negotiation data bag to described another equipment, the principal and subordinate's type that identifies described equipment in described the 3rd negotiation data bag is main frame, to described another equipment is set, is standby host.
In a kind of execution mode, described sending module 310, the first heartbeat data packets that also sends the health status of carrying described equipment for periodicity is to described another equipment; Described receiver module 330, also for receiving the second heartbeat data packets of the health status of carrying described another equipment that described another equipment periodic sends.
Optionally, the described module 320 that arranges, also for described equipment is current while being main frame, if find, the health status of self is abnormal, or, if receive the active and standby switching command that host computer sends, self is changed and is made as standby host; And, also for described equipment is current while being standby host, if do not receive described the second heartbeat data packets in Preset Time, or, receive and identify the second heartbeat data packets that principal and subordinate's type of described another equipment is standby host, self is changed and is made as main frame.
Above equipment provided by the invention is illustrated, more detailed description please refer to embodiment mono-.
Above, the embodiment of the present invention provides a kind of equipment for two-node cluster hot backup communication system, adopts this equipment, and described system can realize based on multicasting technology the communication of both sides' equipment, can make both sides' equipment of communication consult each other principal and subordinate's type separately, improve the reliabilty and availability of system.Adopt this equipment, specifically can realize following technique effect: the realization that (1) is simple and reliable arbitration and the negotiation of active and standby identity; (2) realized reliably the transmission of health information in heartbeat data packets and shared; (3) having realized active and standby identity initiatively exchanges.About the more detailed description of this equipment, please refer to the description about the first or second equipment in embodiment mono-.
Embodiment tri-,
Please refer to Fig. 1, the embodiment of the present invention provides a kind of two-node cluster hot backup communication system 100, this system 100 comprises the first equipment 110 and the second equipment 120 that add respectively different multicast groups, and described the first equipment 110 intercoms by mutual multicast packets mutually with the second equipment 120.Physically, described the first equipment 110 can be realized and being connected by multiple connected mode, the connected modes such as such as serial ports, Ethernet or parallel port with the second equipment 120.This system can be applied to intelligent transportation or DSRC field.
The first described equipment 110, for sending the first negotiation data bag to the second equipment, the principal and subordinate's type that identifies described the first equipment in described the first negotiation data bag is undefined; And according to the response results of described the second equipment, arrange certainly as main frame or standby host.
The second described equipment 120, the first negotiation data bag sending for receiving the first equipment 110, and respond the second negotiation data bag to described the first equipment, in described the second negotiation data bag, identify principal and subordinate's type of the second equipment 120.
Described the first equipment 110 specifically can be according to whether receiving the negotiation data bag that the second equipment 120 responds, and principal and subordinate's type of the second equipment identifying in the negotiation data bag of receiving, determines the principal and subordinate's type of self, thereby self be set to main frame or standby host.Concrete scheme please refer to the description in embodiment mono-.
The first equipment 110 and the second equipment 120 can also send heartbeat data packets mutually, to notify the other side by the health status of self, and according to self and the other side's principal and subordinate's type and health status, determine the principal and subordinate's type that reports abnormal information or redefine self.Concrete scheme please refer to the description in embodiment mono-.
Above, the embodiment of the present invention provides a kind of two-node cluster hot backup communication system, and described system can realize based on multicasting technology the communication of both sides' equipment, improves the reliability of system, can make both sides' equipment of communication consult each other principal and subordinate's type separately, improve the availability of system.Adopt this system, specifically can realize following technique effect: the realization that (1) is simple and reliable arbitration and the negotiation of active and standby identity; (2) realized reliably the transmission of health information in heartbeat data packets and shared; (3) having realized active and standby identity initiatively exchanges.
One of ordinary skill in the art will appreciate that all or part of step in the whole bag of tricks of above-described embodiment can complete by hardware, also can complete by the relevant hardware of program command, this program can be stored in a computer-readable recording medium, and storage medium can comprise: read-only memory, random-access memory, disk or CD etc.
The two-node cluster hot backup communication means and the equipment that above the embodiment of the present invention are provided are described in detail, but the explanation of above embodiment is just understood method of the present invention and core concept thereof for helping, and should not be construed as limitation of the present invention.In the technical scope that those skilled in the art disclose in the present invention, the variation that can expect easily or replacement, within all should being encompassed in protection scope of the present invention.