A kind of real-time analysis alert data method and system based on recorder management platform
Technical field
The real-time analysis alert data method and system based on recorder management platform that the present invention relates to a kind of, belong to driving
Recorder recorder data processing field.
Background technology
Alert data analysis refers to uploading warning message to terminal to carry out the behaviour such as analysis in real time, classification, statistics, storage
Make, as the vehicle that platform networks is more and more, data volume is increasing, so needing a kind of quickly and effectively alarm analysis side
Method.
Recorder management platform needs to carry out real-time display, inquiry, processing operation to vehicle alarm information, works as warning message
Data volume it is big when, the inquiry of original method can be slow and there are bottlenecks, it is difficult to carry out real-time response to larger data amount.
Invention content
The purpose of the present invention is to solve existing recorder alarm information processing method inquiry velocity is slow, it is difficult to compared with
Big data quantity carries out the shortcomings that real-time response, and proposes a kind of real-time analysis alert data side based on recorder management platform
Method.
A kind of real-time analysis alert data method based on recorder management platform, including:
Step 1: receiving vehicle coordinate data, the vehicle coordinate data include warning mark position;
Step 2: being parsed to vehicle coordinate data, and the alert data parsed is encapsulated as to new data packet;
Step 3: new data packet is cached using buffer area;
Step 4: the data of buffer area are read in the setting timing according to timer, and interim table of alarming is stored in database
In.
Step 5: reading total data from interim table of alarming, united to alarm times according to preset information type
Meter, and will be in statistical result update to the warning message table in database.
A kind of real-time analysis alert data system based on recorder management platform, including:
Data reception module, for receiving vehicle coordinate data;The vehicle coordinate data include warning mark position;
The alert data parsed for being parsed to vehicle coordinate data, and is encapsulated as new number by parsing module
According to packet;
Cache module, for being cached new data packet using buffer area;
Memory module for reading the data of buffer area according to the setting timing of timer, and is stored in database and alarms
In interim table;
Data update module, for reading total data from interim table of alarming, according to preset information type to alarm
Number is counted, and will be in statistical result update to the warning message table in database.
Beneficial effects of the present invention are:
1), one embodiment of the present of invention effective solution recorder management platform warning message query processing speed is slow
The case where;The inquiry velocity of the present invention at least improves 10% compared to existing method.
2), one embodiment of the present of invention pushes coordinate data using ZeroMQ, and receiving terminal can be connect with multithreading
It receives, increases the processing capacity of system, and number of threads can be changed in configuration file, facilitate the deployment of system;
3), one embodiment of the present of invention is in the storage of warning message, use caching mechanism, timer and
Timesten batches are inserted into data mode, greatly alleviate the pressure of operation timesten;
4), one embodiment of the present of invention supports multiserver multi-process deployment, can effectively solve real-time coordinates quantity
Continue increased bottleneck.
Description of the drawings
Fig. 1 is the flow chart of one embodiment of the invention.
Specific implementation mode
Specific implementation mode one:The real-time analysis alert data method based on recorder management platform of present embodiment,
As shown in Figure 1, including:
Step 1: receiving vehicle coordinate data, the vehicle coordinate data include warning mark position.
Step 2: being parsed to vehicle coordinate data, and the alert data parsed is encapsulated as to new data packet.
Step 3: new data packet is cached using buffer area.
Step 4: the data of buffer area are read in the setting timing according to timer, and interim table of alarming is stored in database
In.
Step 5: reading total data from interim table of alarming, united to alarm times according to preset information type
Meter, and will be in statistical result update to the warning message table in database.
It alarms interim table and warning message table is two different tables, setting in this way is in order to avoid update operation causes
Table deadlock the phenomenon that.
" alarm times are counted according to preset information type, and statistical result is updated to the report in database
In alert information table " concrete meaning is, such as preset information is " vehicle, type of alarm, driver, date " this four, then
This four identical list items are integrated into one kind, then add " alarm times " list item, often there is four identical then alarm times
Add 1, when specific update is to warning message table, not only updates this four, also all by remaining all information such as latitude and longitude information etc.
It is updated.Setting can accelerate the inquiry velocity of warning message in this way.
Specific implementation mode two:The present embodiment is different from the first embodiment in that:In step 1, receives vehicle and sit
It marks data and multithreading reception is carried out to vehicle coordinate data specifically by the multi-threaded network library ZeroMQ based on message queue.
Other steps and parameter are same as the specific embodiment one.
Specific implementation mode three:The present embodiment is different from the first and the second embodiment in that:In step 2, to vehicle
Coordinate data, which is parsed, specially parses coordinate data according to TJ/T808 agreements.
Other steps and parameter are the same as one or two specific embodiments.
Specific implementation mode four:Unlike one of present embodiment and specific implementation mode one to three:In step 2, solution
The alert data of precipitation includes vehicle, longitude, latitude, speed, height, direction, time of fire alarming, type of alarm, driver information.
In step 5, preset information is vehicle, type of alarm, driver, date.
Other steps and parameter are identical as one of specific implementation mode one to three.
Specific implementation mode five:Unlike one of present embodiment and specific implementation mode one to four:In step 5, root
Alarm times are counted according to preset information type, and will be in statistical result update to the warning message table in database
Process is specially:
Alarm times are counted according to vehicle, type of alarm, driver, date, judge in warning message table whether
There are vehicle, type of alarm, driver, date and the identical records of statistical result, if so, then the record is updated, if
No, then statistical result is inserted into warning message table.
Other steps and parameter are identical as one of specific implementation mode one to four.
Specific implementation mode six:Unlike one of present embodiment and specific implementation mode one to five:In step 4, institute
It is timesten databases to state database.
Other steps and parameter are identical as one of specific implementation mode one to five.
Specific implementation mode seven:Present embodiment provides a kind of real-time analysis alert data based on recorder management platform
System, including:
Data reception module, for receiving vehicle coordinate data;The vehicle coordinate data include warning mark position.
The alert data parsed for being parsed to vehicle coordinate data, and is encapsulated as new number by parsing module
According to packet.
Cache module, for being cached new data packet using buffer area.
Memory module for reading the data of buffer area according to the setting timing of timer, and is stored in database and alarms
In interim table.
Data update module, for reading total data from interim table of alarming, according to preset information type to alarm
Number is counted, and will be in statistical result update to the warning message table in database.
Specific implementation mode eight:Present embodiment is unlike specific implementation mode seven:In data reception module, specifically
Multithreading reception is carried out to vehicle coordinate data by the multi-threaded network library ZeroMQ based on message queue;
In parsing module, coordinate data is parsed especially by TJ/T808 agreements;The alert data parsed includes
Vehicle, longitude, latitude, speed, height, direction, time of fire alarming, type of alarm, driver information;It is preset in memory module
Information is vehicle, type of alarm, driver, date.
Other steps and parameter are identical as specific implementation mode seven.
Specific implementation mode nine:Present embodiment is unlike specific implementation mode eight:In cache module, buffering area is
Buffer circle.
Other steps and parameter are identical as specific implementation mode seven or eight.
Specific implementation mode ten:Present embodiment is unlike specific implementation mode nine:In memory module, according to default
Information type alarm times are counted, and by statistical result update in the warning message table in database process have
Body is:
Alarm times are counted according to vehicle, type of alarm, driver, date, judge in warning message table whether
There are vehicle, type of alarm, driver, date and the identical records of statistical result, if so, then the record is updated, if
No, then other steps and parameter in statistical result insertion warning message table is identical as one of specific implementation mode seven to nine.
Specific implementation mode 11:In present embodiment, the data source needed for this system is in recorder management platform
The information push of coordinate data is sat by vehicle coordinate data receiver to this system by way of the push of the message of ZeroMQ
It includes warning mark position to mark in data, and marking TJ/T808 agreements according to portion parses alarm, the warning message that can be parsed
Including vehicle, longitude, latitude, speed, height, direction, time of fire alarming, type of alarm, driver etc. is packaged into new data
Packet, opens up buffer area and is cached to the warning message of parsing, using the alert data of the reading buffer area of timer timing, and
In the interim table of alarm of the deposit timesten databases of batch.
The data of interim table of timed task being responsible for alarming all are read, and according to vehicle, type of alarm, driver, day
Phase counts alarm times, by statistical result update to alarm table, judges whether alarm table has this in renewal process
Alarm logging (judgement of alarm logging is according to vehicle, type of alarm, driver and date), then if there is the alarm logging
Update operates this record, the insert new records if being not present, and the data counted in interim table are deleted buffer area
Using the design of buffer circle (ring buffer).Analysis service of alarming receives coordinate data and multithreading using multithreading
Alert data is handled, the quantity of thread can be adjusted according to the configuration and actual data volume of server, and only need to be
It modifies in configuration file, aspect is quick.
The present invention can also have other various embodiments, without deviating from the spirit and substance of the present invention, this field
Technical staff makes various corresponding change and deformations in accordance with the present invention, but these corresponding change and deformations should all belong to
The protection domain of appended claims of the invention.