Vehicle information management system double hot standby method based on VRRPTechnical field
A kind of method that present invention vehicle information management system based on VRRP double hot standby method relates to two-node cluster hot backup, it is adaptable to have the system that significant data stores.
Background technology
In Information system for vehicle management, the track of vehicle, floor data are uploaded to vehicle management information server by car-mounted device in time, along with Information system for vehicle management is in the extensive utilization of industry-by-industry, GPS device gets more and more, the terminal access amount of server the most quickly increases, and the performance of CPU, I/O of server is the most limited, that cannot tackle the concurrent access request of great amount of terminals quickly increases the problem that the service quality brought drastically declines, easily cause stopping service that faults such as restarting even occurs, cause great economic loss.In order to avoid server access fault causes economic loss, the safe and reliable property of server is particularly important.
Summary of the invention
It is an object of the invention to provide a kind of vehicle information management system double hot standby method based on VRRP for above-mentioned weak point, the method needs two-server, one as primary server, one as standby server, only has primary server providing services under normal circumstances, session information, data message can be synchronized to standby server by the most primary server, and the hot standby module on primary server actively sends heartbeat message, represents that primary server is working properly;When primary server failure, standby server takes over the work of primary server, thus ensures to service reliably, do not interrupt, and reduces system failure rate.
Present invention vehicle information management system based on VRRP double hot standby method takes techniques below scheme to realize:
Vehicle information management system double hot standby method based on VRRP comprises the following steps,
1) the two-node cluster hot backup parameter of primary server and standby server is configured;Described parameter includes,
A) hot standby group of identical ID, span is 0 ~ 255, and this ID is the premise that hot standby relation is set up;
B) primary service and the hot standby interface of standby server and IP address, the business interface of vehicle information management system and IP address, i.e. private IP address, it is ensured that primary server and standby server can set up hot standby relation by hot standby interface;
C) the hot standby heartbeat message of primary server and standby server sends cycle and message time out period etc., and primary server to keep consistent with the configuration of standby server;
D) on primary server and standby server, configure whole system and the IP address of vehicle information management data, services, i.e. virtual IP address are externally provided;
2) primary server and standby server set up primary and backup relation, the most hot standby relation;
3) by step 2) set up the hot standby relation between primary server and standby server after, primary server or standby server that priority is higher enter master state, and the cycle sends heartbeat message, represent that primary server is still survived, by described heartbeat message, standby server detects whether primary server survives;
4) primary server synchronizes business data to standby server in real time or periodically by the way of ftp file transfer protocol is with data syn-chronization message;
5), during standby server receives step 4) after data syn-chronization message and FTP data, database information is updated immediately;
6) occur restarting when primary server or during vehicle information management service fault that primary server is provided, standby server is by detecting the time-out of heartbeat message, enter master state, load virtual IP address address, open server network interface, start vehicle information management service, load primary server service data;
7) after primary server recovers, actively obtain the business datum on standby server to standby server, retransmit the heartbeat message of high priority, after standby server receives, exit master state;Primary server opens server network interface, loads virtual ip address, restarts to provide vehicle information management service.
Described step 2) set up primary and backup relation by hot standby group of ID parameter in step 1), comprise the steps:
A), during primary startup of server, primary server is the heartbeat message of 300 every cycle broadcast priority on hot standby interface of giving out a contract for a project, and carries the hot standby group of ID of oneself in message;Standby server the most also broadcast priority is the heartbeat message of 100 simultaneously;
B) on heart beat interface, than oneself high priority heartbeat message is not received in continuous 3 heart beat cycles when primary server, then enter primary service state, load the IP address of vehicle information management data, services, i.e. virtual IP address, the service of data storage is externally provided;
C) standby server receives a heartbeat message higher than oneself priority on heart beat interface and is put into resting state, is not loaded with the IP address of vehicle information management data, services, i.e. virtual IP address, simultaneously enters data backup procedure;If standby server continuous 3 cycles on heart beat interface do not receive the heartbeat message higher than oneself priority, the IP address of standby loading vehicle information management data, services, i.e. virtual IP address, and start vehicle information management system service is externally provided;
If d) the hot standby group of ID that the heartbeat message that primary server and standby server receive carries is inconsistent with self, then abandon;
E) now, primary server and standby server establish hot standby relation;The most primary server and standby server can obtain the address of the heart beat interface of the other side by the heartbeat message of the other side, for data syn-chronization.
In described step 3), concrete implementation step is:
A) standby server continuous multiple heart beat cycles on heart beat interface do not receive the heartbeat message of primary server; then think that extremely or primary server occurs in that and restarts fault primary server service; standby server starts vehicle information management service immediately; load store synchrodata in disk; open business interface; the IP of overseas broadcast its own interfaces simultaneously and MAC Address, the most whole vehicle information management business just can switch to standby server;Whole handoff procedure can complete in a short period of time, and therefore for each GPS terminal and upper-layer user, switching is transparent.Standby server needs business datum packing being stored of cycle when being in master state, wait that primary server recovers to take later;Described heart beat cycle is the transmission interval time of the heartbeat message being pre-configured with;
B) after primary server recovers from fault, first can receive the up-to-date business datum on standby server, by the synchronizing traffic data on standby server to primary server, enter back into master state, broadcast priority is the heartbeat message of 300;Load business interface virtual IP address, start vehicle information management service, broadcast the address of self;Meanwhile it is in after the standby server of master state receives and abandons master state immediately, close vehicle information management service and business interface, thus business turns again on primary server.
Present invention vehicle information management system based on VRRP double hot standby method has the advantage that
1, the double hot standby method of self-defined heartbeat message is used to build vehicle information management system, it is achieved that the high availability of vehicle information management system and high reliability.
2, method is simple, feasible, efficient, by the difference of priority, quickly sets up hot standby relation;Can be with the parameter of quick obtaining the other side's heart beating port, the beneficially quick backup of data by the mutual study of heartbeat message.
3, use cycle and the mode of real time data backup, targetedly different business datums is backed up and dump, improve the efficiency of data backup.
Accompanying drawing explanation
Below with reference to accompanying drawing, the invention will be further described:
Fig. 1 is the vehicle information management system two-node cluster hot backup typical case's networking schematic diagram utilizing the inventive method.
Fig. 2 is vehicle information management system two-node cluster hot backup switching sequence figure in present invention vehicle information management system based on VRRP double hot standby method.
Fig. 3 is the heartbeat message format chart in present invention vehicle information management system based on VRRP double hot standby method.
Detailed description of the invention
With reference to summary of the invention, present invention vehicle information management system based on VRRP double hot standby method comprises the steps:
1) the two-node cluster hot backup parameter of primary server and standby server is configured;Described parameter includes,
A) hot standby group of identical ID, span is 0 ~ 255, and this ID is the premise that hot standby relation is set up;
B) primary service and the hot standby interface of standby server and IP address, the business interface of vehicle information management system and IP address, i.e. private IP address, it is ensured that primary server and standby server can set up hot standby relation by hot standby interface;
C) the hot standby heartbeat message of primary server and standby server sends cycle and message time out period etc., and primary server to keep consistent with the configuration of standby server;
D) on primary server and standby server, configure whole system and the IP address of vehicle information management data, services, i.e. virtual IP address are externally provided;
2) primary server and standby server set up primary and backup relation, the most hot standby relation;
3) by step 2) set up the hot standby relation between primary server and standby server after, priority be 300 primary server be in master state, open vehicle information management service, service is externally provided, and sends heartbeat message to standby server periodically on hot standby interface;Priority be 100 standby server be in resting state, heart beat interface is monitored the heartbeat message of primary server;
4) after setting up primary, standby, primary server periodically by business datum the highest for some requirement of real-time by FTP(file transfer protocol (FTP)) protocol synchronization is to standby server, the data higher to some requirement of real-time, by the transparent interprocess communication of TIPC() agreement transmission cycle synchronisation message, notify standby server more new data;Described business datum is session information and GPS position information etc.;
5) after standby server receives the sync message of step 4), it is immediately performed database manipulation, updates business datum;
6) under many circumstances, the primary server of vehicle information management being in master state needs the health status to the machine to carry out self-inspection, to notify standby server adapter service when finding primary server failure in time;When primary server judges to need proactive notification standby server to take over, continuous 10 heart beat cycles send the heartbeat message that priority is maximum (i.e. 0xff), standby server receive be preferably maximum 0xff time, thinking that primary server actively switches, standby server immediately enters primary service state;
7) after primary server recovers, actively obtain the business datum on standby server to standby server, retransmit the heartbeat message of high priority, after standby server receives, exit master state;Primary server opens server network interface, loads virtual ip address, restarts to provide vehicle information management service.
Described step 2) set up primary and backup relation by hot standby group of ID parameter in step 1), comprise the steps:
A), during primary startup of server, primary server is the heartbeat message of 300 every cycle broadcast priority on hot standby interface of giving out a contract for a project, and carries the hot standby group of ID of oneself in message;Standby server the most also broadcast priority is the heartbeat message of 100 simultaneously;The form of heartbeat message is as shown in Figure 3.
B) on heart beat interface, do not receive than oneself high priority heartbeat message in continuous 3 heart beat cycles when primary server, then enter primary service state, load the virtual IP address of vehicle information management system, the service of data storage is externally provided;
C) standby server receives a heartbeat message higher than oneself priority on heart beat interface and is put into resting state, is not loaded with the IP address (virtual IP address) of vehicle information management data, services, simultaneously enters data backup procedure;If standby server continuous 3 heart beat cycles on heart beat interface do not receive the heartbeat message higher than oneself priority, active service loads the IP address of vehicle information management data, services, and starts vehicle information management system and externally provide service;
If hot standby group of ID of the heartbeat message that d) primary server and standby server receive is inconsistent with self, then abandon;
E) now, primary server and standby server establish hot standby relation;The most primary server and standby server can obtain the heart beat interface address of the other side by the heartbeat message of the other side, for data syn-chronization.
In described step 3), concrete implementation step is:
A) standby server continuous multiple heart beat cycles (time-out time of configuration) on heart beat interface do not receive the heartbeat message of primary server; then think that extremely or primary server occurs in that and restarts fault primary server service; standby server starts vehicle information management service immediately; load store synchrodata in disk; open business interface; the IP of overseas broadcast its own interfaces simultaneously and MAC Address, the most whole vehicle information management business just can switch to standby server;Whole handoff procedure can complete in a short period of time, and therefore for each GPS terminal and upper-layer user, switching is transparent.Standby server needs business datum packing being placed under certain catalogue of cycle when being in master state, wait that primary server recovers to take later.
B) after primary server recovers from fault, first can receive the up-to-date business datum on standby server, by the synchronizing traffic data on standby server to primary server, enter back into master state, broadcast priority is the heartbeat message of 300;Load business interface virtual IP address, start vehicle information management service, broadcast the address of self;Meanwhile it is in after the standby server of master state receives and abandons master state immediately, close vehicle information management service and business interface.Thus business turns again on primary server.
In step 5), the health monitoring on primary server includes: the CPU utilization rate causing data base's operation failure number of times, WEB Service service error, some process is high.