Vehicle information management system double hot standby method based on VRRPTechnical field
The vehicle information management system double hot standby method that the present invention is based on VRRP relates to a kind of method of two-node cluster hot backup, is applicable to the system of significant data storage.
Background technology
In Information system for vehicle management, car-mounted device is uploaded to vehicle management information server in time by the track of vehicle, floor data, along with the extensive utilization of Information system for vehicle management at industry-by-industry, GPS device is more and more, the terminal access amount of server also increases thereupon fast, and the CPU of server is, the performance of I/O is always limited, cannot tackle the problem that service quality that the quick increase of the concurrent request of access of great amount of terminals brings sharply declines, very easily cause and stop the faults such as restarting even appears in service, cause great economic loss.For fear of the economic loss that causes of server access fault, it is particularly important that the safety of server, reliability seem.
Summary of the invention
The object of the invention is provides 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 have under normal circumstances primary server that service is provided, primary server can be synchronized to standby server by session information, data message simultaneously, and the hot standby module on primary server is initiatively sent heartbeat message, represents that primary server is working properly; When primary server failure, standby server is taken over the work of primary server, thereby guarantees to serve reliably, do not interrupt, and reduces system failure rate.
The vehicle information management system double hot standby method that the present invention is based on VRRP takes following technical scheme to realize:
Vehicle information management system double hot standby method based on VRRP comprises the following steps,
1) configure the two-node cluster hot backup parameter of primary server and standby server; Described parameter comprises,
A) hot standby group of identical ID, span is 0 ~ 255, this ID is the prerequisite that hot standby relation is set up;
B) business interface of the hot standby interface of primary service and standby server and IP address, vehicle information management system and IP address, i.e. private IP address, guarantees 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 the configuration of primary server and standby server will be consistent;
D) on primary server and standby server, configure the IP address that whole system externally provides vehicle information management data, services, i.e. virtual IP address;
2) primary server and standby server are set up primary and backup relation, i.e. hot standby relation;
3) by step 2) set up after the hot standby relation between primary server and standby server, primary server or standby server that priority is higher enter master state, and the cycle sends heartbeat message, represent that primary server still survives, whether standby server detects primary server by described heartbeat message and survives;
4) primary server in real time or periodically synchronizes business data to standby server by ftp file transfer protocol in the mode of data sync message;
5) standby server is received in step 4) after data sync message and FTP data, upgrades immediately database information;
6) when restarting appears in primary server or primary server provides vehicle information management service fault, standby server is by detecting the overtime 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, initiatively to standby server, obtain the business datum on standby server, then send the heartbeat message of high priority, after standby server is received, exit master state; Primary server is opened server network interface, loads virtual ip address, restarts to provide vehicle information management service.
Described step 2) by hot standby group of ID parameter in step 1), set up primary and backup relation, comprise the steps:
A), during primary startup of server, it is 300 heartbeat message that primary server is broadcasted priority every the cycle of giving out a contract for a project on hot standby interface, carries the hot standby group of ID of oneself in message; Simultaneously when starting, also to broadcast priority be 100 heartbeat message to standby server;
B) when primary server is not received the heartbeat message than own high priority in continuous 3 heart beat cycles on heart beat interface, enter primary service state, load the IP address of vehicle information management data, services, virtual IP address, externally provides the service of data storage;
C) standby server receives that on heart beat interface a high heartbeat message of the own priority of ratio just enters stand-by state, does not load the IP address of vehicle information management data, services, and virtual IP address enters data backup process simultaneously; If standby server continuous 3 cycles on heart beat interface are not received the heartbeat message higher than own 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;
D) if the hot standby group of ID that the heartbeat message that primary server and standby server are received carries is inconsistent with self, abandon;
E) now, primary server and standby server have been set up hot standby relation; Primary server and standby server can obtain the address of the other side's heart beat interface by the other side's heartbeat message simultaneously, synchronous for data.
Performing step concrete in described step 3) is:
A) standby server continuous a plurality of heart beat cycles on heart beat interface are not received the heartbeat message of primary server, think that fault has appearred restarting in the abnormal or primary server of primary server service, standby server starts vehicle information management service immediately, the synchrodata of load store in disk, open business interface, IP and the MAC Address of its own interfaces of overseas broadcast simultaneously, now whole vehicle information management business just can switch to standby server; Whole handoff procedure can complete in a short period of time, and it is transparent therefore concerning each GPS terminal and upper-layer user, switching.Standby server needs cycle business datum packing is stored when master state, waits for that primary server recovers to get afterwards; Described heart beat cycle is the transmission interval time of pre-configured heartbeat message;
B) after primary server recovers from fault, first can receive the up-to-date business datum on standby server, the synchronizing traffic data on standby server to primary server, then is entered to master state, the heartbeat message that broadcast priority is 300; Loaded with traffic interface virtual IP address, starts vehicle information management service, broadcasts the address of self; Meanwhile after the standby server of master state is received, abandon immediately master state, close vehicle information management service and business interface, thereby business is got back on primary server again.
The vehicle information management system double hot standby method that the present invention is based on VRRP has the following advantages:
1, adopt the double hot standby method of self-defined heartbeat message to build vehicle information management system, realized high availability and the high reliability of vehicle information management system.
2, method is simple, feasible, efficient, by the difference of priority, and the hot standby relation of Rapid Establishment; Mutual study by heartbeat message can quick obtaining the other side heartbeat port parameter, be conducive to the quick backup of data.
3, the mode of employing cycle and real time data backup, backs up and dump different business datums targetedly, has improved 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 networking schematic diagram that utilizes the inventive method.
Fig. 2 the present invention is based on vehicle information management system two-node cluster hot backup switching sequence figure in the vehicle information management system double hot standby method of VRRP.
Fig. 3 is the heartbeat message format chart the present invention is based in the vehicle information management system double hot standby method of VRRP.
Embodiment
With reference to summary of the invention, the vehicle information management system double hot standby method that the present invention is based on VRRP comprises the steps:
1) configure the two-node cluster hot backup parameter of primary server and standby server; Described parameter comprises,
A) hot standby group of identical ID, span is 0 ~ 255, this ID is the prerequisite that hot standby relation is set up;
B) business interface of the hot standby interface of primary service and standby server and IP address, vehicle information management system and IP address, i.e. private IP address, guarantees 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 the configuration of primary server and standby server will be consistent;
D) on primary server and standby server, configure the IP address that whole system externally provides vehicle information management data, services, i.e. virtual IP address;
2) primary server and standby server are set up primary and backup relation, i.e. hot standby relation;
3) by step 2) set up after the hot standby relation between primary server and standby server, priority is that 300 primary server is in master state, open vehicle information management service, service is externally provided, and to standby server, send heartbeat message periodically on hot standby interface; Priority be 100 standby server in stand-by state, on heart beat interface, monitor the heartbeat message of primary server;
4) set up after primary, standby, primary server periodically by the not high business datum of 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, notice standby server is new data more; Described business datum is session information and GPS positional information etc.;
5) standby server is received after the sync message of step 4), and performing database operation immediately, upgrades business datum;
6) under many circumstances, the primary server of vehicle information management in master state need to carry out self check to the health status of the machine, will notify in time standby server to take over service while finding primary server failure; When primary server judgement needs proactive notification standby server to take over, it is the heartbeat message of maximal value (being 0xff) that continuous 10 heart beat cycles send priority, standby server is being received while being preferably maximal value 0xff, think that primary server initiatively switches, standby server enters primary service state immediately;
7) after primary server recovers, initiatively to standby server, obtain the business datum on standby server, then send the heartbeat message of high priority, after standby server is received, exit master state; Primary server is opened server network interface, loads virtual ip address, restarts to provide vehicle information management service.
Described step 2) by hot standby group of ID parameter in step 1), set up primary and backup relation, comprise the steps:
A), during primary startup of server, it is 300 heartbeat message that primary server is broadcasted priority every the cycle of giving out a contract for a project on hot standby interface, carries the hot standby group of ID of oneself in message; Simultaneously when starting, also to broadcast priority be 100 heartbeat message to standby server; The form of heartbeat message as shown in Figure 3.
B) when primary server, on heart beat interface, in continuous 3 heart beat cycles, do not receive the heartbeat message than own high priority, 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 that on heart beat interface a high heartbeat message of the own priority of ratio just enters stand-by state, does not load the IP address (virtual IP address) of vehicle information management data, services, enters data backup process simultaneously; If standby server continuous 3 heart beat cycles on heart beat interface are not received the heartbeat message higher than own priority, standby service loads the IP address of vehicle information management data, services, and starts vehicle information management system service is externally provided;
D) if hot standby group of ID of the heartbeat message that primary server and standby server are received is inconsistent with self, abandon;
E) now, primary server and standby server have been set up hot standby relation; Primary server and standby server can obtain by the other side's heartbeat message the other side's heart beat interface address simultaneously, synchronous for data.
Performing step concrete in described step 3) is:
A) standby server continuous a plurality of heart beat cycles (time-out time of configuration) on heart beat interface are not received the heartbeat message of primary server, think that fault has appearred restarting in the abnormal or primary server of primary server service, standby server starts vehicle information management service immediately, the synchrodata of load store in disk, open business interface, IP and the MAC Address of its own interfaces of overseas broadcast simultaneously, now whole vehicle information management business just can switch to standby server; Whole handoff procedure can complete in a short period of time, and it is transparent therefore concerning each GPS terminal and upper-layer user, switching.Standby server needs cycle business datum packing is placed under certain catalogue when master state, waits for that primary server recovers to get afterwards.
B) after primary server recovers from fault, first can receive the up-to-date business datum on standby server, the synchronizing traffic data on standby server to primary server, then is entered to master state, the heartbeat message that broadcast priority is 300; Loaded with traffic interface virtual IP address, starts vehicle information management service, broadcasts the address of self; Meanwhile after the standby server of master state is received, abandon immediately master state, close vehicle information management service and business interface.Thereby business is got back on primary server again.
Health monitoring in step 5) on primary server comprises: the CPU utilization factor wrong to database operation failure number of times, WEB Service service, some process causes is high etc.