Movatterモバイル変換


[0]ホーム

URL:


CN108173891A - The method and device of data synchronization is realized based on broadcast mechanism - Google Patents

The method and device of data synchronization is realized based on broadcast mechanism
Download PDF

Info

Publication number
CN108173891A
CN108173891ACN201611114939.6ACN201611114939ACN108173891ACN 108173891 ACN108173891 ACN 108173891ACN 201611114939 ACN201611114939 ACN 201611114939ACN 108173891 ACN108173891 ACN 108173891A
Authority
CN
China
Prior art keywords
data
files
blocks
file
data file
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.)
Pending
Application number
CN201611114939.6A
Other languages
Chinese (zh)
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co LtdfiledCriticalBeijing Jingdong Century Trading Co Ltd
Priority to CN201611114939.6ApriorityCriticalpatent/CN108173891A/en
Publication of CN108173891ApublicationCriticalpatent/CN108173891A/en
Pendinglegal-statusCriticalCurrent

Links

Classifications

Landscapes

Abstract

The present invention provides a kind of method and device that data synchronization is realized based on broadcast mechanism, and this method includes:Obtain data file to be synchronized;Compression data file;Compressed data file is averagely divided into multiple blocks of files, and the blocks of files that segmentation is obtained is mapped in corresponding data structure, each node of data structure corresponds to a blocks of files;Blocks of files is broadcasted in the form of data-message to destination node corresponding with the type of service of data file, wherein, destination node according to the sequence of data structure interior joint by the file merged block of reception, and decompress merge after blocks of files, so as to obtain data file.The present invention can be realized effectively automatically carries out Efficient Compression by data to be synchronized, and piecemeal processing is carried out by Distributed Application, then block data is distributed to multiple destination nodes using broadcast, finally merge and decompress in destination node, the final synchronization for realizing data file ensure that the performance of data synchronization and the reliability of data safety.

Description

The method and device of data synchronization is realized based on broadcast mechanism
Technical field
The present invention relates to computer network and computer software fields, and in particular to one kind realizes data based on broadcast mechanismSynchronous method and device.
Background technology
With the arrival of big data information age, the data of any industry are all to be increased in the form of rising suddenly and sharply, and enterpriseEach operation system between data synchronize and each subservice system and core business system between the synchronous demand of dataIncreasingly highlight.
Big data synchronization scheme is generally comprised at present:
(1) data file of data source is exported;
(2) data file of data source is copied on destination node;
(3) data file is imported into target data source on the target node.
However, there is also following shortcomings for the above-mentioned prior art:
(1) program only supports one-to-one operation, can not the data file of data source be synchronized to multiple target data sourcesIn;
(2) it easily malfunctions in operating process, once error will then lead to loss of data, mistake;
(3) if the data volume of data source is very big, the resources such as a large amount of CUP, memory, bandwidth will be consumed.
Invention content
In view of this, the purpose of the present invention is to provide a kind of methods and dress that data synchronization is realized based on broadcast mechanismIt puts, to solve drawbacks described above in the prior art.
The technical scheme is that providing a kind of method that data synchronization is realized based on broadcast mechanism, this method includes:
Obtain data file to be synchronized;
Compress the data file;
The compressed data file is averagely divided into multiple blocks of files, and the blocks of files that segmentation is obtained is mapped toIn corresponding data structure, each node of the data structure corresponds to a blocks of files;
The blocks of files is broadcasted in the form of data-message to target corresponding with the type of service of the data fileNode, wherein, the destination node, by the file merged block of reception, and is solved according to the sequence of the data structure interior jointThe blocks of files after compression merging, so as to obtain the data file.
Optionally, the data structure includes but not limited to:Set, chained list, storehouse.
Optionally, during the blocks of files is mapped to the corresponding chained list, according to default naming rule pairThe blocks of files name, the storage format of the chained list is key-value types.
Optionally, this method further includes:During the file merged block that will be received generates the data file,The blocks of files is merged and decompressed according to the default naming rule, generates the data file.
The present invention also provides a kind of device that data synchronization is realized based on broadcast mechanism, described device includes:
Data acquisition module, for obtaining data file to be synchronized;
Data compressing module, for compressing the data file;
Data segmentation module, for the compressed data file to be averagely divided into multiple blocks of files, and will segmentationObtained blocks of files is mapped in corresponding data structure, and each node of the data structure corresponds to a blocks of files;
Data simultaneous module, for being broadcasted the blocks of files in the form of data-message to the industry with the data fileThe corresponding destination node of service type, wherein, the destination node is according to the sequence of the data structure interior joint by the institute of receptionFile merged block is stated, and decompresses the blocks of files after merging, so as to obtain the data file.
Optionally, the data structure includes but not limited to:Set, chained list, storehouse.
Optionally, the data segmentation module is additionally operable to:In the mistake that the blocks of files is mapped to the corresponding chained listCheng Zhong names the blocks of files according to default naming rule, and the storage format of the chained list is key-value types.
Optionally, the data simultaneous module is additionally operable to:The data text is generated in the file merged block that will be receivedDuring part, the blocks of files is merged and decompressed according to the default naming rule, generates the data file.
By the method and device provided by the invention that data synchronization is realized based on broadcast mechanism, can effectively realize automaticallyData to be synchronized are subjected to Efficient Compression, and carry out piecemeal processing by Distributed Application, then use broadcast by block countAccording to multiple destination nodes are distributed to, finally merge and decompress in destination node, the final synchronization for realizing data file ensuresThe performance and the reliability of data safety that data synchronize.
Description of the drawings
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodimentAttached drawing is briefly described, it should be apparent that, the accompanying drawings in the following description is only some embodiments of the present invention, forFor those of ordinary skill in the art, without creative efforts, other are can also be obtained according to these attached drawingsAttached drawing.In the accompanying drawings:
Fig. 1 is the method flow schematic diagram that data synchronization is realized based on broadcast mechanism of one embodiment of the invention;
Fig. 2 is the schematic diagram of the device that data synchronization is realized based on broadcast mechanism of one embodiment of the invention.
Specific embodiment
Purpose, technical scheme and advantage to make the embodiment of the present invention are more clearly understood, below in conjunction with the accompanying drawings to this hairBright embodiment is described in further details.Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but simultaneouslyIt is not as a limitation of the invention.
Art technology technical staff knows, embodiments of the present invention can be implemented as a kind of system, device, equipment,Method or computer program product.Therefore, the disclosure can be with specific implementation is as follows, i.e.,:It is complete hardware, complete softThe form that part (including firmware, resident software, microcode etc.) or hardware and software combine.
Herein, it is to be understood that in involved term:
NDE:It is a kind of data compression algorithm, and is lossless compression, the program of realization is thread-safe.
Hadoop:Hadoop is a distributed system architecture developed by Apache funds club.User can be withIn the case where not knowing about distributed low-level details, distributed program is developed.The power of cluster is made full use of to carry out high-speed computationAnd storage.
NoSQL databases:Refer to the database of non-relational.
SQL database:SQL is the operation commands set for aiming at database and establishing, and is a kind of multiple functional database languageSpeech.
Illustrative methods
The method that data synchronize, which carries out, to be realized based on broadcast mechanism to exemplary embodiment of the invention below with reference to Fig. 1It introduces.This method includes:
Step S101:Obtain data file to be synchronized;
Step S102:Compress the data file;
Step S103:The compressed data file is averagely divided into multiple blocks of files, and will divide obtained textPart block is mapped in corresponding data structure, and each node of the data structure corresponds to a blocks of files;
Step S104:The blocks of files is broadcasted in the form of data-message to the type of service pair with the data fileThe destination node answered, wherein, the destination node is according to the sequence of the data structure interior joint by the blocks of files of receptionMerge, and decompress the blocks of files after merging, so as to obtain the data file.
Optionally, the data structure includes but not limited to:Set, chained list, storehouse.
Optionally, during the blocks of files is mapped to the corresponding chained list, according to default naming rule pairThe blocks of files name, the storage format of the chained list is key-value types.
Optionally, this method further includes:During the file merged block that will be received generates the data file,The blocks of files is merged and decompressed according to the default naming rule, generates the data file.
Embodiment
The present invention is specifically described with reference to a specific embodiment, however, it should be noted that the specific implementationExample merely to preferably description the present invention, do not constitute improper limitations of the present invention.
First, obtaining needs synchronous data and is converted to file.
In an embodiment of the present invention, it obtains data file to be synchronized and includes but not limited to following form, SQLserverDatabase is obtained using BCP orders, and hadoop is obtained using hadoopfs orders, and MySQL database uses mysqldump ordersIt obtains, MongDB is obtained using mongoexport orders.Since the above method can know those skilled in the art easilyDawn, therefore be not described here in detail.
Secondly, the data file is compressed.
Specifically, data compression is carried out to the data file using data compression algorithm.In an embodiment of the present invention,NDE compression ratios are adjusted according to the size of data file, so that the process of data compression is simple, decompression speed and consumption memory reachTo optimal value.
Then, the compressed data file is averagely divided into multiple blocks of files, and obtained blocks of files will be dividedIt is mapped in chained list, each node of chained list corresponds to a blocks of files.
It is described in detail below in the method that data structure divides data as chained list.
First, average segmentation is carried out to the data file according to the preconfigured number of nodes of data file.
Then, each node of chained list is traversed, and the blocks of files after the data file segmentation is mapped on chained list.
Wherein, the storage format of each blocks of files is in chained list:(KEY:Node identification, VALUE:Divided fileBlock).
Meanwhile the naming rule of those blocks of files is changed by segmentation sequence:Old file name _ block index _ segmentation file is totalNumber.
Finally, the blocks of files is broadcasted in the form of data-message to corresponding with the type of service of the data fileDestination node, wherein, the destination node, by the file merged block of reception, and is solved according to the sequence of the chained list interior jointThe blocks of files after compression merging, so as to obtain the data file.
First, by traversing the blocks of files that each node stores on chained list, each blocks of files is passed through into the shape of MQ messageFormula is sent to broadcasting center.
Secondly, it after broadcasting center receives All Files block, searches and subscribes to node, and will be corresponding with the type of service of subscriptionBlocks of files be issued to a certain subscription node of target data source.
Then, after which receives All Files block, the naming rule of these blocks of files is parsed, judges whether to receiveTo all files block of some data source.When all files block is received, merge these blocks of files by the sequence of block indexGenerate the data file.
Finally, the data file of merging is decompressed, and is imported into target data source according to different source data types.
In one embodiment of the invention, the mode for importeding into target data source includes but not limited to following form:SQLserverData source is imported using BCP orders, and hadoop is imported using hadoopfs orders, and MySQL database is ordered using mysqlimportIt enables and importing, mongdb is imported using mongoimport orders etc..
The present invention also provides a kind of device 2 that data synchronization is realized based on broadcast mechanism, which includes:
Data acquisition module 21, for obtaining data file to be synchronized;
Data compressing module 22, for compressing the data file;
Data segmentation module 23 for the compressed data file to be averagely divided into multiple blocks of files, and will divideThe blocks of files cut is mapped in corresponding data structure, and each node of the data structure corresponds to a blocks of files;
Data simultaneous module 24, for by the blocks of files broadcasted in the form of data-message to the data fileThe corresponding destination node of type of service, wherein, the destination node is according to the sequence of the data structure interior joint by receptionThe file merged block, and the blocks of files after merging is decompressed, so as to obtain the data file.
Optionally, the data structure includes but not limited to:Set, chained list, storehouse.
Optionally, the data segmentation module 23 is additionally operable to:The blocks of files is being mapped to the corresponding chained listIn the process, the blocks of files is named according to default naming rule, the storage format of the chained list is key-value types.
Optionally, the data simultaneous module 24 is additionally operable to:The data are generated in the file merged block that will be receivedDuring file, the blocks of files is merged and decompressed according to the default naming rule, generates the data file.
Realize that the device that data synchronize is the corresponding device of the above method based on broadcast mechanism due to provided by the invention, thereforeDetails are not described herein.
By the method and device provided by the invention that data synchronization is realized based on broadcast mechanism, can effectively realize automaticallyData to be synchronized are subjected to Efficient Compression, and carry out piecemeal processing by Distributed Application, then use broadcast by block countAccording to multiple destination nodes are distributed to, finally merge and decompress in destination node, the final synchronization for realizing data file ensuresThe performance and the reliability of data safety that data synchronize.
In addition, although the operation of the method for the present invention is described with particular order in the accompanying drawings, this do not require that orImply that the operation having to carry out shown in whole could realize desired result.Additionally or alternatively, it is convenient to omit certain steps,Multiple steps are merged into a step execution and/or a step is decomposed into execution of multiple steps.
Particular embodiments described above has carried out the purpose of the present invention, technical solution and advantageous effect further in detailDescribe in detail it is bright, it should be understood that the above is only a specific embodiment of the present invention, the guarantor being not intended to limit the present inventionRange is protected, all within the spirits and principles of the present invention, any modification, equivalent substitution, improvement and etc. done should be included in thisWithin the protection domain of invention.

Claims (8)

CN201611114939.6A2016-12-072016-12-07The method and device of data synchronization is realized based on broadcast mechanismPendingCN108173891A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201611114939.6ACN108173891A (en)2016-12-072016-12-07The method and device of data synchronization is realized based on broadcast mechanism

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201611114939.6ACN108173891A (en)2016-12-072016-12-07The method and device of data synchronization is realized based on broadcast mechanism

Publications (1)

Publication NumberPublication Date
CN108173891Atrue CN108173891A (en)2018-06-15

Family

ID=62526465

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201611114939.6APendingCN108173891A (en)2016-12-072016-12-07The method and device of data synchronization is realized based on broadcast mechanism

Country Status (1)

CountryLink
CN (1)CN108173891A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN109710586A (en)*2018-12-282019-05-03北京谷数科技有限公司A kind of clustered node configuration file synchronous method and device

Citations (7)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US7075990B2 (en)*2001-08-282006-07-11Sbc Properties, L.P.Method and system to improve the transport of compressed video data in real time
CN101729522A (en)*2008-10-312010-06-09中卫星空移动多媒体网络有限公司File transfer method based on ground mobile multimedia broadcasting system
US20110161666A1 (en)*2009-12-292011-06-30Cleversafe, Inc.Digital content retrieval utilizing dispersed storage
CN102201924A (en)*2011-07-072011-09-28无锡智感星际科技有限公司Method for distributing file based on RDS unidirectional broadcast channel
CN102355314A (en)*2011-06-292012-02-15哈尔滨工业大学深圳研究生院Broadcast information transmission method, server and terminal
CN103532921A (en)*2012-07-062014-01-22中国移动通信集团公司File sending method, file receiving method, server and terminal
CN103873517A (en)*2012-12-142014-06-18中兴通讯股份有限公司Method, device and system for data synchronization

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US7075990B2 (en)*2001-08-282006-07-11Sbc Properties, L.P.Method and system to improve the transport of compressed video data in real time
CN101729522A (en)*2008-10-312010-06-09中卫星空移动多媒体网络有限公司File transfer method based on ground mobile multimedia broadcasting system
US20110161666A1 (en)*2009-12-292011-06-30Cleversafe, Inc.Digital content retrieval utilizing dispersed storage
CN102355314A (en)*2011-06-292012-02-15哈尔滨工业大学深圳研究生院Broadcast information transmission method, server and terminal
CN102201924A (en)*2011-07-072011-09-28无锡智感星际科技有限公司Method for distributing file based on RDS unidirectional broadcast channel
CN103532921A (en)*2012-07-062014-01-22中国移动通信集团公司File sending method, file receiving method, server and terminal
CN103873517A (en)*2012-12-142014-06-18中兴通讯股份有限公司Method, device and system for data synchronization

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN109710586A (en)*2018-12-282019-05-03北京谷数科技有限公司A kind of clustered node configuration file synchronous method and device
CN109710586B (en)*2018-12-282019-09-13北京谷数科技有限公司A kind of clustered node configuration file synchronous method and device

Similar Documents

PublicationPublication DateTitle
CN107622096B (en)Asynchronous multi-party data interaction method based on block chain system and storage medium
CN109522330B (en)Cloud platform data processing method, device, equipment and medium based on block chain
CN103853714B (en)A kind of data processing method and device
CN113760948A (en) Method and device for querying data
CN110019211A (en)The methods, devices and systems of association index
CN108733317B (en)Data storage method and device
CN105530272A (en)Method and device for application data synchronization
CN111814020A (en) Data acquisition method and device
CN103716056B (en)Data compression method, uncompressing data and equipment
US12086107B2 (en)File sharing method, apparatus, and system
CN114443750A (en) Resource data storage and query method and device
CN113641706A (en)Data query method and device
CN114443940A (en) A message subscription method, device and device
CN116108042A (en)Data processing method, device, electronic equipment, storage medium and program product
CN111241189A (en)Method and device for synchronizing data
CN109753424B (en)AB test method and device
CN114625716B (en) Database sub-library and sub-table expansion method, device and computer-readable storage medium
CN114329369B (en)Rights management method and device, electronic equipment and computer readable medium
CN110609766A (en) A KV data storage method and device based on Redis protocol
CN108173891A (en)The method and device of data synchronization is realized based on broadcast mechanism
CN115794876A (en)Fragment processing method, device, equipment and storage medium for service data packet
CN108491499A (en)Collecting method, data acquisition platform, client and service server
CN110705935B (en)Logistics document processing method and device
CN116723239B (en)Block chain data transmission method and device, electronic equipment and readable medium
CN118152351A (en)Transaction data processing method based on blockchain, node and blockchain

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
RJ01Rejection of invention patent application after publication
RJ01Rejection of invention patent application after publication

Application publication date:20180615


[8]ページ先頭

©2009-2025 Movatter.jp