CN107948316A - A kind of file synchronisation method, device and equipment - Google Patents

A kind of file synchronisation method, device and equipment Download PDF

Info

Publication number
CN107948316A
CN107948316A CN201711422487.2A CN201711422487A CN107948316A CN 107948316 A CN107948316 A CN 107948316A CN 201711422487 A CN201711422487 A CN 201711422487A CN 107948316 A CN107948316 A CN 107948316A
Authority
CN
China
Prior art keywords
file
command messages
messages queue
queue
updated
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.)
Granted
Application number
CN201711422487.2A
Other languages
Chinese (zh)
Other versions
CN107948316B (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.)
Beijing Sohu New Media Information Technology Co Ltd
Original Assignee
Beijing Sohu New Media 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 Sohu New Media Information Technology Co Ltd filed Critical Beijing Sohu New Media Information Technology Co Ltd
Priority to CN201711422487.2A priority Critical patent/CN107948316B/en
Publication of CN107948316A publication Critical patent/CN107948316A/en
Application granted granted Critical
Publication of CN107948316B publication Critical patent/CN107948316B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Abstract

The present invention provides a kind of file synchronisation method, device and equipment, the local command message queue that receiving device can locally be preserved according to the command messages queue and the receiving device in the present invention, determine difference command messages queue, and during the other command messages queue of any sort sub-district in the difference command messages queue, it is updated according to the other command messages queue of the sub-district.It is easy to operate compared to data are carried out with cutting, and for the process for calculating check code and being compared due to only needing the content in the command messages queue and local command message queue in the present invention, it will not take compared with multiple resource.

Description

A kind of file synchronisation method, device and equipment
Technical field
The present invention relates to file synchronization field, more specifically, being related to a kind of file synchronisation method, device and equipment.
Background technology
Nowadays, service is provided to the user using content distribution network CDN service device.Wherein, in every CDN server File is to realize the file synchronization in server into CDN server.In order to ensure service quality, it is necessary in real time will service The file synchronization that newly-increased file in device is either changed is into CDN server.
Wherein, synchronous process carries out cutting for each CDN server by local file has been stored in, and obtains size and consolidates Fixed multiple data blocks, calculate the check code of each data block, the check code of each data block are collected to obtain check code Set.
Hereafter, server carries out cutting by local file has been saved in, and obtains the data obtained with CDN server cutting The identical multiple data blocks of block size, calculate the check code for each data block that cutting obtains, then by the check code and verification Code collection is closed and is compared, if the check code is present in check code set, which is not synchronized in CDN server. If the check code is not existed in check code set, which is synchronized in CDN server.
Above-mentioned synchronous method needs the process by data cutting, calculating check code and twin check code, complicated, Take compared with multiple resource, aggravate server work load.
The content of the invention
In view of this, the present invention provides a kind of file synchronisation method, device and equipment, to solve synchronization side in the prior art Method it is complicated and take compared with multiple resource the problem of.
In order to solve the above technical problems, present invention employs following technical solution:
A kind of file synchronisation method, applied to receiving device, including:
After being communicated to connect with sending device, the command messages queue in the sending device is obtained;
The local command message queue locally preserved according to the command messages queue and the receiving device, determines area Other command messages queue;Wherein, the difference command messages queue is including the other command messages queue of multiclass sub-district and each described The file attribute information of at least one file to be updated is preserved in the other command messages queue of sub-district;
Wherein, in the other command messages queue of any sort sub-district in obtaining the difference command messages queue, according to institute The other command messages queue of sub-district is stated to be updated the file in the receiving device.
Preferably, the local command message team locally preserved according to the command messages queue and the receiving device Row, determine difference command messages queue, including:
Obtain the different statistical dimensions in the local command message queue;
For each statistical dimension, preserved successively described in the local command message queue under statistical dimension Content and the command messages queue described in the distinctive points of content that preserve under statistical dimension, and according to the area compared It is other, generate the other command messages queue of the corresponding sub-district of the statistical dimension;
According to the other command messages queue of all sub-districts of generation, the difference command messages queue is generated.
Preferably, the file attribute information includes Document Editing instruction, file name, file storage address and file Timestamp during generation;
Correspondingly, in the other command messages queue of any sort sub-district in obtaining the difference command messages queue, according to The other command messages queue of the sub-district is updated the file in the receiving device, including:
The file attribute information of each file to be updated included according to the other command messages queue of the sub-district In file storage address, from corresponding file storage address obtain file designation be corresponding file name text to be updated Part, and file to be updated is updated according to the instruction of corresponding Document Editing.
A kind of file synchronisation method, applied to sending device, including:
When increasing the file attribute information of file to be updated in default file newly, by the file attribute of file to be updated Information carries out format conversion, obtains command messages queue, and the command messages queue is saved in memory;
Real-time preset monitored port, judges whether to receive the link order that at least one receiving device is sent;
When judging to receive the link order of at least one receiving device transmission, connect with sending described in link order Receiving unit is attached;
Start a new communication thread to communicate with being connected to the receiving device of the sending device.
Preferably, when increasing the file attribute information of file to be updated in default file newly, by file to be updated File attribute information carries out format conversion, obtains command messages queue, including:
, will using the working method of multithreading when increasing the file attribute information of file to be updated in default file newly The file attribute information of file to be updated carries out format conversion, obtains command messages queue.
A kind of file synchronizer, applied to receiving device, including:
Acquisition module, for after being communicated to connect with sending device, obtaining the command messages queue in the sending device;
Comparison module, the local command for locally being preserved according to the command messages queue and the receiving device disappear Queue is ceased, determines difference command messages queue;Wherein, the difference command messages queue includes the other command messages team of multiclass sub-district The file attribute information of at least one file to be updated is preserved in row and the other command messages queue of each sub-district;
Update module, during for the other command messages queue of any sort sub-district in the difference command messages queue, root The file in the receiving device is updated according to the sub-district other command messages queue.
Preferably, the comparison module includes:
Acquisition submodule, for obtaining the different statistical dimensions in the local command message queue;
Comparison sub-module, for for each statistical dimension, institute in the local command message queue successively The content preserved under statistical dimension and the distinctive points of the content preserved under statistical dimension described in the command messages queue are stated, and According to the distinctive points compared, the other command messages queue of the corresponding sub-district of the statistical dimension is generated;
Submodule is generated, for the other command messages queue of all sub-districts according to generation, generates the difference life Make message queue.
Preferably, the file attribute information includes Document Editing instruction, file name, file storage address and file Timestamp during generation;
Correspondingly, the update module includes:
Submodule is updated, for each file to be updated included according to the other command messages queue of the sub-district File attribute information in file storage address, from corresponding file storage address obtain file designation be corresponding filename The file to be updated claimed, and file to be updated is updated according to the instruction of corresponding Document Editing.
A kind of file synchronizer, applied to sending device, including:
Parsing module, will be to be updated for when increasing the file attribute information of file to be updated in default file newly The file attribute information of file carries out format conversion, obtains command messages queue, and in the command messages queue is saved in In depositing;
Judgment module, for real-time preset monitored port, judges whether to receive the company that at least one receiving device is sent Connect instruction;
Link block, for judging to receive the link order of at least one receiving device transmission when the judgment module When, the receiving device with sending link order is attached;
Thread starting module, after the receiving device for the link block and transmission link order is attached, Start a new communication thread to communicate with being connected to the receiving device of the sending device.
Preferably, the parsing module includes:
Analyzing sub-module, for when increasing the file attribute information of file to be updated in default file newly, use to be multi-thread The working method of journey, carries out format conversion by the file attribute information of file to be updated, obtains command messages queue.
A kind of receiving device, including:Memory and processor;
Wherein, the memory is used for storage program;
Processor is used for caller, wherein, described program is used for:
After being communicated to connect with sending device, the command messages queue in the sending device is obtained;
The local command message queue locally preserved according to the command messages queue and the receiving device, determines area Other command messages queue;Wherein, the difference command messages queue is including the other command messages queue of multiclass sub-district and each described The file attribute information of at least one file to be updated is preserved in the other command messages queue of sub-district;
Wherein, during the other command messages queue of any sort sub-district in the difference command messages queue, according to the son Difference command messages queue is updated the file in the receiving device.
A kind of sending device, including:Memory and processor;
Wherein, the memory is used for storage program;
Processor is used for caller, wherein, described program is used for:
When increasing the file attribute information of file to be updated in default file newly, by the file attribute of file to be updated Information carries out format conversion, obtains command messages queue, and the command messages queue is saved in memory;
Real-time preset monitored port, judges whether to receive the link order that at least one receiving device is sent;
When judging to receive the link order of at least one receiving device transmission, connect with sending described in link order Receiving unit is attached;
Start a new communication thread to communicate with being connected to the receiving device of the sending device.
Compared to the prior art, the invention has the advantages that:
The present invention provides a kind of file synchronisation method, device and equipment, receiving device can be according to described in the present invention The local command message queue that command messages queue and the receiving device locally preserve, determines difference command messages queue, And during the other command messages queue of any sort sub-district in the difference command messages queue, according to the other command messages of the sub-district Queue is updated.Due to only being needed in the present invention in the command messages queue and local command message queue Hold, compared to data are carried out with cutting, and calculate for check code and the process that is compared, it is easy to operate, it will not take Compared with multiple resource.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is attached drawing needed in technology description to be briefly described, it should be apparent that, drawings in the following description are only this The embodiment of invention, for those of ordinary skill in the art, without creative efforts, can also basis The attached drawing of offer obtains other attached drawings.
Fig. 1 is a kind of method flow diagram of file synchronisation method provided by the invention;
Fig. 2 is the method flow diagram of another file synchronisation method provided by the invention;
Fig. 3 is the method flow diagram of another file synchronisation method provided by the invention;
Fig. 4 is a kind of structure diagram of file synchronizer provided by the invention;
Fig. 5 is the structure diagram of another file synchronizer provided by the invention.
Embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained every other without making creative work Embodiment, belongs to the scope of protection of the invention.
An embodiment of the present invention provides a kind of file synchronisation method, applied to receiving device, wherein, receiving device is receives The equipment at end.It should be noted that receiving device and sending device communicate, and when carrying out the execution of file synchronisation method according to Rely the file syn chronizing system Csync in receiving device and sending device.
, it is necessary to be configured to the file syn chronizing system in receiving device and sending device before being communicated.Specifically Configuration process is:
By the module interface of Csync, read and parse configuration file, set the parameter of needs during Csync operations to become Amount, wherein, parametric variable includes:
The operational mode (being with client or server mode operation) of software, if it is finger daemon, user identity Identification number ID, user group ID, take the network port, time-out time, command messages queue command list maximum length, The catalogue of monitoring, the catalogue of filing, the catalogue of daily record storage and each channel for needing synchronization.
After configuration is completed, Csync, and initialization context, main thread circulation are started according to the configuration file parsed Monitor each sub-line journey whether deadlock dead lock.
Wherein, initialization context refers to the parameter parsed from configuration file being saved in memory, and starts each Sub-line journey, passes to each sub-line journey, standard of closure input and output, switch operating catalogue is extremely by the parameter preserved in memory Under "/".
Dead lock refer to two or more processes in the process of implementation, due to competitive resource or due to each other Communication and caused by a kind of phenomenon of obstruction, if without external force act on, they all will be unable to propulsion and go down.System is claimed to be in dead at this time Lock status or system generate deadlock., it is necessary to which first Dead lock state, can be normally carried out when in deadlock states File synchronization is transmitted.
With reference to Fig. 1, the file synchronisation method applied to receiving device can include:
S11, after being communicated to connect with sending device, obtain the command messages queue in the sending device;
The command messages queue in the sending device can be obtained, every the set time to be updated.
When increasing the file attribute information of file to be updated in default file newly, sending device is by file to be updated File attribute information carries out format conversion, obtains command messages queue, and the command messages queue is saved in memory;
Wherein, default file can be synchronous listing file listfile/ convert file lists switchfile.
Specifically, either changed in some when issuing new content in Content Management System cms/ system for managing video vms Rong Shi, will increase the file attribute information of a file to be updated in listfile/switchfile.Wherein, file Attribute information includes timestamp when Document Editing instruction, file name, file storage address and file generated.
Document Editing order refers to increase or changes order, and file name is the title of the file of increase or modification.Text Part storage address refers to which place this document is stored in.Timestamp during file generated refers to time during this document generation. It in order to know the generated time of file and represent this document is newest file that the purpose for setting timestamp, which is,.
In addition, the file attribute information of file to be updated is carried out format conversion by sending device, command messages team is obtained Row.Specifically refer to:
Due to that can not identify the file attribute information of file to be updated in memory, so needing to be updated The file attribute information of file carries out format conversion, the content being converted into the command messages queue that can identify.Command messages Queue can be command list message queues.
Watcher thread list_server is needed to monitor listfile/switchfile files, Neng Gou in real time During the new interpolation data of listfile/switchfile files, memory is resolved in time.
S12, the local command message queue locally preserved according to the command messages queue and the receiving device, really Surely command messages queue is distinguished;
Wherein, the difference command messages queue includes the other command messages queue of multiclass sub-district and each sub-district is other The file attribute information of at least one file to be updated is preserved in command messages queue;
In addition, in the other command messages queue of any sort sub-district in obtaining the difference command messages queue, according to institute The other command messages queue of sub-district is stated to be updated the file in the receiving device.
Specifically, command messages queue and local command message queue are compared by receiving device, difference life is obtained Make message queue.And in the other command messages queue of any sort sub-district in generating the difference command messages queue, according to The other command messages queue of the sub-district is updated the file in the receiving device.
In the present embodiment, what receiving device can locally be preserved according to the command messages queue and the receiving device Local command message queue, determines difference command messages queue, and any sort sub-district in the difference command messages queue During other command messages queue, it is updated according to the other command messages queue of the sub-district.By only needing to compare institute in the present invention The content in command messages queue and local command message queue is stated, compared to data progress cutting, and calculating check code And for the process being compared, it is easy to operate, it will not take compared with multiple resource.
Optionally, on the basis of above-described embodiment, can include with reference to Fig. 2, step S12:
Different statistical dimensions in S21, the acquisition local command message queue;
Wherein, statistical dimension can be the dimensions such as finance and economics, video, amusement.
Specifically, the content preserved in sending device and receiving device, which is in accordance with statistical dimension, carries out classification preservation. So when being updated, it can also be updated according to type.
S22, for each statistical dimension, successively described in the local command message queue under statistical dimension The distinctive points of the content preserved described in the content of preservation and the command messages queue under statistical dimension, and according to comparing to obtain Distinctive points, generate the other command messages queue of the corresponding sub-district of the statistical dimension;
Specifically, what is preserved in command messages queue is the file to be updated for needing to be updated under different statistical dimensions File attribute information.What is preserved in local command message queue is the file attribute information for the file being updated.
After statistical dimension is determined, for each statistical dimension, compare local command message queue and command messages queue In content under the statistical dimension it is whether identical.
Whether timestamp when can specifically be generated with comparison document is identical, or whether comparison document title is identical, when It is whether identical in further relatively timestamp when file name is identical.Differed when file name differs either timestamp When, it is the file that needs are updated just to illustrate this file.
The system file attribute information for the file for needing to be updated being resolved at this time in difference command messages queue Count under dimension, that is, obtain the other command messages queue of the corresponding sub-district of the statistical dimension.
S23, the other command messages queue of all sub-districts according to generation, generate the difference command messages queue.
After obtaining the other command messages queue of the corresponding sub-district of each statistical dimension, by the other command messages queue of all sub-districts Collected, you can obtain difference command messages queue.
It should be noted that when comparing to obtain the other command messages queue of sub-district, in order to ensure the other command messages team of sub-district The accuracy of content in row.Locked at this time by the way of mutual exclusion lock mutex.
Specifically, when a thread compares command messages queue under a statistical dimension and local command message queue During distinctive points, which is not allow other threads into edlin.
Optionally, on the basis of the present embodiment, when the file attribute information includes Document Editing instruction, filename Claim, file storage address and during timestamp during file generated, any sort in the difference command messages queue is obtained During the other command messages queue of sub-district, it is updated according to the other command messages queue of the sub-district, including:
The file attribute information of each file to be updated included according to the other command messages queue of the sub-district In file storage address, from corresponding file storage address obtain file designation be corresponding file name text to be updated Part, and file to be updated is updated according to the instruction of corresponding Document Editing.
Specifically, according to file storage address, file is found, when Document Editing instruction is updates, this document is replaced There is the file of identical file name in receiving device.When Document Editing instruction for it is newly-increased when, directly by this document into Row preserves.
It should be noted that after a son difference command messages queue is often determined, it is possible to enable at least one thread To carry out file renewal operation.
In addition, after the completion of file renewal, can be write in command messages queue in the file attribute information of corresponding file Timestamp when renewal is completed, is finished with ensureing that file has been successfully updated.
3rd, it can be multiple file synchronization client thread sync_ to be updated according to the other command messages queue of sub-district What client was performed at the same time.
4th, can be in corresponding local command message after the completion of receiving device is updated according to the other command messages queue of sub-district The file attribute information of the file to be updated is write in queue, and the timestamp of file renewal deadline is written to and is treated In the file attribute information of the file of renewal.
5th, when a thread has performed the more new task of oneself, receiving device can recycle the resource of the thread, so that The thread performs other tasks.
6th, after client time-out or crash dead, Csync watcher threads watchdog_server can be killed Sync_client threads, start new sync_client after discharging its resource, and again from file synchronization services device thread The synchronous new data in sync_server ends.
In the present embodiment, as soon as after son difference command messages queue is obtained, the other command messages queue of the sub-district is updated The middle file for needing to update, and then file renewal speed can be accelerated.
Optionally, it is corresponding in the file synchronisation method of receiving device with above application, in another embodiment of the present invention A kind of file synchronisation method is provided, applied to sending device.Wherein, sending device can be the equipment of server-side, such as service Device.
With reference to Fig. 3, the file synchronisation method applied to sending device can include:
S31, when increasing the file attribute information of file to be updated in default file newly, by the file of file to be updated Attribute information carries out format conversion, obtains command messages queue, and the command messages queue is saved in memory;
Wherein, the specific explanations explanation in step S31, refer to the corresponding contents in above-described embodiment, no longer superfluous herein State.
S32, judge whether to receive the link order that at least one receiving device is sent;When judging to receive at least one The link order that a receiving device is sent, performs step S33;When the company for judging not receive at least one receiving device and sending Instruction is connect, performs step S34.
Can preset monitored port in real time, judge whether to receive the link order that at least one receiving device is sent.In advance If port can be transmission control protocol TCP (Transmission ControlProtocol) port.
Specifically, TCP port can be monitored by monitoring server sync_server_listener, when there is sync_client During connection, it is considered as receiving the link order of receiving device transmission.When no sync_client connections, it is considered as not having Receive the link order of receiving device transmission.
S33, with send link order the receiving device be attached;
One S34, startup new communication thread communicate with being connected to the receiving device of the sending device.
Specifically, with sending after the receiving device of link order is attached, sending device can start one it is new File synchronization services device thread sync_server communicates with receiving device.
S35, real-time preset monitored port.
Specifically, when there are sync_client connections, just it is connected with sync_client.When no sync_client connects When connecing, preset monitored port is continued to, determines whether sync_client connections.
Optionally, on the basis of the present embodiment, when the file attribute information for increasing file to be updated in default file newly When, the file attribute information of file to be updated is subjected to format conversion, obtains command messages queue, including:
, will using the working method of multithreading when increasing the file attribute information of file to be updated in default file newly The file attribute information of file to be updated carries out format conversion, obtains command messages queue.
Specifically, might have the file attribute information of multiple files to be updated, the work of multithreading can be used at this time Make mode, while the file attribute information of multiple files to be updated is resolved in command messages queue, improve work efficiency.
In the present embodiment, the working method of multithreading can be used by the file attribute information solution of multiple files to be updated Analyse in command messages queue, improve work efficiency, and then can ensure that receiving device carries out file synchronization in time.
Optionally, on the basis of embodiment of the above application in the file synchronisation method of receiving device, of the invention is another One embodiment provides a kind of file synchronizer, applied to receiving device, with reference to Fig. 4, can include:
Acquisition module 101, for after being communicated to connect with sending device, obtaining the command messages team in the sending device Row;
Comparison module 102, for the local life locally preserved according to the command messages queue and the receiving device Message queue is made, determines difference command messages queue;Wherein, the difference command messages queue is not ordered including multiclass sub-district disappears The file attribute letter of at least one file to be updated is preserved in breath queue and the other command messages queue of each sub-district Breath;
Update module 103, for the other command messages team of any sort sub-district in the difference command messages queue is obtained During row, the file in the receiving device is updated according to the sub-district other command messages queue.
In the present embodiment, what receiving device can locally be preserved according to the command messages queue and the receiving device Local command message queue, determines difference command messages queue, and any sort sub-district in the difference command messages queue During other command messages queue, it is updated according to the other command messages queue of the sub-district.By only needing to compare institute in the present invention The content in command messages queue and local command message queue is stated, compared to data progress cutting, and calculating check code And for the process being compared, it is easy to operate, it will not take compared with multiple resource.
It should be noted that the course of work of the modules in the present embodiment, refer to corresponding in above-described embodiment Illustrate, details are not described herein.
Optionally, on the basis of embodiment of the above application in the file synchronizer of receiving device, the relatively mould Block includes:
Acquisition submodule, for obtaining the different statistical dimensions in the local command message queue;
Comparison sub-module, for for each statistical dimension, institute in the local command message queue successively The content preserved under statistical dimension and the distinctive points of the content preserved under statistical dimension described in the command messages queue are stated, and According to the distinctive points compared, the other command messages queue of the corresponding sub-district of the statistical dimension is generated;
Submodule is generated, for the other command messages queue of all sub-districts according to generation, generates the difference life Make message queue.
Further, the file attribute information includes Document Editing instruction, file name, file storage address and file Timestamp during generation;
Correspondingly, the update module includes:
Submodule is updated, for each file to be updated included according to the other command messages queue of the sub-district File attribute information in file storage address, from corresponding file storage address obtain file designation be corresponding filename The file to be updated claimed, and file to be updated is updated according to the instruction of corresponding Document Editing.
In the present embodiment, as soon as after son difference command messages queue is obtained, the other command messages queue of the sub-district is updated The middle file for needing to update, and then file renewal speed can be accelerated.
It should be noted that the course of work of the modules and submodule in the present embodiment, refer to above-described embodiment In respective description, details are not described herein.
Optionally, on the basis of embodiment of the above application in the file synchronisation method of sending device, of the invention is another A kind of file synchronizer is provided in one embodiment, applied to sending device, with reference to Fig. 5, can be included:
Parsing module 201, will be to be updated for when increasing the file attribute information of file to be updated in default file newly File file attribute information carry out format conversion, obtain command messages queue, and the command messages queue is saved in In memory;
Judgment module 202, for real-time preset monitored port, judges whether to receive what at least one receiving device was sent Link order;
Link block 203, for judging to receive the connection of at least one receiving device transmission when the judgment module During instruction, the receiving device with sending link order is attached;
Thread starting module 204, is attached for the link block with sending the receiving device of link order Afterwards, start a new communication thread to communicate with being connected to the receiving device of the sending device.
Further, the parsing module includes:
Analyzing sub-module, for when increasing the file attribute information of file to be updated in default file newly, use to be multi-thread The working method of journey, carries out format conversion by the file attribute information of file to be updated, obtains command messages queue.
In the present embodiment, the working method of multithreading can be used by the file attribute information solution of multiple files to be updated Analyse in command messages queue, improve work efficiency, and then can ensure that receiving device carries out file synchronization in time.
It should be noted that the course of work of the modules and submodule in the present embodiment, refer to above-described embodiment In respective description, details are not described herein.
Optionally, in above application on the basis of the file synchronisation method of receiving device and the embodiment of device, this hair Bright another embodiment provides a kind of receiving device, including:Memory and processor;
Wherein, the memory is used for storage program;
Processor is used for caller, wherein, described program is used for:
After being communicated to connect with sending device, the command messages queue in the sending device is obtained;
The local command message queue locally preserved according to the command messages queue and the receiving device, determines area Other command messages queue;Wherein, the difference command messages queue is including the other command messages queue of multiclass sub-district and each described The file attribute information of at least one file to be updated is preserved in the other command messages queue of sub-district;
Wherein, in the other command messages queue of any sort sub-district in obtaining the difference command messages queue, according to institute The other command messages queue of sub-district is stated to be updated the file in the receiving device.
In the present embodiment, what receiving device can locally be preserved according to the command messages queue and the receiving device Local command message queue, determines difference command messages queue, and any sort sub-district in the difference command messages queue During other command messages queue, it is updated according to the other command messages queue of the sub-district.By only needing to compare institute in the present invention The content in command messages queue and local command message queue is stated, compared to data progress cutting, and calculating check code And for the process being compared, it is easy to operate, it will not take compared with multiple resource.
Optionally, in above application on the basis of the file synchronisation method of sending device and the embodiment of device, this hair Bright another embodiment provides a kind of sending device, including:Memory and processor;
Wherein, the memory is used for storage program;
Processor is used for caller, wherein, described program is used for:
When increasing the file attribute information of file to be updated in default file newly, by the file attribute of file to be updated Information carries out format conversion, obtains command messages queue, and the command messages queue is saved in memory;
Real-time preset monitored port, judges whether to receive the link order that at least one receiving device is sent;
When judging to receive the link order of at least one receiving device transmission, connect with sending described in link order Receiving unit is attached;
Start a new communication thread to communicate with being connected to the receiving device of the sending device.
In the present embodiment, the file attribute information of multiple files to be updated can be resolved in command messages queue, And then it can ensure that receiving device carries out file synchronization in time.
The foregoing description of the disclosed embodiments, enables professional and technical personnel in the field to realize or use the present invention. A variety of modifications to these embodiments will be apparent for those skilled in the art, as defined herein General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, it is of the invention The embodiments shown herein is not intended to be limited to, and is to fit to and the principles and novel features disclosed herein phase one The most wide scope caused.

Claims (12)

  1. A kind of 1. file synchronisation method, it is characterised in that applied to receiving device, including:
    After being communicated to connect with sending device, the command messages queue in the sending device is obtained;
    The local command message queue locally preserved according to the command messages queue and the receiving device, determines difference life Make message queue;Wherein, the difference command messages queue includes the other command messages queue of multiclass sub-district and each sub-district The file attribute information of at least one file to be updated is preserved in other command messages queue;
    Wherein, in the other command messages queue of any sort sub-district in obtaining the difference command messages queue, according to the son Difference command messages queue is updated the file in the receiving device.
  2. 2. file synchronisation method according to claim 1, it is characterised in that according to the command messages queue and described The local command message queue that receiving device locally preserves, determines difference command messages queue, including:
    Obtain the different statistical dimensions in the local command message queue;
    For each statistical dimension, preserved successively described in the local command message queue under statistical dimension interior Hold the distinctive points of the content with being preserved under statistical dimension described in the command messages queue, and according to the difference compared Point, generates the other command messages queue of the corresponding sub-district of the statistical dimension;
    According to the other command messages queue of all sub-districts of generation, the difference command messages queue is generated.
  3. 3. file synchronisation method according to claim 1, it is characterised in that the file attribute information includes Document Editing Timestamp when instruction, file name, file storage address and file generated;
    Correspondingly, in the other command messages queue of any sort sub-district in obtaining the difference command messages queue, according to described The other command messages queue of sub-district is updated the file in the receiving device, including:
    In the file attribute information of each file to be updated included according to the other command messages queue of the sub-district File storage address, the file to be updated that file designation is corresponding file name is obtained from corresponding file storage address, And file to be updated is updated according to the instruction of corresponding Document Editing.
  4. A kind of 4. file synchronisation method, it is characterised in that applied to sending device, including:
    When increasing the file attribute information of file to be updated in default file newly, by the file attribute information of file to be updated Format conversion is carried out, obtains command messages queue, and the command messages queue is saved in memory;
    Real-time preset monitored port, judges whether to receive the link order that at least one receiving device is sent;
    When judging to receive the link order of at least one receiving device transmission, the reception with sending link order is set It is standby to be attached;
    Start a new communication thread to communicate with being connected to the receiving device of the sending device.
  5. 5. file synchronisation method according to claim 4, it is characterised in that when newly-increased file to be updated in default file File attribute information when, the file attribute information of file to be updated is subjected to format conversion, obtains command messages queue, is wrapped Include:
    When increasing the file attribute information of file to be updated in default file newly, using the working method of multithreading, will treat more The file attribute information of new file carries out format conversion, obtains command messages queue.
  6. A kind of 6. file synchronizer, it is characterised in that applied to receiving device, including:
    Acquisition module, for after being communicated to connect with sending device, obtaining the command messages queue in the sending device;
    Comparison module, for the local command message team locally preserved according to the command messages queue and the receiving device Row, determine difference command messages queue;Wherein, the difference command messages queue include the other command messages queue of multiclass sub-district, And the file attribute information of at least one file to be updated is preserved in the other command messages queue of each sub-district;
    Update module, in the other command messages queue of any sort sub-district in obtaining the difference command messages queue, root The file in the receiving device is updated according to the sub-district other command messages queue.
  7. 7. file synchronizer according to claim 6, it is characterised in that the comparison module includes:
    Acquisition submodule, for obtaining the different statistical dimensions in the local command message queue;
    Comparison sub-module, for for each statistical dimension, uniting successively described in the local command message queue The content preserved under meter dimension and the distinctive points of the content preserved under statistical dimension described in the command messages queue, and according to The distinctive points compared, generate the other command messages queue of the corresponding sub-district of the statistical dimension;
    Submodule is generated, for the other command messages queue of all sub-districts according to generation, the difference order is generated and disappears Cease queue.
  8. 8. file synchronizer according to claim 6, it is characterised in that the file attribute information includes Document Editing Timestamp when instruction, file name, file storage address and file generated;
    Correspondingly, the update module includes:
    Submodule is updated, for the text of each file to be updated included according to the other command messages queue of the sub-district File storage address in part attribute information, file designation is obtained as corresponding file name from corresponding file storage address File to be updated, and file to be updated is updated according to the instruction of corresponding Document Editing.
  9. A kind of 9. file synchronizer, it is characterised in that applied to sending device, including:
    Parsing module, for when increasing the file attribute information of file to be updated in default file newly, by file to be updated File attribute information carry out format conversion, obtain command messages queue, and the command messages queue is saved in memory;
    Judgment module, for real-time preset monitored port, judges whether that receiving the connection that at least one receiving device is sent refers to Order;
    Link block, for when the judgment module judges to receive the link order that at least one receiving device is sent, The receiving device with sending link order is attached;
    Thread starting module, after the receiving device for the link block and transmission link order is attached, starts One new communication thread communicates with being connected to the receiving device of the sending device.
  10. 10. file synchronizer according to claim 9, it is characterised in that the parsing module includes:
    Analyzing sub-module, for when increasing the file attribute information of file to be updated in default file newly, using multithreading Working method, carries out format conversion by the file attribute information of file to be updated, obtains command messages queue.
  11. A kind of 11. receiving device, it is characterised in that including:Memory and processor;
    Wherein, the memory is used for storage program;
    Processor is used for caller, wherein, described program is used for:
    After being communicated to connect with sending device, the command messages queue in the sending device is obtained;
    The local command message queue locally preserved according to the command messages queue and the receiving device, determines difference life Make message queue;Wherein, the difference command messages queue includes the other command messages queue of multiclass sub-district and each sub-district The file attribute information of at least one file to be updated is preserved in other command messages queue;
    Wherein, in the other command messages queue of any sort sub-district in obtaining the difference command messages queue, according to the son Difference command messages queue is updated the file in the receiving device.
  12. A kind of 12. sending device, it is characterised in that including:Memory and processor;
    Wherein, the memory is used for storage program;
    Processor is used for caller, wherein, described program is used for:
    When increasing the file attribute information of file to be updated in default file newly, by the file attribute information of file to be updated Format conversion is carried out, obtains command messages queue, and the command messages queue is saved in memory;
    Real-time preset monitored port, judges whether to receive the link order that at least one receiving device is sent;
    When judging to receive the link order of at least one receiving device transmission, the reception with sending link order is set It is standby to be attached;
    Start a new communication thread to communicate with being connected to the receiving device of the sending device.
CN201711422487.2A 2017-12-25 2017-12-25 File synchronization method, device and equipment Active CN107948316B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711422487.2A CN107948316B (en) 2017-12-25 2017-12-25 File synchronization method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711422487.2A CN107948316B (en) 2017-12-25 2017-12-25 File synchronization method, device and equipment

Publications (2)

Publication Number Publication Date
CN107948316A true CN107948316A (en) 2018-04-20
CN107948316B CN107948316B (en) 2020-11-03

Family

ID=61938994

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711422487.2A Active CN107948316B (en) 2017-12-25 2017-12-25 File synchronization method, device and equipment

Country Status (1)

Country Link
CN (1) CN107948316B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113434600A (en) * 2021-06-30 2021-09-24 青岛海尔科技有限公司 Data synchronization method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101326492A (en) * 2005-10-06 2008-12-17 雷德本德有限公司 Methods and systems for updating content including a compressed version
US7747999B1 (en) * 2005-09-26 2010-06-29 Juniper Networks, Inc. Software installation in a multi-chassis network device
CN102682178A (en) * 2012-05-22 2012-09-19 武汉大学 Consistency maintenance method in heterogeneous computer aided design (CAD) on-line integration
US9088491B2 (en) * 2012-03-07 2015-07-21 Citrix Systems, Inc. Systems and methods for comparing configuration files and generating corrective commands
CN105843871A (en) * 2016-03-18 2016-08-10 中国银联股份有限公司 Control and management system of distributed application file
CN106909128A (en) * 2015-12-23 2017-06-30 中国科学院沈阳自动化研究所 A kind of motion control method for supporting motion-control module online upgrading

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7747999B1 (en) * 2005-09-26 2010-06-29 Juniper Networks, Inc. Software installation in a multi-chassis network device
CN101326492A (en) * 2005-10-06 2008-12-17 雷德本德有限公司 Methods and systems for updating content including a compressed version
US9088491B2 (en) * 2012-03-07 2015-07-21 Citrix Systems, Inc. Systems and methods for comparing configuration files and generating corrective commands
CN102682178A (en) * 2012-05-22 2012-09-19 武汉大学 Consistency maintenance method in heterogeneous computer aided design (CAD) on-line integration
CN106909128A (en) * 2015-12-23 2017-06-30 中国科学院沈阳自动化研究所 A kind of motion control method for supporting motion-control module online upgrading
CN105843871A (en) * 2016-03-18 2016-08-10 中国银联股份有限公司 Control and management system of distributed application file

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113434600A (en) * 2021-06-30 2021-09-24 青岛海尔科技有限公司 Data synchronization method and device
CN113434600B (en) * 2021-06-30 2023-06-09 青岛海尔科技有限公司 Data synchronization method and device

Also Published As

Publication number Publication date
CN107948316B (en) 2020-11-03

Similar Documents

Publication Publication Date Title
CN106331098B (en) Server cluster system
JP3624657B2 (en) Management computer or computer system
JP3542726B2 (en) Generate reports using distributed workstations
CN113220715B (en) Data processing method, system, computer and readable storage medium
JPS6394360A (en) Transaction processing system
CN104391930A (en) Distributed file storage device and method
US20100145950A1 (en) Realtime Unification Management Information Data Conversion and Monitoring Apparatus and Method for Thereof
CN101741635B (en) Method, system and device for synchronous altering message
CN104793999A (en) Servo server framework system
CN110099084A (en) A kind of method, system and computer-readable medium guaranteeing storage service availability
CN109542330A (en) Date storage method, data query method and device
US8954576B2 (en) Test analysis system of network and analysis method thereof
CN107948316A (en) A kind of file synchronisation method, device and equipment
CN104639386B (en) fault location system and method
CN108287747A (en) Method and apparatus for virtual machine backup
CN109783463A (en) File synchronisation method, device and computer readable storage medium
CN112835978A (en) Data storage method and device and computer equipment
CN110990360A (en) File synchronization method based on network storage device and related components
CN101227330B (en) Method and system for history performance data collection
CN109474386B (en) Signaling tracking method, system, network element equipment and storage medium
CN108667649B (en) A kind of malfunction elimination method, apparatus and server
CN105357060A (en) Method, device and system for obtaining network equipment performance data
EP2355409B1 (en) Network management device
CN106603627B (en) The synchronous method of video file and isochronous schedules device when data center online
CN109684158A (en) Method for monitoring state, device, equipment and the storage medium of distributed coordination system

Legal Events

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