CN106294769B - The mthods, systems and devices of synchronous engineering data - Google Patents

The mthods, systems and devices of synchronous engineering data Download PDF

Info

Publication number
CN106294769B
CN106294769B CN201610658456.6A CN201610658456A CN106294769B CN 106294769 B CN106294769 B CN 106294769B CN 201610658456 A CN201610658456 A CN 201610658456A CN 106294769 B CN106294769 B CN 106294769B
Authority
CN
China
Prior art keywords
engineering
engineering equipment
equipment information
information
memory database
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
CN201610658456.6A
Other languages
Chinese (zh)
Other versions
CN106294769A (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.)
Gree Electric Appliances Inc of Zhuhai
Original Assignee
Gree Electric Appliances Inc of Zhuhai
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 Gree Electric Appliances Inc of Zhuhai filed Critical Gree Electric Appliances Inc of Zhuhai
Priority to CN201610658456.6A priority Critical patent/CN106294769B/en
Publication of CN106294769A publication Critical patent/CN106294769A/en
Application granted granted Critical
Publication of CN106294769B publication Critical patent/CN106294769B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of mthods, systems and devices of synchronous engineering data.Wherein, this method comprises: reading at least one engineering equipment information from memory database in the case where starting synchronous engineering facility information, wherein store any one engineering equipment information in memory database in a manner of key-value pair;By all engineering equipment synchronizing informations in memory database to storing data library, and/or, by the engineering equipment information real-time synchronization updated in memory database to storing data library, wherein, any one engineering equipment information being stored in memory database is stored as an engineering record to storing data library.The present invention solves client in the prior art or when server directly operates database, and the sharp increase of data unit operation prevents the technical issues of memory database and storing data library are from real-time synchronization.

Description

The mthods, systems and devices of synchronous engineering data
Technical field
The present invention relates to database technical fields, in particular to method, system and the dress of a kind of synchronous engineering data It sets.
Background technique
Gree long-distance intelligent service centre is monitored the Central air-conditioning unit being distributed throughout the country, and realizes data The functions such as acquisition, storage, analysis application.With continuing to increase for central air-conditioning demand, monitors unit quantity and also quickly increase therewith It is long.Therefore, data storage is faced with huge challenge with analysis.
Using each central air-conditioning as an engineering, the unit that air-conditioning is included is set as one at intelligent Service center It is standby.Currently, letter is operated comprising crew base data (engineering, facility information), data unit operation, client user in database The data such as breath, machine group analysis information.The sharp increase of unit operation array can reduce the performance of database, especially when client or When person's server such as directly increases database, deletes, modifying, inquiring at the operation, the operating pressure of database is further increased. And the problems such as frequently operation of engineering, facility information is then often delayed, so that server can not be obtained quickly and accurately Information;Engineering equipment information cannot timely modify, and the data of storage are incorrect, have delay etc., further influence Correctness and real-time of the client to user's display data.
When directly operating to database for client in the prior art or server, data unit operation is sharply Increase prevent the problem of memory database and storing data library are from real-time synchronization, currently no effective solution has been proposed.
Summary of the invention
The embodiment of the invention provides a kind of mthods, systems and devices of synchronous engineering data, at least to solve existing skill When client or server directly operate database in art, the sharp increase of data unit operation makes memory database The technical issues of being unable to real-time synchronization with storing data library.
According to an aspect of an embodiment of the present invention, a kind of method of synchronous engineering data is provided, comprising:
In the case where starting synchronous engineering facility information, at least one engineering equipment letter is read from memory database Breath, wherein store any one engineering equipment information in memory database in a manner of key-value pair;It will be in memory database All engineering equipment synchronizing informations to storing data library, and/or, the engineering equipment information that will be updated in memory database is real When be synchronized to storing data library, wherein be stored in any one engineering equipment information in memory database as an engineering Record storage is to storing data library.
According to another aspect of an embodiment of the present invention, a kind of system of synchronous engineering data is additionally provided, comprising:
Memory, for storing the real-time update data of engineering equipment information;Real-time update equipment, for obtaining memory Real-time update data, and parse real-time update data, the operational order after obtaining parsing, and updating storage according to operational order Engineering equipment information in database;Start more new equipment, all engineering equipment letters in the queue for obtaining memory database Breath, and by engineering equipment information update into storing data library.
According to another aspect of an embodiment of the present invention, a kind of device of synchronous engineering data is additionally provided, comprising:
Read module, for reading at least one from memory database in the case where starting synchronous engineering facility information Engineering equipment information, wherein store any one engineering equipment information in memory database in a manner of key-value pair;It updates Module, for by all engineering equipment synchronizing informations in memory database to storing data library, and/or, by memory database The middle engineering equipment information real-time synchronization updated is to storing data library, wherein is stored in any one in memory database Engineering equipment information is stored as an engineering record to storing data library.
In embodiments of the present invention, by after synchronous engineering facility information starts, with key in the memory database of reading The engineering equipment information that value stores mode, and by all engineering equipment synchronizing informations in the memory database to storing data The engineering equipment information update updated in library or by memory database into storing data library, reached memory database with The purpose of the synchronization in storing data library promotes the technology of the performance of server to realize the access speed for accelerating server Effect, and then solve client in the prior art or when server directly operates database, data unit operation Sharp increase prevents the technical issues of memory database and storing data library are from real-time synchronization.
Detailed description of the invention
The drawings described herein are used to provide a further understanding of the present invention, constitutes part of this application, this hair Bright illustrative embodiments and their description are used to explain the present invention, and are not constituted improper limitations of the present invention.In the accompanying drawings:
Fig. 1 is a kind of method flow diagram of optional synchronous engineering data according to an embodiment of the present invention;
Fig. 2 is that a kind of starting of optional synchronous engineering data according to an embodiment of the present invention updates flow chart;
Fig. 3 is a kind of real-time update flow chart of optional synchronous engineering data according to an embodiment of the present invention;
Fig. 4 is a kind of real-time update flow chart of optional synchronous engineering data according to an embodiment of the present invention;
Fig. 5 is a kind of system structure diagram of optional synchronous engineering data according to an embodiment of the present invention;
Fig. 6 is a kind of apparatus structure schematic diagram of optional synchronous engineering data according to an embodiment of the present invention;
Fig. 7 is a kind of apparatus structure schematic diagram of optional synchronous engineering data according to an embodiment of the present invention;
Fig. 8 is a kind of apparatus structure schematic diagram of optional synchronous engineering data according to an embodiment of the present invention;
Fig. 9 is a kind of apparatus structure schematic diagram of optional synchronous engineering data according to an embodiment of the present invention;
Figure 10 is a kind of apparatus structure schematic diagram of optional synchronous engineering data according to an embodiment of the present invention;
Figure 11 is a kind of apparatus structure schematic diagram of optional synchronous engineering data according to an embodiment of the present invention;
Figure 12 is a kind of apparatus structure schematic diagram of optional synchronous engineering data according to an embodiment of the present invention.
Specific embodiment
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people The model that the present invention protects all should belong in member's every other embodiment obtained without making creative work It encloses.
It should be noted that description and claims of this specification and term " first " in above-mentioned attached drawing, " Two " etc. be to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should be understood that using in this way Data be interchangeable under appropriate circumstances, so as to the embodiment of the present invention described herein can in addition to illustrating herein or Sequence other than those of description is implemented.In addition, term " includes " and " having " and their any deformation, it is intended that cover Cover it is non-exclusive include, for example, the process, method, system, product or equipment for containing a series of steps or units are not necessarily limited to Step or unit those of is clearly listed, but may include be not clearly listed or for these process, methods, product Or other step or units that equipment is intrinsic.
Embodiment 1
According to embodiments of the present invention, a kind of embodiment of the method for synchronous engineering data is provided, it should be noted that attached The step of process of figure illustrates can execute in a computer system such as a set of computer executable instructions, though also, So logical order is shown in flow charts, but in some cases, it can be to be different from shown by sequence execution herein Or the step of description.
Fig. 1 is synchronous engineering data method according to an embodiment of the present invention, as shown in Figure 1, this method comprises the following steps:
Step S102 reads at least one work in the case where starting synchronous engineering facility information from memory database Journey facility information, wherein store any one engineering equipment information in memory database in a manner of key-value pair.
Specifically, all engineering equipment information is stored in memory database in the form of key-value pair in above-mentioned steps, Value corresponding to key word of the inquiry can read engineering equipment information from memory database.
It should be noted that above-mentioned memory database can be redis storing data library, from redis storing data library The mode for accessing data is equal are as follows: the corresponding value of keyword+keyword.
As a kind of optional embodiment, it is illustrated so that above-mentioned memory database is redis storing data library as an example, It before starting synchronous engineering facility information, needs to store engineering equipment information using the mode of key-value pair, hmset life can be used Storage engineering equipment information is enabled, such as executes sentence " 1 engineering name Central Garden of hmset project_id ", it can be by engineering It being identified as " 1 ", engineering name is that the engineering information of " Central Garden " is stored in redis storing data library, in above-mentioned sentence, " project " represents engineering information, and unique identification " _ id " is first domain, and " 1 " is first value, and " engineering name " is second A domain, " Central Garden " are second value.In the case where starting synchronous engineering facility information, can read in memory database Engineering equipment information, can be used hmget order read engineering equipment information, such as execute sentence " hmget project_1_ Id engineering name ", available engineering are identified as the unique identification and engineering name information of " 1 ".
Step S104, by all engineering equipment synchronizing informations in memory database to storing data library, and/or, it will be interior The engineering equipment information real-time synchronization updated in deposit data library is to storing data library, wherein is stored in memory database Any one engineering equipment information store as an engineering record to storing data library.
Specifically, in above-mentioned steps, in the case where starting synchronous engineering facility information, server has been in order to prevent A period of time is started, needs to update using starting at this time, i.e., extremely by all engineering equipment synchronizing informations in memory database Storing data library;It is real by the process of the engineering equipment information real-time synchronization updated in memory database to storing data library The process of Shi Gengxin.
It should be noted that starting updates and real-time update is dual-thread while carrying out, the difference of the two is to start more It is new to need to read all engineering equipment information from memory database, and these engineering equipment information are stored to storing data In library, after having traversed all engineering equipment information, starting, which updates, just to be stopped not reruning;And real-time update is from memory number According to engineering equipment information is obtained in the list in library, what is obtained is the operation information more revised, these information are by top service device What application server provided, and the thread of real-time update can be run always.Particularly, synchronization program and the meeting of real-time update program Start simultaneously.
As a kind of optional embodiment, above-mentioned storing data library can be mongodb database, with above-mentioned internal storage data Library is is illustrated for redis storing data library, when updating while starting for two kinds, real-time property may exist Data in special circumstances, such as present hash table are as follows:
(project_1 engineering name test1 positions Guangdong Province, province mac 1 time of 123456781 module's address 2016+07+01 + 13+32+16,
Project_2 engineering name test2 positions Guangdong Province, province mac 2 time of 123456782 module's address 2016+07+01+ 13+32+16,
Project_300 engineering name test3 positions Guangdong Province, province mac 2 time of 123456783 module's address 2016+07+ 01+13+32+18,
…)
And the data of redis list sync_proj are as follows:
(….
Save time 2016+07+01+13 in 300 engineering name Zhuhai City's Gree Electric Appliances of insert project positioning province Guangdong: 32:18,
300 module's address 2 of upsert project)
When starting renewal speed is faster than real-time update speed, it is assumed that got increase engineering equipment and be identified as 300 data, and it is written with each field, real-time update data start to process the (insert in queue at this time Project300 ...) data if write-in is unsuccessful can execute write operation twice, and it is nInsert=0 when obtaining return value And code=11000, explanation have been written into, then do not reprocess.When handling again, will be updated module's address is 2, and at this time The module's address of engineering 300 has been 2, mongodb for being updated to itself in the project set of mongodb database Data value will not operate again.
If having deleted the data that engineering equipment is identified as 300 in the server, the field is not present in hash table, But there is the modification to engineering 300 in redis queue to operate, when synchronization program first detects upsert in redis queue, Upsert order can be written to mongodb, mongodb judge whether to have existed the engineering, if there is no can rebuild This engineering equipment information;When getting remove operation from redis queue, this project data will be deleted, at this time Redis and mongodb presents consistent.
If having had changed the engineering equipment information of field in hash table, and there is also the engineerings in redis queue Facility information when starting to read hash table, can change corresponding field in mongodb set;The queue of redis is read when the later period When, the data field of mongodb is still latest value.
Certain several field has been deleted if it is the document in hash table, has first operated these fields in redis queue, after Continuous to delete these fields again, then mongodb first constructs these fields, then executes delete operation again.
When real-time update speed is greater than starting renewal speed, real-time update data have had updated the number in mongodb According to reading the latest data of project from hash table.Synchronization program updates the data in mongodb database, due to updating Data afterwards are consistent with the data before update, and mongodb database is no longer operated.It should be noted that mongodb data A kind of operation in library is called upsert, if document or field exist, is updated, if it does not exist, then increase document or Field.
As known from the above, it after synchronous engineering facility information starts, is deposited in a manner of key-value pair in the memory database of reading The engineering equipment information of storage, and by all engineering equipment synchronizing informations in the memory database into storing data library or will in Internal storage data may be implemented into storing data library in the engineering equipment information update that deposit data library updates through the above steps Library is synchronous with storing data library, therefore, can accelerate the access speed of server, promotes the performance of server, and then solve When client or server directly operate database in the prior art, in the sharp increase of data unit operation makes The technical issues of deposit data library and storing data library are unable to real-time synchronization.
Optionally, before starting synchronous engineering facility information, method further include:
Step S1020, in real time or timing generates multiple engineering marks, and multiple engineerings mark is sequentially written in and is pre-created Memory queue in.
Specifically, being generated in the queue of memory database a certain number of before starting synchronous engineering facility information These are written to memory database by integer, unique identification of these integers as engineering Queue in.It should be noted that these integers can't be regenerated again when the restarting of synchronous engineering facility information, only That can be inserted into new integer in the tail of the queue of the queue, the integer being newly inserted into carried out on the basis of the maximum value of last time tail of the queue it is incremental, The queue will not because of synchronous engineering facility information closing and disappear.
As a kind of optional embodiment, using redis storing data library as memory database for be illustrated.Assuming that 10 integers are generated in redis queue, this 10 integers are inserted into the queue of redis, these integers are in redis team Structure in column is as shown in table 1.
Table 1
1 2 3 4 5 6 7 8 9 10
Wherein, 1 is team's head, and 10 be tail of the queue.It should be noted that redis queue can at most store 4294967295 columns According to.
Step S1022, after the device data for receiving the upload of at least one engineering equipment, from memory queue successively Read engineering mark.
Specifically, in above-mentioned steps, after server receives the data of engineering equipment upload, from internal storage data Unique identification of team's head data as the engineering is taken out in the queue in library;If server receives what multiple engineering equipments uploaded After data, unique identification of team's head data as each engineering in memory database queue is successively taken out.
As a kind of optional embodiment, still using redis storing data library as memory database for be illustrated, it is false If server has received only the data of an engineering equipment, then team's head data 1 are taken out from redis queue and are connect as server The structure of the unique identification of the engineering equipment received, at this time redis queue is as shown in table 2.
Table 2
2 3 4 5 6 7 8 9 10
Each device data is successively associated with the engineering mark being successively read by step S1024, and by number of devices According to position corresponding with associated engineering mark is inserted into, at least one engineering equipment information is obtained, wherein engineering equipment information is extremely Less include: engineering equipment data and is identified with the associated unique engineering of engineering mark.
It is carried out specifically, server will obtain engineering equipment information with the engineering mark got from memory database queue Correspond, and by the engineering equipment data of acquisition be sequentially inserted into engineering corresponding to the engineering equipment information mark institute it is right The position answered can obtain the corresponding engineering equipment information of above-mentioned engineering mark in this way.
As a kind of optional embodiment, still using redis storing data library as memory database for be illustrated, lead to It crosses step S1022 and step S1024 and has obtained the hash table of the engineering equipment, which is named as project_1, engineering It is identified as 1, the information stored in the hash table is the engineering equipment information of the engineering equipment.The hash table is as storing data library A record in table, and all hash tables with project beginning constitute project in storing data library and gather.
Step S1026 saves at least one engineering equipment information and obtains memory database.
It should be noted that the engineering equipment information after progress data correlation is sequentially stored into memory database, it is convenient It is used in subsequent step.
As known from the above, the above method takes full advantage of the characteristic of queue first in first out, adds data in the tail of the queue of queue, Team's head takes out data, and this mode both ensure that the uniqueness of mark, in turn ensures the increasing property certainly of mark, and the mark increased certainly The information of current engineering equipment is also enabled preferably to show.
Optionally, include: by the method in all engineering equipment synchronizing information to storing data libraries in memory database
Step S202 traverses memory database based on engineering keyword, obtains all keys with engineering Keywords matching Word.
Specifically, in above-mentioned steps S202, it is crucial according to the engineering of input using the inquiry instruction of memory database Word can inquire and the same or similar all keywords of the keyword.It should be noted that the side of above-mentioned search key Method can be to search for generally, or accurate search;In the case where searching for generally, input is incomplete keyword; In the case where accurate search, search is complete keyword.
As a kind of optional embodiment, still using redis storing data library as memory database for be illustrated, The scan order in redis storing data library can be used to ergodic data library, match all engineering equipment information.Such as using " scan 0match project_* " order can traverse all with " project_ " beginning in entire redis storing data library Hash table key assignments.In mentioned order, " * " is asterisk wildcard, and " 0 " represents and operated since first occurrence.On Stating the result after order is finished is an array, and the element in the array is and engineering keyword " project_ " phase Matched all keywords, the element composition of the array may be " project_1 ", " project_2 ", " project_ The number and element value of 3 " ... the array elements are related with the specific data stored in redis database under concrete condition.
Step S204 determines corresponding key assignments according to the keyword that matching obtains, all engineering equipments letter stored Breath, wherein keyword identifies associated device data with engineering for characterizing for characterizing engineering mark, key assignments.
Specifically, traversing entire internal storage data by using the querying command of memory database in above-mentioned steps S204 Library, uses the key assignments acquisition instruction of memory database according to the obtained keyword of traversal, corresponding to the available keyword Engineering equipment information.It should be noted that keyword is the unique identification of engineering equipment, and key assignments represents engineering equipment letter Breath.
As a kind of optional embodiment, still using redis storing data library as memory database for be illustrated, make After having traversed memory database with the scan order in redis storing data library, a keyword array is obtained, it is assumed that the keyword The component of array is " project_1 ", " project_2 ", " project_3 ".Then redis storing data library is reused " hgetall " order engineering equipment information corresponding to some keyword in the available array, such as execute order " hgetall project_1 ", all engineering equipment information under available engineering equipment " project_1 ", " project_ Engineering equipment information under 1 " may be " 1 engineering name Central Garden of _ id ".
Step S206, by all engineering equipment synchronizing informations to storing data library.
Specifically, after having obtained all engineering equipment information, these engineering equipments are believed in above-mentioned steps S206 Breath is updated into storing data library, just completes the update of engineering equipment information.
It should be noted that step S202 to step S206 complete be synchronous engineering data starting renewal process, tool The flow chart of body is as shown in Figure 2.
Optionally, engineering equipment information includes at least one following: engineering equipment title, positioning province, MAC Address, module Type and time.
Specifically, engineering equipment title represents the mark for distinguishing the engineering equipment;Positioning, which saves, represents engineering equipment place Province;MAC Address represents the physical address of engineering equipment;Module type is represented using specific numerical value, is such as represented using 1 Temperature detecting module, 2 representing fault display modules etc..
Optionally, by the engineering equipment information real-time synchronization updated in memory database to storing data library, comprising:
Step S302, if detecting that the engineering equipment information in memory database updates, reading is updated Engineering equipment information corresponding to more new command, more new command includes at least one following: increasing instruction, deletes instruction and repair Change instruction.
Specifically, detecting that the engineering equipment information in memory database is updated in above-mentioned steps S302 Afterwards, the engineering equipment information updated includes the specific more new command that the engineering equipment occurs, including increases engineering equipment letter Breath deletes engineering equipment information and modification engineering equipment information.
Step S304 parses the engineering equipment information updated according to different more new commands.
Specifically, in above-mentioned steps S304, according to the more new command in memory database queue to having occurred that more New engineering equipment information carries out dissection process.
Step S306, according to parsing result synchronized update storing data library.
In above-mentioned steps step S306, according to the parsing result in step S304, the result after parsing is updated to depositing Updated engineering equipment information is saved in storage database.
It should be noted that step S302 to step S306 complete be synchronous engineering data real-time update process, tool The flow chart of body is as shown in Figure 3.
As a kind of optional embodiment, as shown in figure 3, being stored in above-mentioned steps S302 into step S306 with redis As being illustrated for memory database, real-time update order will be placed in the queue of entitled sync_projdev database, Synchronization program uses " lindex " order to check data first from queue, according to the data checked, for different operations into This engineering equipment information after being updated successfully, is taken out from redis queue, that is, deletes letter by row mongodb database update Breath.
Optionally, as shown in figure 4, before reading the operation of update corresponding to the engineering equipment information updated, The above method further include:
Step S3002 receives the more new command that server is updated memory database.
Specifically, server sends more new command to memory database, interior before being updated to engineering equipment information After deposit data library receives the more new command, increased according to the internal deposit data library of more new command, modified and delete operation.
Step S3004 is carried out engineering equipment information corresponding in the memory queue of memory database using more new command It updates, and the write-in of more new command is updated into queue, wherein if synchronization program detects to update there is more new command in queue, Then determine that the engineering equipment information in memory database is updated.
As a kind of optional embodiment, in above-mentioned steps S3004, using redis storing data library as internal storage data It is illustrated for library, real-time update order will be placed in the queue of entitled sync_projdev, when detecting sync_ When the presence more new command in projdev queue, such as modification instruction, illustrate the engineering equipment information in redis storing data library It is updated, at this point, being written using the engineering equipment information in modification instruction modification redis database, and by modification instruction Into sync_projdev queue.Complete the operation of step S302 to step S306 again later, Lai Shixian synchronization program it is real-time It updates.
Optionally, include: according to the engineering equipment information that different more new command parsings is updated
Step S104102 parses the first character section of more new command, if the content of first character section is insertion operation, Then determine that more new command is to increase instruction.
Step S104104 parses other fields of more new command, obtains the first synchronized update information, wherein first is synchronous More new information includes at least: the engineering mark and device data of newly-increased engineering equipment information.
Specifically, believing in above-mentioned steps S104102 and step S104104 the engineering equipment for having occurred that update Breath is parsed, and when the content for parsing first character section is insertion operation, character string is added one by one with key assignments, mark is such as added For 3 engineering equipment information, as shown in table 3.
Table 3
insert project 3 Engineering name name1 Module type 2
Wherein, engineering name, module type are the field information that the engineering equipment includes.
As a kind of optional embodiment, in above-mentioned steps S104102 and step S104104, number is still stored with redis According to library as being illustrated for memory database, it is assumed that newly-increased engineering equipment information is (3 engineering of insert project Save time 2016+07+01+13:32:18 in name Zhuhai City's Gree Electric Appliances positioning province Guangdong).Synchronization program is from redis storing data The engineering equipment information is obtained in library, first parsing first character section insert, be known as increasing instruction, then parse Project, explanation are opertions engineering information, and 3 representatives are engineering equipment marks, which is identified as engineering equipment information Unique identification, then parse and engineering and be set to province, obtain field Zhuhai City Gree Electric Appliances and Zhuhai City.
Optionally, include: according to the engineering equipment information that different more new command parsings is updated
Step S104106 parses the first character section of more new command, if the content of first character section is modification operation, Then determine that more new command is modification instruction.
Step S104108 parses other fields of more new command, obtains the second synchronized update information, wherein second is synchronous More new information includes at least: the engineering mark and device data of modified engineering equipment information.
Specifically, believing in above-mentioned steps S104106 and step S104108 the engineering equipment for having occurred that update Breath is parsed, and when the content for parsing first character section is modification operation, data is modified in the form of key-value pair, such as modify work Journey is identified as 3 information, as shown in table 4.
Table 4
upsert project 3 Engineering name name2 Module type 3
Engineering name to engineering 3 is changed to name2 by original name1 by synchronization program, and module type is changed to 3 by 2.
As a kind of optional embodiment, still using redis storing data library as memory database for be illustrated, it is false If the engineering equipment information of modification is (3 engineering name perfume (or spice) continent general merchandise of upsert project), first character section upsert is parsed, Be known as modification instruction, (project 3) is then represented be modified logo as 3 engineering equipment information, (engineering name perfume (or spice) continent general merchandise) It indicates to change the engineering file-name field in the engineering equipment information into fragrant continent general merchandise.
Optionally, include: according to the engineering equipment information that different more new command parsings is updated
Step S104110 parses the first character section of more new command, if the content of first character section is delete operation, Then determine that more new command is to delete instruction.
Step S104112 parses other fields of more new command, obtains third synchronized update information, wherein third is synchronous More new information includes at least: the engineering mark and device data for the engineering equipment information for needing to delete.
Specifically, believing in above-mentioned steps S104110 and step S104112 the engineering equipment for having occurred that update Breath is parsed, when the content for parsing first character section is delete operation, according to the behaviour of memory database and storing data library Make, is classified as the deletion to document and the deletion to field.
When the content for parsing first character section is to delete document function, some document is deleted according to unique identification, such as: table Shown in 5.
Table 5
remove project 3
Deletion engineering is identified as 3 all information by the operation.
When the content for parsing first character section is to delete field operations, list what needs were deleted in detailed operational character string Field name, as shown in table 6.
Table 6
unset project 3 Engineering name MAC Address Module type Positioning saves
The operation will delete the engineering name of engineering 3, MAC Address, module type, the information such as positioning province.
As a kind of optional embodiment, in above-mentioned steps S104106 and step S104108, number is still stored with redis According to library as being illustrated for memory database, it is assumed that the engineering equipment information for deleting document is (remove project3), Parsing remove field determines this engineering equipment information to delete document function first, and then being determined according to (project3) needs Delete the record of engineering 3.Assuming that the engineering equipment information for deleting field is (the 3 MAC module address unset project), Unset field is parsed first determines that this engineering equipment information to delete field operations, is then determined according to (project 3) Need to delete the field in engineering 3, it is last according to (MAC, module's address), delete for need to delete mac and module's address this two A field.
Optionally, as shown in figure 4, including: according to the method in parsing result synchronized update storing data library
Step S3010 forms writing commands according to parsing result.
Writing commands are synchronized to storing data library by step S3012, so that storing data library executes more according to writing commands New operation.
Specifically, having occurred that update according to the parsing of more new command in above-mentioned steps S3010 and step S3012 Facility information after, parsing result is formed into writing commands, storing data library is according to writing commands more new database.
As a kind of optional embodiment, using redis database as memory database, mongodb database is used as and deposits It is illustrated for storage database, it is assumed that the result after parsing is (the 3 Gree Electric Appliances Guangdong Province, Zhuhai City insert project 2016+07+01+13:32:18), the result after above-mentioned parsing is formed into writing commands, mongodb database executes insertion behaviour Make, (3 Zhuhai City Gree Electric Appliances Guangdong Province 2016+07+01+13:32:18 of project) is inserted into mongodb database table In corresponding column, the update of mongodb database is completed.
Optionally, after according to parsing result synchronized update storing data library, as shown in figure 4, determining storing data library The method whether being updated successfully includes:
Step S3014, in the case where writing commands instruction needs to increase engineering equipment information, if the parameter value returned For nonnegative number, it is determined that successfully increase engineering equipment information in storing data library;It needs to modify engineering in writing commands instruction to set In the case where standby information, if the parameter value returned is nonnegative number, it is determined that successfully modify engineering equipment letter in storing data library Breath;In the case where writing commands instruction needs to delete engineering equipment information, if the parameter value returned is nonnegative number, it is determined that Engineering equipment information is successfully deleted in storing data library;Wherein, in the case where any one parameter value nonnegative number, storage is determined Whether database updates failure.
As a kind of optional embodiment, still using redis storing data library as memory database for be illustrated, it is right After order in redis queue is parsed, the writing commands of mongodb database are formed, update mongodb.For difference Operation, if connection mongodb it is normal, execute order after can return to different operating result: WriteResult:
In the case where writing commands instruction needs to increase engineering equipment information, Insert instruction is executed, is returned NInserted parameter, if nInserted >=0, judge that increase operates successfully;
In the case where writing commands instruction needs to modify engineering equipment information, IUpsert instruction is executed, is returned NMatched parameter, if nMatched >=0, judge that modification operates successfully;
In the case where writing commands instruction needs to delete engineering equipment information, Remove instruction is executed, is returned NRemoved parameter, if nRemoved >=0, judge to delete document function success;
In the case where writing commands instruction needs to delete engineering equipment information, Unset instruction is executed, nMatched is returned Parameter, if nMatched >=0, judge to delete field operations success.
Embodiment 2
According to embodiments of the present invention, a kind of system embodiment of synchronous engineering data is provided, Fig. 5 is real according to the present invention The system structure diagram of the synchronous engineering data of example is applied, including memory 401, real-time update equipment 403 and starting are updated and set Standby 405, as shown in Figure 5.
Memory 401, for storing the real-time update data of engineering equipment information.
It should be noted that memory is used to store real-time update equipment and starts the renewal project equipment letter of more new equipment Breath, memory can be mongodb database, be used to long-term storage engineering facility information, or redis database is used to Interim storage engineering facility information.
Real-time update equipment 403 for obtaining the real-time update data of memory, and parses real-time update data, obtains Operational order after parsing, and update storage according to operational order the engineering equipment information in database.
Specifically, server sends more new command to memory database, interior before being updated to engineering equipment information After deposit data library receives the more new command, increased according to the internal deposit data library of more new command, modified and delete operation;When same Programmable detection is walked to when updating in queue in the presence of more new command, illustrates that the engineering equipment information in memory database has occurred more Newly, at this point, updating the engineering equipment information in memory queue according to more new command, and the write-in of more new command is updated in queue; After detecting that update has occurred in the engineering equipment information in memory database, the engineering equipment information updated includes the work The specific more new command that journey equipment occurs, including increase engineering equipment information, delete engineering equipment information and modify engineering and set Standby information;The engineering equipment information for having occurred that update is carried out at parsing according to the more new command in memory database queue Reason;By the engineering equipment information update after parsing into storing data library, the real-time update of engineering equipment information is just completed.
Start more new equipment 405, all engineering equipment information in the queue for obtaining memory database, and engineering is set Standby information update is into storing data library.
Specifically, according to the engineering keyword of input, can be inquired and the pass using the inquiry instruction of memory database The same or similar all keywords of key word;The key assignments acquisition instruction of memory database is used according to the keyword that traversal obtains, Engineering equipment information corresponding to the available keyword;After having obtained all engineering equipment information, by these engineerings Into storing data library, the starting for just completing engineering equipment information updates device information update.
It should be noted that starting updates and real-time update is dual-thread while carrying out, the difference of the two is to start more It is new to need to read all engineering equipment information from memory database, and these engineering equipment information are stored to storing data In library, after having traversed all engineering equipment information, starting, which updates, just to be stopped not reruning;And real-time update is from memory number According to engineering equipment information is obtained in the list in library, what is obtained is the operation information more revised, these information are by top service device What application server provided, and the thread of real-time update can be run always.Particularly, synchronization program and the meeting of real-time update program Start simultaneously.
As known from the above, it after synchronous engineering facility information starts, is deposited in a manner of key-value pair in the memory database of reading The engineering equipment information of storage, and by all engineering equipment synchronizing informations in the memory database into storing data library or will in Internal storage data may be implemented by above system into storing data library in the engineering equipment information update that deposit data library updates Library is synchronous with storing data library, therefore, can accelerate the access speed of server, promotes the performance of server, and then solve When client or server directly operate database in the prior art, in the sharp increase of data unit operation makes The technical issues of deposit data library and storing data library are unable to real-time synchronization.
Embodiment 3
According to embodiments of the present invention, a kind of Installation practice of synchronous engineering data is provided, Fig. 6 is real according to the present invention The apparatus structure schematic diagram of the synchronous engineering data of example, including read module 501 and update module 503 are applied, as shown in Figure 6.
Read module 501, for being read at least from memory database in the case where starting synchronous engineering facility information One engineering equipment information, wherein store any one engineering equipment information in memory database in a manner of key-value pair.
Specifically, all engineering equipment information is stored in memory database in the form of key-value pair, key word of the inquiry institute Corresponding value can read engineering equipment information from memory database.
It should be noted that above-mentioned memory database can be redis storing data library, from redis storing data library The mode for accessing data is equal are as follows: the corresponding value of keyword+keyword.
As a kind of optional embodiment, it is illustrated so that above-mentioned memory database is redis storing data library as an example, It before starting synchronous engineering facility information, needs to store engineering equipment information using the mode of key-value pair, hmset life can be used Storage engineering equipment information is enabled, such as executes sentence " 1 engineering name Central Garden of hmset project_id ", it can be by engineering It being identified as " 1 ", engineering name is that the engineering information of " Central Garden " is stored in redis storing data library, in above-mentioned sentence, " project " represents engineering information, and unique identification " _ id " is first domain, and " 1 " is first value, and " engineering name " is second A domain, " Central Garden " are second value.In the case where starting synchronous engineering facility information, can read in memory database Engineering equipment information, can be used hmget order read engineering equipment information, such as execute sentence " hmget project_1_ Id engineering name ", available engineering are identified as the unique identification and engineering name information of " 1 ".
Update module 503, for by all engineering equipment synchronizing informations in memory database to storing data library, and/ Or, by the engineering equipment information real-time synchronization updated in memory database to storing data library, wherein be stored in memory number It is stored as an engineering record to storing data library according to any one engineering equipment information in library.
Specifically, in the case where starting synchronous engineering facility information, when server has had been started up one section in order to prevent Between, it needs to update using starting at this time, i.e., by all engineering equipment synchronizing informations in memory database to storing data library;It will The process in the engineering equipment information real-time synchronization updated in memory database to storing data library is the process of real-time update.
It should be noted that starting updates and real-time update is dual-thread while carrying out, the difference of the two is to start more It is new to need to read all engineering equipment information from memory database, and these engineering equipment information are stored to storing data In library, after having traversed all engineering equipment information, starting, which updates, just to be stopped not reruning;And real-time update is from memory number According to engineering equipment information is obtained in the list in library, what is obtained is the operation information more revised, these information are by top service device What application server provided, and the thread of real-time update can be run always.Particularly, synchronization program and the meeting of real-time update program Start simultaneously.
As a kind of optional embodiment, above-mentioned storing data library can be mongodb database, with above-mentioned internal storage data Library is is illustrated for redis storing data library, when updating while starting for two kinds, real-time property may exist Data in special circumstances, such as present hash table are as follows:
(project_1 engineering name test1 positions Guangdong Province, province mac 1 time of 123456781 module's address 2016+07+01 + 13+32+16,
Project_2 engineering name test2 positions Guangdong Province, province mac 2 time of 123456782 module's address 2016+07+01+ 13+32+16,
Project_300 engineering name test3 positions Guangdong Province, province mac 2 time of 123456783 module's address 2016+07+ 01+13+32+18,
…)
And the data of redis list sync_proj are as follows:
(….
Save time 2016+07+01+13 in 300 engineering name Zhuhai City's Gree Electric Appliances of insert project positioning province Guangdong: 32:18,
300 module's address 2 of upsert project)
When starting renewal speed is faster than real-time update speed, it is assumed that got increase engineering equipment and be identified as 300 data, and it is written with each field, real-time update data start to process the (insert in queue at this time Project300 ...) data if write-in is unsuccessful can execute write operation twice, and it is nInsert=0 when obtaining return value And code=11000, explanation have been written into, then do not reprocess.When handling again, will be updated module's address is 2, and at this time The module's address of engineering 300 has been 2, mongodb for being updated to itself in the project set of mongodb database Data value will not operate again.
If having deleted the data that engineering equipment is identified as 300 in the server, the field is not present in hash table, But there is the modification to engineering 300 in redis queue to operate, when synchronization program first detects upsert in redis queue, Upsert order can be written to mongodb, mongodb judge whether to have existed the engineering, if there is no can rebuild This engineering equipment information;When getting remove operation from redis queue, this project data will be deleted, at this time Redis and mongodb presents consistent.
If having had changed the engineering equipment information of field in hash table, and there is also the engineerings in redis queue Facility information when starting to read hash table, can change corresponding field in mongodb set;The queue of redis is read when the later period When, the data field of mongodb is still latest value.
Certain several field has been deleted if it is the document in hash table, has first operated these fields in redis queue, after Continuous to delete these fields again, then mongodb first constructs these fields, then executes delete operation again.
When real-time update speed is greater than starting renewal speed, real-time update data have had updated the number in mongodb According to reading the latest data of project from hash table.Synchronization program updates the data in mongodb database, due to updating Data afterwards are consistent with the data before update, and mongodb database is no longer operated.It should be noted that mongodb data A kind of operation in library is called upsert, if document or field exist, is updated, if it does not exist, then increase document or Field.
As known from the above, it after synchronous engineering facility information starts, is deposited in a manner of key-value pair in the memory database of reading The engineering equipment information of storage, and by all engineering equipment synchronizing informations in the memory database into storing data library or will in Internal storage data may be implemented into storing data library in the engineering equipment information update that deposit data library updates through the above steps Library is synchronous with storing data library, therefore, can accelerate the access speed of server, promotes the performance of server, and then solve When client or server directly operate database in the prior art, in the sharp increase of data unit operation makes The technical issues of deposit data library and storing data library are unable to real-time synchronization.
Optionally, before starting synchronous engineering facility information, as shown in fig. 7, above-mentioned apparatus further include:
First writing module 601 is successively write for generating multiple engineerings marks in real time or periodically, and by multiple engineerings mark Enter in the memory queue being pre-created.
Specifically, being generated in the queue of memory database a certain number of before starting synchronous engineering facility information These are written to memory database by integer, unique identification of these integers as engineering Queue in.It should be noted that these integers can't be regenerated again when the restarting of synchronous engineering facility information, only That can be inserted into new integer in the tail of the queue of the queue, the integer being newly inserted into carried out on the basis of the maximum value of last time tail of the queue it is incremental, The queue will not because of synchronous engineering facility information closing and disappear.
As a kind of optional embodiment, using redis storing data library as memory database for be illustrated.Assuming that 10 integers are generated in redis queue, this 10 integers are inserted into the queue of redis, these integers are in redis team Structure in column is as shown in table 7.
Table 7
1 2 3 4 5 6 7 8 9 10
Wherein, 1 is team's head, and 10 be tail of the queue.It should be noted that redis queue can at most store 4294967295 columns According to.
First read module 603, for receive at least one engineering equipment upload device data after, from memory Engineering mark is successively read in queue.
Specifically, being taken from the queue of memory database after server receives the data of engineering equipment upload Unique identification of team's head data as the engineering out;After if server receives the data that multiple engineering equipments upload, successively Take out unique identification of team's head data as each engineering in memory database queue.
As a kind of optional embodiment, still using redis storing data library as memory database for be illustrated, it is false If server has received only the data of an engineering equipment, then team's head data 1 are taken out from redis queue and are connect as server The structure of the unique identification of the engineering equipment received, at this time redis queue is as shown in table 8.
Table 8
2 3 4 5 6 7 8 9 10
First matching module 605, for each device data to be successively associated with the engineering mark being successively read, And device data is inserted into position corresponding with associated engineering mark, obtain at least one engineering equipment information, wherein engineering Facility information includes at least: engineering equipment data and identifying with the associated unique engineering of engineering mark.
It is carried out specifically, server will obtain engineering equipment information with the engineering mark got from memory database queue Correspond, and by the engineering equipment data of acquisition be sequentially inserted into engineering corresponding to the engineering equipment information mark institute it is right The position answered can obtain the corresponding engineering equipment information of above-mentioned engineering mark in this way.
As a kind of optional embodiment, still using redis storing data library as memory database for be illustrated, lead to It crosses step S1022 and step S1024 and has obtained the hash table of the engineering equipment, which is named as project_1, engineering It is identified as 1, the information stored in the hash table is the engineering equipment information of the engineering equipment.The hash table is as storing data library A record in table, and all hash tables with project beginning constitute project in storing data library and gather.
First memory module 607 obtains memory database for saving at least one engineering equipment information.
It should be noted that the engineering equipment information after progress data correlation is sequentially stored into memory database, it is convenient It is used in subsequent step.
As known from the above, the above method takes full advantage of the characteristic of queue first in first out, adds data in the tail of the queue of queue, Team's head takes out data, and this mode both ensure that the uniqueness of mark, in turn ensures the increasing property certainly of mark, and the mark increased certainly The information of current engineering equipment is also enabled preferably to show.
Optionally, as shown in figure 8, update module 503 includes:
Search module 701 obtains the institute with engineering Keywords matching for traversing memory database based on engineering keyword There is keyword.
Specifically, according to the engineering keyword of input, can be inquired and the pass using the inquiry instruction of memory database The same or similar all keywords of key word.It should be noted that the method for above-mentioned search key can be to search for generally, It can be accurate search;In the case where searching for generally, input is incomplete keyword;In the case where accurate search, Search is complete keyword.
As a kind of optional embodiment, still using redis storing data library as memory database for be illustrated, The scan order in redis storing data library can be used to ergodic data library, match all engineering equipment information.Such as using " 0 match project_* of scan " order can traverse all with " project_ " beginning in entire redis storing data library Hash table key assignments.In mentioned order, " * " is asterisk wildcard, and " 0 " represents and operated since first occurrence.On Stating the result after order is finished is an array, and the element in the array is and engineering keyword " project_ " phase Matched all keywords, the element composition of the array may be " project_1 ", " project_2 ", " project_ The number and element value of 3 " ... the array elements are related with the specific data stored in redis database under concrete condition.
Second matching module 703, the keyword for being obtained according to matching determine corresponding key assignments, and what is stored is all Engineering equipment information, wherein keyword identifies associated number of devices with engineering for characterizing for characterizing engineering mark, key assignments According to.
Specifically, the querying command by using memory database traverses entire memory database, obtained according to traversal Keyword uses the key assignments acquisition instruction of memory database, engineering equipment information corresponding to the available keyword.It needs Illustrate, keyword is the unique identification of engineering equipment, and key assignments represents the engineering equipment information.
As a kind of optional embodiment, still using redis storing data library as memory database for be illustrated, make After having traversed memory database with the scan order in redis storing data library, a keyword array is obtained, it is assumed that the keyword The component of array is " project_1 ", " project_2 ", " project_3 ".Then redis storing data library is reused " hgetall " order engineering equipment information corresponding to some keyword in the available array, such as execute order " hgetall project_1 ", all engineering equipment information under available engineering equipment " project_1 ", " project_ Engineering equipment information under 1 " may be " 1 engineering name Central Garden of _ id ".
First synchronization module 705 is used for all engineering equipment synchronizing informations to storing data library.
Specifically, after having obtained all engineering equipment information, by these engineering equipment information updates to storing data In library, the update of engineering equipment information is just completed.
Optionally, engineering equipment information includes at least one following: engineering equipment title, positioning province, MAC Address, module Type and time.
Specifically, engineering equipment title represents the mark for distinguishing the engineering equipment;Positioning, which saves, represents engineering equipment place Province;MAC Address represents the physical address of engineering equipment;Module type is represented using specific numerical value, is such as represented using 1 Temperature detecting module, 2 representing fault display modules etc..
Optionally, as shown in figure 9, update module 503 further include:
First read module 801 is read if the engineering equipment information for detecting in memory database updates More new command corresponding to the engineering equipment information updated, more new command include at least one following: increasing instruction, delete Except instruction and modification instruction.
Specifically, after detecting that update has occurred in the engineering equipment information in memory database, the engineering that updates Facility information includes the specific more new command that the engineering equipment occurs, including increases engineering equipment information, deletes engineering equipment letter Breath and modification engineering equipment information.
First parsing module 803, for parsing the engineering equipment information updated according to different more new commands.
Specifically, according to the more new command in memory database queue to have occurred that the engineering equipment information of update into Row dissection process.
Second synchronization module 805, for according to parsing result synchronized update storing data library.
As a kind of optional embodiment, using redis storing data library as memory database for be illustrated, in real time More newer command will be placed in the queue of entitled sync_projdev, and synchronization program uses " lindex " order to look into first from queue It sees data, according to the data checked, carries out mongodb database update for different operations, after being updated successfully, from This engineering equipment information is taken out in redis queue, i.e. deletion information.
Optionally, as shown in Figure 10, above-mentioned apparatus further include:
Receiving module 901, the more new command that memory database is updated for receiving server.
Specifically, server sends more new command to memory database, interior before being updated to engineering equipment information After deposit data library receives the more new command, increased according to the internal deposit data library of more new command, modified and delete operation.
Second writing module 903, for using more new command to set engineering corresponding in the memory queue of memory database Standby information is updated, and the write-in of more new command is updated queue, wherein is existed in queue if synchronization program detects to update More new command, it is determined that the engineering equipment information in memory database is updated.
Specifically, illustrating the work in memory database when synchronization program is detected and updated in queue in the presence of more new command Journey facility information is updated, at this point, updating the engineering equipment information in memory queue according to more new command, and update is referred to Write-in is enabled to update in queue.
As a kind of optional embodiment, using redis storing data library as memory database for be illustrated, in real time More newer command will be placed in the queue of entitled sync_projdev, be referred to when detecting that the presence in sync_projdev queue updates It enables, when such as modification instructs, illustrates that the engineering equipment information in redis storing data library is updated, at this point, referring to using modification The engineering equipment information in modification redis database is enabled, and modification instruction is written in sync_projdev queue.Later again Complete the operation of step S10406 to step S10410, the real-time update of Lai Shixian synchronization program.
Optionally, as shown in fig. 11a, the engineering equipment information update updated is parsed according to different more new commands Module 503 includes:
It is inserted into module 1001, for parsing the first character section of more new command, if the content of first character section is insertion Operation, it is determined that more new command is to increase instruction;Other fields of more new command are parsed, the first synchronized update information is obtained, In, the first synchronized update information includes at least: the engineering mark and device data of newly-increased engineering equipment information.
Specifically, to having occurred that the engineering equipment information of update parses, when the content of parsing first character section When for insertion operation, character string is added one by one with key assignments, as be added be identified as 3 engineering equipment information it is as shown in table 9.
Table 9
insert project 3 Engineering name name1 Module type 2
Wherein, engineering name, module type are the field information that the engineering equipment includes.
As a kind of optional embodiment, still using redis storing data library as memory database for be illustrated, it is false If newly-increased engineering equipment information is that (3 engineering name Zhuhai City's Gree Electric Appliances of insert project positions province Guangdong and saves time 2016+07+01+13:32:18).Synchronization program obtains the engineering equipment information from redis storing data library, first parsing the One field insert is known as increasing instruction, then parses project, and explanation is opertions engineering information, and 3 representatives are works Journey device identification, the engineering equipment are identified as the unique identification of engineering equipment information, then parse engineering and be set to province, obtain field Zhuhai City's Gree Electric Appliances and Zhuhai City.
Optionally, as shown in figure 11b, update module 503 includes:
Modified module 1003, for parsing the first character section of more new command, if the content of first character section is modification Operation, it is determined that more new command is modification instruction;Other fields of more new command are parsed, the second synchronized update information is obtained, In, the second synchronized update information includes at least: the engineering mark and device data of modified engineering equipment information.
Specifically, to having occurred that the engineering equipment information of update parses, when the content of parsing first character section When operating for modification, data are modified in the form of key-value pair, such as modify the information that engineering is identified as 3, as shown in table 10.
Table 10
upsert project 3 Engineering name name2 Module type 3
Engineering name to engineering 3 is changed to name2 by original name1 by synchronization program, and module type is changed to 3 by 2.
As a kind of optional embodiment, still using redis storing data library as memory database for be illustrated, it is false If the engineering equipment information of modification is (3 engineering name perfume (or spice) continent general merchandise of upsert project), first character section upsert is parsed, Be known as modification instruction, (project 3) is then represented be modified logo as 3 engineering equipment information, (engineering name perfume (or spice) continent general merchandise) It indicates to change the engineering file-name field in the engineering equipment information into fragrant continent general merchandise.
Optionally, as shown in fig. 11c, update module 503 includes:
Removing module 1005, for parsing the first character section of more new command, if the content of first character section is to delete Operation, it is determined that more new command is to delete instruction;Other fields of more new command are parsed, third synchronized update information is obtained, In, third synchronized update information includes at least: the engineering mark and device data for the engineering equipment information for needing to delete.
Specifically, to having occurred that the engineering equipment information of update parses, when the content of parsing first character section When for delete operation, according to the operation of memory database and storing data library, it is classified as deletion to document and to field It deletes.
When the content for parsing first character section is to delete document function, some document, such as table are deleted according to unique identification Shown in 11.
Table 11
remove project 3
Deletion engineering is identified as 3 all information by the operation.
When the content for parsing first character section is to delete field operations, list what needs were deleted in detailed operational character string Field name, as shown in table 12.
Table 12
unset project 3 Engineering name MAC Address Module type Positioning saves
The operation will delete the engineering name of engineering 3, MAC Address, module type, the information such as positioning province.
As a kind of optional embodiment, still using redis storing data library as memory database for be illustrated, it is false If the engineering equipment information for deleting document is (remove project 3), parsing remove field first determines that this engineering is set Standby information is to delete document function, and the record for needing to delete engineering 3 is then determined according to (project 3).Assuming that deleting field Engineering equipment information be (the 3 MAC module address unset project), parse unset field first and determine this engineering Facility information is to delete field operations, and the field needed to delete in engineering 3, last basis are then determined according to (project 3) (MAC, module's address) is deleted to need to delete mac and module's address the two fields.
Optionally, as shown in figure 12, the second synchronization module 805 includes:
Third writing module 1101, for forming writing commands according to parsing result;Writing commands are synchronized to storage number According to library, so that storing data library is executed according to writing commands updates operation.
Specifically, parsing result composition is write after having occurred that the facility information of update according to the parsing of more new command Enter order, storing data library is according to writing commands more new database.
As a kind of optional embodiment, using redis database as memory database, mongodb database is used as and deposits It is illustrated for storage database, it is assumed that the result after parsing is (the 3 Gree Electric Appliances Guangdong Province, Zhuhai City insert project 2016+07+01+13:32:18), the result after above-mentioned parsing is formed into writing commands, mongodb database executes insertion behaviour Make, (3 Zhuhai City Gree Electric Appliances Guangdong Province 2016+07+01+13:32:18 of project) is inserted into mongodb database table In corresponding column, the update of mongodb database is completed.
Optionally, after according to parsing result synchronized update storing data library, determine whether storing data library is updated to The method of function includes: in the case where writing commands instruction needs to increase engineering equipment information, if the parameter value returned is non- Negative, it is determined that successfully increase engineering equipment information in storing data library;Need to modify engineering equipment letter in writing commands instruction In the case where breath, if the parameter value returned is nonnegative number, it is determined that successfully modify engineering equipment information in storing data library;? In the case that writing commands instruction needs to delete engineering equipment information, if the parameter value returned is nonnegative number, it is determined that storage Engineering equipment information is successfully deleted in database;Wherein, in the case where any one parameter value nonnegative number, storing data is determined Whether library updates failure.
As a kind of optional embodiment, still using redis storing data library as memory database for be illustrated, it is right After order in redis queue is parsed, the writing commands of mongodb database are formed, update mongodb.For difference Operation, if connection mongodb it is normal, execute order after can return to different operating result: WriteResult:
In the case where writing commands instruction needs to increase engineering equipment information, Insert instruction is executed, is returned NInserted parameter, if nInserted >=0, judge that increase operates successfully;
In the case where writing commands instruction needs to modify engineering equipment information, IUpsert instruction is executed, is returned NMatched parameter, if nMatched >=0, judge that modification operates successfully;
In the case where writing commands instruction needs to delete engineering equipment information, Remove instruction is executed, is returned NRemoved parameter, if nRemoved >=0, judge to delete document function success;
In the case where writing commands instruction needs to delete engineering equipment information, Unset instruction is executed, nMatched is returned Parameter, if nMatched >=0, judge to delete field operations success.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
In the above embodiment of the invention, it all emphasizes particularly on different fields to the description of each embodiment, does not have in some embodiment The part of detailed description, reference can be made to the related descriptions of other embodiments.
In several embodiments provided herein, it should be understood that disclosed technology contents can pass through others Mode is realized.Wherein, the apparatus embodiments described above are merely exemplary, such as the division of unit, can be one kind Logical function partition, there may be another division manner in actual implementation, such as multiple units or components can combine or can To be integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed is mutual Coupling, direct-coupling or communication connection can be through some interfaces, the indirect coupling or communication connection of unit or module, It can be electrical or other forms.
Unit may or may not be physically separated as illustrated by the separation member, shown as a unit Component may or may not be physical unit, it can and it is in one place, or may be distributed over multiple units On.It can some or all of the units may be selected to achieve the purpose of the solution of this embodiment according to the actual needs.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list Member both can take the form of hardware realization, can also realize in the form of software functional units.
It, can if integrated unit is realized in the form of SFU software functional unit and when sold or used as an independent product To be stored in a computer readable storage medium.Based on this understanding, technical solution of the present invention substantially or Say that all or part of the part that contributes to existing technology or the technical solution can embody in the form of software products Out, which is stored in a storage medium, including some instructions are used so that a computer equipment (can be personal computer, server or network equipment etc.) executes all or part of step of each embodiment method of the present invention Suddenly.And storage medium above-mentioned includes: USB flash disk, read-only memory (ROM, Read-Only Memory), random access memory The various media that can store program code such as (RAM, Random Access Memory), mobile hard disk, magnetic or disk.
The above is only the preferred embodiment of the present invention, it is noted that those skilled in the art are come It says, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications also should be regarded as Protection scope of the present invention.

Claims (12)

1. a kind of method of synchronous engineering data characterized by comprising
In the case where starting synchronous engineering facility information, at least one engineering equipment information is read from memory database, In, store at least one engineering equipment information in the memory database in a manner of key-value pair;
By all engineering equipment synchronizing informations in the memory database to storing data library, and/or, by the internal storage data The engineering equipment information real-time synchronization updated in library is to the storing data library, wherein is stored in the memory database In at least one engineering equipment information store as an engineering record to the storing data library;
Before starting synchronous engineering facility information, which comprises in real time or timing generates multiple engineerings mark, and by institute Multiple engineering marks are stated to be sequentially written in the memory queue being pre-created;In the equipment for receiving the upload of at least one engineering equipment After data, engineering mark is successively read from the memory queue;Each device data is successively successively read with described Engineering mark be associated, and device data is inserted into corresponding with associated engineering mark queue position, obtain described in extremely Few engineering equipment information, wherein the engineering equipment information includes at least: the device data and with the number of devices It is identified according to associated unique engineering;It saves at least one engineering equipment information and obtains the memory database.
2. the method according to claim 1, wherein by all engineering equipment information in the memory database It is synchronized to storing data library, comprising:
The memory database is traversed based on engineering keyword, obtains all keywords with the engineering Keywords matching;
Corresponding key assignments is determined according to the keyword that matching obtains, all engineering equipment information stored, wherein the pass Key word identifies associated device data with the engineering for characterizing for characterizing engineering mark, the key assignments;
By all engineering equipment synchronizing informations to the storing data library.
3. according to the method described in claim 2, it is characterized in that, the engineering equipment information includes at least one following: work Journey device name, positioning province, MAC Address, module type and time.
4. the method according to claim 1, wherein the engineering equipment that will be updated in the memory database Information real-time synchronization is to the storing data library, comprising:
If detecting that the engineering equipment information in the memory database updates, the engineering equipment updated is read More new command corresponding to information, the more new command include at least one following: increasing instruction, deletion instruction and modification and refer to It enables;
The engineering equipment information updated according to different more new command parsings;
According to storing data library described in parsing result synchronized update.
5. according to the method described in claim 4, it is characterized in that, reading corresponding to the engineering equipment information that is updated Update operation before, the method also includes:
Receive the more new command that server is updated the memory database;
Engineering equipment information corresponding in the memory queue of the memory database is updated using the more new command, and The more new command write-in is updated into queue;
Wherein, if synchronization program, which detects in the update queue, has the more new command, it is determined that the internal storage data Engineering equipment information in library is updated.
6. according to the method described in claim 5, it is characterized in that, being updated according to different more new command parsings Engineering equipment information include:
The first character section of the more new command is parsed, if the content of the first character section is insertion operation, it is determined that institute More new command is stated as increase instruction;
Other fields for parsing the more new command, obtain the first synchronized update information, wherein the first synchronized update information It includes at least: the engineering mark and device data of newly-increased engineering equipment information.
7. according to the method described in claim 5, it is characterized in that, being updated according to different more new command parsings Engineering equipment information include:
The first character section of the more new command is parsed, if the content of the first character section is modification operation, it is determined that institute More new command is stated as modification instruction;
Other fields for parsing the more new command, obtain the second synchronized update information, wherein the second synchronized update information It includes at least: the engineering mark and device data of modified engineering equipment information.
8. according to the method described in claim 5, it is characterized in that, being updated according to different more new command parsings Engineering equipment information include:
The first character section of the more new command is parsed, if the content of the first character section is delete operation, it is determined that institute More new command is stated as deletion instruction;
Other fields for parsing the more new command, obtain third synchronized update information, wherein the third synchronized update information It includes at least: the engineering mark and device data for the engineering equipment information for needing to delete.
9. according to the method described in claim 4, it is characterized in that, the storing data library according to parsing result synchronized update, Include:
Writing commands are formed according to parsing result;
By said write command synchronization to the storing data library, so that the storing data library is executed according to said write order Update operation.
10. according to the method described in claim 9, it is characterized in that, in the storing data according to parsing result synchronized update After library, which comprises determine whether the storing data library is updated successfully, step includes:
In the case where said write order instruction needs to increase engineering equipment information, if the parameter value returned is nonnegative number, It then determines in the storing data library and successfully increases engineering equipment information;
In the case where said write order instruction needs to modify engineering equipment information, if the parameter value returned is nonnegative number, It then determines in the storing data library and successfully modifies engineering equipment information;
In the case where said write order instruction needs to delete engineering equipment information, if the parameter value returned is nonnegative number, It then determines in the storing data library and successfully deletes engineering equipment information;
Wherein, in the case where any one parameter value nonnegative number, determine whether the storing data library updates failure.
11. a kind of system of synchronous engineering data characterized by comprising
Memory, for storing the real-time update data of engineering equipment information;
Real-time update equipment for obtaining the real-time update data of the memory, and parses the real-time update data, The operational order after parsing is obtained, and updates storage the engineering equipment information in database according to the operational order;
Start more new equipment, all engineering equipment information in the queue for obtaining memory database, and by the engineering Device information update is into the storing data library;
Before starting synchronous engineering facility information, the system is also used in real time or timing generates multiple engineering marks, and will The multiple engineering mark is sequentially written in the memory queue being pre-created;Receiving setting at least one engineering equipment upload After standby data, engineering mark is successively read from the memory queue;Each device data is successively successively read with described To engineering mark be associated, and device data is inserted into corresponding with associated engineering mark queue position, obtained at least One engineering equipment information, wherein the engineering equipment information includes at least: the device data and with the device data Associated unique engineering mark;It saves at least one engineering equipment information and obtains the memory database.
12. a kind of device of synchronous engineering data characterized by comprising
Read module, for reading at least one work from memory database in the case where starting synchronous engineering facility information Journey facility information, wherein store at least one engineering equipment information in the memory database in a manner of key-value pair;
Update module, for by all engineering equipment synchronizing informations in the memory database to storing data library, and/or, By the engineering equipment information real-time synchronization updated in the memory database to the storing data library, wherein be stored in At least one engineering equipment information in the memory database is stored as an engineering record to the storing data Library;
Before starting synchronous engineering facility information, described device further include: the first writing module, for generating in real time or periodically Multiple engineering marks, and the multiple engineering mark is sequentially written in the memory queue being pre-created;First read module is used In after the device data for receiving the upload of at least one engineering equipment, engineering mark is successively read from the memory queue Know;First matching module, for each device data to be successively associated with the engineering mark being successively read, and will Device data is inserted into queue position corresponding with associated engineering mark, obtains at least one engineering equipment information, wherein The engineering equipment information includes at least:
It the device data and is identified with the associated unique engineering of the device data;First memory module, for saving It states at least one engineering equipment information and obtains the memory database.
CN201610658456.6A 2016-08-11 2016-08-11 The mthods, systems and devices of synchronous engineering data Active CN106294769B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610658456.6A CN106294769B (en) 2016-08-11 2016-08-11 The mthods, systems and devices of synchronous engineering data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610658456.6A CN106294769B (en) 2016-08-11 2016-08-11 The mthods, systems and devices of synchronous engineering data

Publications (2)

Publication Number Publication Date
CN106294769A CN106294769A (en) 2017-01-04
CN106294769B true CN106294769B (en) 2019-08-27

Family

ID=57668929

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610658456.6A Active CN106294769B (en) 2016-08-11 2016-08-11 The mthods, systems and devices of synchronous engineering data

Country Status (1)

Country Link
CN (1) CN106294769B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109614442B (en) * 2018-11-02 2020-12-25 东软集团股份有限公司 Data table maintenance method and device for data synchronization, storage medium and electronic equipment
CN109828994A (en) * 2018-12-05 2019-05-31 深圳市双合电气股份有限公司 A kind of data managing method and system of government's energy management platform
CN110597910A (en) * 2019-09-12 2019-12-20 聚好看科技股份有限公司 Remote data synchronization method, device and system
CN111984663B (en) * 2020-08-21 2024-03-12 西安寰宇卫星测控与数据应用有限公司 REDIS database updating method, REDIS database updating device, REDIS database updating computer equipment and REDIS database storage medium
CN113064913A (en) * 2021-03-26 2021-07-02 北京深思数盾科技股份有限公司 Interactive statement processing method, electronic device and computer-readable storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104778225B (en) * 2015-03-27 2017-12-12 浙江大学 A kind of method of synchrodata in more storage systems of unstructured data
CN105262831B (en) * 2015-10-30 2019-02-22 北京奇艺世纪科技有限公司 The method, apparatus and synchronization system of synchrodata between a kind of storage system
CN105589959A (en) * 2015-12-22 2016-05-18 北京京东尚科信息技术有限公司 Form processing method and form processing system

Also Published As

Publication number Publication date
CN106294769A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
CN106294769B (en) The mthods, systems and devices of synchronous engineering data
CN105243067B (en) A kind of method and device for realizing real-time incremental synchrodata
CN108536752B (en) Data synchronization method, device and equipment
CN109189852B (en) Data synchronization method and device for data synchronization
CN106933703B (en) Database data backup method and device and electronic equipment
CN103916482A (en) Data synchronous transmission method based on sqlite
US11481440B2 (en) System and method for processing metadata to determine an object sequence
CN106407360B (en) Data processing method and device
US20180203829A1 (en) Automatic updated document prompt method
US20170031948A1 (en) File synchronization method, server, and terminal
CN104679847B (en) A kind of method and apparatus constructing online real-time update magnanimity audio-frequency fingerprint library
CN103164525B (en) WEB application dissemination method and device
CN102750629B (en) Schedule association method and device
CN103034735A (en) Big data distributed file export method
CN106709066B (en) Data synchronization method and device
CN106874281A (en) Realize the method and apparatus that data base read-write is separate
CN105760380A (en) Database query method, device and system
US20090132607A1 (en) Techniques for log file processing
CN107870982B (en) Data processing method, system and computer readable storage medium
CN106250476B (en) Method, device and system for updating and synchronizing white list
CN113672692B (en) Data processing method, data processing device, computer equipment and storage medium
CN105760485A (en) Financial data extraction method and system
CN104463460B (en) Processing method and processing device for the waiting information that network data is launched
CN109101368A (en) A kind of data processing method and device
CN106569986B (en) Character string replacing method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant