CN104780211A - Data synchronization method and device - Google Patents

Data synchronization method and device Download PDF

Info

Publication number
CN104780211A
CN104780211A CN201510173247.8A CN201510173247A CN104780211A CN 104780211 A CN104780211 A CN 104780211A CN 201510173247 A CN201510173247 A CN 201510173247A CN 104780211 A CN104780211 A CN 104780211A
Authority
CN
China
Prior art keywords
data
client
server
synchronized
synchronization
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
CN201510173247.8A
Other languages
Chinese (zh)
Other versions
CN104780211B (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.)
Nubia Technology Co Ltd
Original Assignee
Nubia 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 Nubia Technology Co Ltd filed Critical Nubia Technology Co Ltd
Priority to CN201510173247.8A priority Critical patent/CN104780211B/en
Publication of CN104780211A publication Critical patent/CN104780211A/en
Application granted granted Critical
Publication of CN104780211B publication Critical patent/CN104780211B/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
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/06Network architectures or network communication protocols for network security for supporting key management in a packet data network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)
  • Computer And Data Communications (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses a data synchronization method and device. The data synchronization method comprises the following steps: a client acquires an access credential and a message key from a server, wherein the message key is used for encryption and decryption of follow-up interaction data between the client and the server; the client accesses the server with the access credential and requests for to-be-synchronized data at the server end from the server; after processing is finished, the client acquires the to-be-synchronized data of the client and sends the data to the server, so that the server performs data synchronization processing according to the to-be-synchronized data of the client, and a processing result sent by the server is confirmed. The performance of a mobile terminal is used reasonably, the data synchronization operation logic is delivered to the mobile terminal, namely, the client, for processing during data synchronization, so that the pressure of the server is reduced greatly, and the simultaneous processing quantity of the server is increased effectively.

Description

Method of data synchronization and device
Technical field
The present invention relates to communication technical field, especially relate to a kind of method of data synchronization and device.
Background technology
Along with the maturation gradually of 3G technology and the universal of mobile terminal, the mobile Internet epoch have pulled open curtain step by step.People will use the mobile terminal connecting Internet obtaining informations such as smart mobile phone, panel computer, e-book more.Different from the Internet era of PC, the mobile Internet epoch will present terminal, the diversified trend of platform.Diversified information channel, bringing user easily simultaneously, have also been introduced a difficult problem for data fusion between many equipment.User is in the urgent need to a kind of technology, and make the data between various equipment reach consistency, therefore data synchronization technology arises at the historic moment.
At present, the logical process of data syn-chronization is all carry out at server end, client data to be synchronized are sent to server by client, after server process is complete, data to be synchronized for server end are sent to client, server also needs the mapping relations table of maintain synchronization data client ID and server end ID simultaneously.But along with the development of mobile terminal is with universal, the process request of client gets more and more, and makes the pressure of server also increasing.
Summary of the invention
Main purpose of the present invention is to provide a kind of method of data synchronization and device, is intended to the pressure reducing server in data synchronization process, effectively improves the concurrent processing quantity of server.
To achieve these objectives, the present invention proposes a kind of method of data synchronization, is applied to client, comprises step:
Client obtains access credentials and message key from server, and described message key is used for data mutual between encryption and decryption subsequent client and server;
Client uses described access credentials access services device, to server for services device end data to be synchronized;
The described server end data to be synchronized that client sends according to server carry out data synchronization processing;
After having processed, client obtains client Data Concurrent to be synchronized and gives server, to make server carry out data synchronization processing according to described client data to be synchronized, and the result that confirmed service device sends.
Preferably, described client obtains client data to be synchronized and comprises: the timestamp that last modification time stabs and the last time is synchronous of every data compares by client, obtain the data having amendment after last simultaneous operation completes, and as client data to be synchronized after therefrom rejecting the data crossed by described server end data synchronization updating to be synchronized.
Preferably, described access credentials by server address, user profile, client ip address or/and timestamp forms.
The present invention also proposes a kind of method of data synchronization, is applied to server end, comprises step:
Server generates access credentials and message key and sends to client, and described message key is used for data mutual between encryption and decryption subsequent client and server;
Server verifies the access credentials that client provides;
When verification by after, server obtains server end Data Concurrent to be synchronized and gives client, carries out data synchronization processing to make client according to described server end data to be synchronized;
The client data to be synchronized that server receives client sends, carry out data synchronization processing according to described client data to be synchronized, and result are returned to client.
Preferably, described server obtains server end data to be synchronized and comprises: the timestamp that last modification time stabs and the last time is synchronous of every data compares by server, obtains after last simultaneous operation completes and has the data of amendment as server end data to be synchronized.
Preferably, described method also comprises: after terminating alternately, server update message key returns to client at every turn, uses time mutual for next time.
The present invention proposes a kind of data synchronization unit simultaneously, is applied to client, comprises acquisition module, the first synchronization module and the second synchronization module, wherein:
Described acquisition module, for obtaining access credentials and message key from server, described message key is used for data mutual between encryption and decryption subsequent client and server;
Described first synchronization module, for using described access credentials access services device, to server for services device end data to be synchronized, carries out data synchronization processing according to the described server end data to be synchronized that server sends;
Described second synchronization module, for after the first synchronization module process completes, obtain client Data Concurrent to be synchronized and give server, to make server carry out data synchronization processing according to described client data to be synchronized, and the result that confirmed service device sends.
Preferably, described second synchronization module is used for:
The timestamp that last modification time stabs and the last time is synchronous of every data is compared, obtain the data having amendment after last simultaneous operation completes, and as client data to be synchronized after therefrom rejecting the data crossed by described server end data synchronization updating to be synchronized.
The present invention also proposes a kind of data synchronization unit, is applied to server end, comprises generation unit, verification unit, the first lock unit and the second lock unit, wherein:
Described generation unit, for generating access credentials and message key and sending to client, described message key is used for data mutual between encryption and decryption subsequent client and server;
Described verification unit, verifies for the access credentials provided client;
Described first lock unit, for when verification by after, obtain server end Data Concurrent to be synchronized and give client, carry out data synchronization processing to make client according to described server end data to be synchronized;
Described second lock unit, for receiving the client data to be synchronized that client sends, carrying out data synchronization processing according to described client data to be synchronized, and result is returned to client.
Preferably, described first lock unit is used for: compared by the timestamp that last modification time stabs and the last time is synchronous of every data, obtain after last simultaneous operation completes and have the data of amendment as server end data to be synchronized.
Preferably, described generation unit also for: after terminating alternately, updating message key returns to client at every turn, uses time mutual for next time.
Preferably, described generation unit is used for: according to server address, user profile, client ip address or/and timestamp generates access credentials.
A kind of method of data synchronization provided by the present invention and device, the performance of Appropriate application mobile terminal, when carrying out data syn-chronization, the operation logic of data syn-chronization is given mobile terminal (client) process, substantially reduce the pressure of server, effectively improve the concurrent processing quantity of server.Meanwhile, server end does not need the mapping relations table of maintain synchronization data client Id and server end ID, simplifies simultaneous operation flow process.And, the present invention adopts access credentials School Affairs message key to encrypt the mode of swap data, improve authentication mode mutual between server and client side, decrease the number of times that server and client side is mutual, optimize the browsing process of client and server, effectively improve the efficiency of whole simultaneous operation.
Accompanying drawing explanation
Fig. 1 is the flow chart of method of data synchronization first embodiment of the present invention;
Fig. 2 is the module diagram of data synchronization unit first embodiment of the present invention;
Fig. 3 is the flow chart of method of data synchronization second embodiment of the present invention;
Fig. 4 is the module diagram of data synchronization unit second embodiment of the present invention;
Fig. 5 is the module diagram of data synchronous system one embodiment of the present invention.
The realization of the object of the invention, functional characteristics and advantage will in conjunction with the embodiments, are described further with reference to accompanying drawing.
Embodiment
Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
In view of the performance of mobile terminal improves constantly, the performance of Appropriate application mobile terminal of the present invention, giving mobile terminal process when carrying out data syn-chronization by the operation logic of data syn-chronization, to substantially reduce the pressure of server, effectively improving the concurrent processing quantity of server.Below by way of specific embodiment, technical scheme of the present invention is described in detail.
Embodiment one
See Fig. 1, propose method of data synchronization one embodiment of the present invention, the method for data synchronization of the present embodiment is applied to client, comprises the following steps:
Step S11: client obtains access credentials and message key from server.
Concrete, client uses the user profile access services devices (as FOTA server) such as account and the password of user (password value can carry out the value after md5 encryption for clear-text passwords together with other parameter), server is verified the user profile such as account number and password, by then generation server access credentials (Token Id) and message key after checking, and send to client.Client in the present invention, refers to the terminal equipment carrying out data syn-chronization with server, as mobile terminals such as mobile phone, panel computer, e-book.
Wherein, message key is used for carrying out encryption and decryption to data mutual between subsequent client and server, i.e. transmit after all data of subsequent client and server interaction all need to be encrypted by message key again.Access credentials is by server address, user profile, client ip address or/and timestamp forms, and namely server generates access credentials according to any one or combination in any in FOTA server address, user profile, client ip address and timestamp.
Step S12: client uses access credentials access services device, to server for services device end data to be synchronized.
Concrete, client uses access credentials access services device, to server for services device end data to be synchronized.Server verifies the access credentials that client provides, and verifies by rear, obtains server end data to be synchronized, and sends to client after using message key to be encrypted server end data to be synchronized.
The structure of the server end data to be synchronized that server sends is: sid+status (N/U/D)+dataInfo.Wherein, sid identifies server ID corresponding to synchrodata, is server data unique identification; Status (N/U/D) identifies the action type of synchrodata, and wherein N representative is newly-increased, and U represents amendment, and D represents deletion; DataInfo identifies the detail of synchrodata.
Server can obtain server end data to be synchronized in the following manner: the timestamp that last modification time stabs and the last time is synchronous of every the data stored compares by server, obtains after last simultaneous operation completes and has the data of amendment as server end data to be synchronized.Such as, if certain data last modification time stamp is later than the last synchronous timestamp, then think that these data have amendment after upper once simultaneous operation completes, otherwise then think there is no amendment.
Step S13: the server end data to be synchronized that client sends according to server carry out data synchronization processing.
Concrete, after client receives server end data to be synchronized, according to the sid inquiring client terminal local data in structure sid+status (the N/U/D)+dataInfo of server end data to be synchronized.When having there are data corresponding to this sid in client local data, then directly carry out data modification according to status (N/U/D).
When there are not data corresponding to this sid in client local data, be then updated to database after data to be synchronized for server end and other data without sid being compared process.For example:
Suppose that server end data to be synchronized are A:sid+status (N/U/D)+datainfo, other datainfo without the data of sid in A and client is compared.If client has data B:cid+status (the N/U/D)+datainfo of identical datainfo (concrete determination methods can be arranged according to demand), wherein cid identifies client id corresponding to synchrodata, it is client data unique identification, then be updated in B by the sid of A, End-Customer end obtains data B:cid+sid+status (N/U/D)+dataInfo; If client does not have the data of identical datainfo, then directly increase newly in the local data base of client by A, client also obtains data B:cid+sid+status (N/U/D)+dataInfo.
Step S14: client obtains client Data Concurrent to be synchronized and gives server, to make server carry out data synchronization processing according to client data to be synchronized, and the result that confirmed service device sends.
Concrete, after the complete server end of client process data to be synchronized, obtain client data to be synchronized, and send to server after using message key to be encrypted.The structure of client data to be synchronized has two kinds, one is: sid+cid+status (N/U/D)+dataInfo, another kind is: cid+status (N)+dataInfo (when client does not have the data of sid, status is all set to newly-increased N).
Client can obtain client data to be synchronized in the following manner: the timestamp that last modification time stabs and the last time is synchronous of every data compares by client, obtain the data having amendment after last simultaneous operation completes, and as client data to be synchronized after therefrom rejecting the data that serviced device end data synchronization updating to be synchronized has been crossed in previous step S13.
After server receives client data to be synchronized, carry out data synchronization processing according to client data to be synchronized, and result is returned to client.If what client had the current transmission of mark is last packet, server then nullifies access credentials and the message key of this operation simultaneously.
When server synchronously processes, be the data of sid+cid+status (N/U/D)+dataInfo for structure, be then directly updated in the database of server according to sid; For the data that structure is cid+status (N)+dataInfo, then directly increase newly in the database of server, and obtain the mapping relations one to one that are made up of sid and the cid of this part newly-increased data, and the mapping relations of sid and cid are returned to client.Client is according to the mapping relations of sid and cid received, and be updated in corresponding synchrodata by sid by cid, final data simultaneous operation completes.Final result is:
Server and client data are synchronously consistent;
All data structures of client are: sid+cid+status (N/U/D)+dataInfo;
All data structures of server are: sid+status (N/U/D)+dataInfo.
Further, after terminating alternately, server all can return to client by updating message key at every turn, uses time mutual for next time, and namely server and client are often mutual once just refreshes a message key, thus improves the fail safe of data interaction.
See Fig. 2, propose data synchronization unit one embodiment that the present invention realizes above-mentioned method of data synchronization, the data synchronization unit of the present embodiment is applied to client, comprises acquisition module, the first synchronization module and the second synchronization module, wherein:
Acquisition module: for obtaining access credentials and message key from server.
Concrete, acquisition module uses the user profile access services devices such as account and the password of user (password value can carry out the value after md5 encryption for clear-text passwords with other parameter together with), the access credentials (Token Id) of reception server transmission and message key.
Wherein, message key is used for carrying out encryption and decryption to information mutual between subsequent client and server, i.e. transmit after all information of subsequent client and server interaction all need to be encrypted by message key again.Access credentials by server address, user profile, client ip address or/and timestamp forms.
First synchronization module: for using access credentials access services device, to server for services device end data to be synchronized, carries out data synchronization processing according to the server end data to be synchronized that server sends.
Concrete, the first synchronization module uses access credentials access services device, to server for services device end data to be synchronized.First synchronization module is resolved it after receiving server end data to be synchronized, according to the sid inquiring client terminal local data in structure sid+status (the N/U/D)+dataInfo of server end data to be synchronized.When having there are data corresponding to this sid in client local data, the first synchronization module is then direct has carried out data modification according to status (N/U/D).
When there are not data corresponding to this sid in client local data, the first synchronization module is updated to database after then data to be synchronized for server end and other data without sid being compared process.For example:
Suppose that server end data to be synchronized are A:sid+status (N/U/D)+datainfo, other datainfo without the data of sid in A and client compares by the first synchronization module.If client has data B:cid+status (the N/U/D)+datainfo of identical datainfo (concrete determination methods can be arranged according to demand), the sid of A is then updated in B by the first synchronization module, finally obtains data B:cid+sid+status (N/U/D)+dataInfo; If client does not have the data of identical datainfo, the first synchronization module is then direct to be increased newly in the local data base of client by A, finally obtains data B:cid+sid+status (N/U/D)+dataInfo.
Second synchronization module: give server for obtaining client Data Concurrent to be synchronized, to make server carry out data synchronization processing according to client data to be synchronized, and the result that confirmed service device sends.
Concrete, after the first synchronization module processes server end data to be synchronized, the second synchronization module then obtains client data to be synchronized, and sends to server after using message key to be encrypted.The structure of client data to be synchronized has two kinds, one is: sid+cid+status (N/U/D)+dataInfo, another kind is: cid+status (N)+dataInfo (when client does not have the data of sid, status is all set to newly-increased N).
Second synchronization module can obtain client data to be synchronized in the following manner: the timestamp that last modification time stabs and the last time is synchronous of every data compares by the second synchronization module, obtain the data having amendment after last simultaneous operation completes, and data remaining after therefrom rejecting the data that serviced device end data synchronization updating to be synchronized crosses, as client data to be synchronized.
The mapping relations of sid and cid can be returned to client after carrying out data synchronization processing according to client data to be synchronized by server.Sid, according to the mapping relations of sid and cid received, is updated in corresponding synchrodata by cid by the second synchronization module, finally completes data syn-chronization operation.
Thus, the method of data synchronization of the present embodiment and device, the performance of Appropriate application mobile terminal, when carrying out data syn-chronization, the operation logic of data syn-chronization is given mobile terminal (client) process, substantially reduce the pressure of server, effectively improve the concurrent processing quantity of server.Meanwhile, server end does not need the mapping relations table of maintain synchronization data client Id and server end ID, simplifies simultaneous operation flow process.And, the present invention adopts access credentials School Affairs message key to encrypt the mode of swap data, improve authentication mode mutual between server and client side, decrease the number of times that server and client side is mutual, optimize the browsing process of client and server, effectively improve the efficiency of whole simultaneous operation.
Embodiment two
See Fig. 3, propose another embodiment of method of data synchronization of the present invention, the method for data synchronization of the present embodiment is applied to server end, comprises the following steps:
Step S21: server generates access credentials and message key and sends to client.
Concrete, client uses the user profile access services devices (as FOTA server) such as account and the password of user (password value can carry out the value after md5 encryption for clear-text passwords together with other parameter), server is verified the user profile such as account number and password, by then generation server access credentials (Token Id) and message key after checking, and send to client.
Wherein, message key is used for carrying out encryption and decryption to data mutual between subsequent client and server, i.e. transmit after all data of subsequent client and server interaction all need to be encrypted by message key again.Access credentials is by server address, user profile, client ip address or/and timestamp forms, and namely server generates access credentials according to any one or combination in any in FOTA server address, user profile, client ip address and timestamp.
Step S22: server verifies the access credentials that client provides.
Concrete, client uses access credentials access services device, to server for services device end data to be synchronized.Server verifies the access credentials that client provides, the legitimacy of authentication-access voucher.
Step S23: when verification by after, server obtains server end Data Concurrent to be synchronized and gives client, carries out data synchronization processing to make client according to server end data to be synchronized.
Concrete, verify by rear, server obtains server end data to be synchronized, and sends to client after using message key to be encrypted server end data to be synchronized.
The structure of the server end data to be synchronized that server sends is: sid+status (N/U/D)+dataInfo.Wherein, sid identifies server ID corresponding to synchrodata, is server data unique identification; Status (N/U/D) identifies the action type of synchrodata, and wherein N representative is newly-increased, and U represents amendment, and D represents deletion; DataInfo identifies the detail of synchrodata.
Server can obtain server end data to be synchronized in the following manner: the timestamp that last modification time stabs and the last time is synchronous of every the data stored compares by server, obtains after last simultaneous operation completes and has the data of amendment as server end data to be synchronized.Such as, if certain data last modification time stamp is later than the last synchronous timestamp, then think that these data have amendment after upper once simultaneous operation completes, otherwise then think there is no amendment.
After client receives server end data to be synchronized, according to the sid inquiring client terminal local data in structure sid+status (the N/U/D)+dataInfo of server end data to be synchronized.When having there are data corresponding to this sid in client local data, then directly carry out data modification according to status (N/U/D).
When there are not data corresponding to this sid in client local data, be then updated to database after data to be synchronized for server end and other data without sid being compared process.For example:
Suppose that server end data to be synchronized are A:sid+status (N/U/D)+datainfo, other datainfo without the data of sid in A and client is compared.If client has data B:cid+status (the N/U/D)+datainfo of identical datainfo (concrete determination methods can be arranged according to demand), wherein cid identifies client id corresponding to synchrodata, it is client data unique identification, then be updated in B by the sid of A, End-Customer end obtains data B:cid+sid+status (N/U/D)+dataInfo; If client does not have the data of identical datainfo, then directly increase newly in the local data base of client by A, client also obtains data B:cid+sid+status (N/U/D)+dataInfo.
Step S24: the client data to be synchronized that server receives client sends, carries out data synchronization processing according to client data to be synchronized, and result is returned to client.
Concrete, after the complete server end of client process data to be synchronized, obtain client data to be synchronized, and send to server after using message key to be encrypted.The structure of client data to be synchronized has two kinds, one is: sid+cid+status (N/U/D)+dataInfo, another kind is: cid+status (N)+dataInfo (when client does not have the data of sid, status is all set to newly-increased N).
Client can obtain client data to be synchronized in the following manner: the timestamp that last modification time stabs and the last time is synchronous of every data compares by client, obtain the data having amendment after last simultaneous operation completes, and as client data to be synchronized after therefrom rejecting the data that serviced device end data synchronization updating to be synchronized crosses.
After server receives client data to be synchronized, carry out data synchronization processing according to client data to be synchronized, and result is returned to client.If what client had the current transmission of mark is last packet, server then nullifies access credentials and the message key of this operation simultaneously.
When server synchronously processes, be the data of sid+cid+status (N/U/D)+dataInfo for structure, be then directly updated in the database of server according to sid; For the data that structure is cid+status (N)+dataInfo, then directly increase newly in the database of server, and obtain the mapping relations one to one that are made up of sid and the cid of this part newly-increased data, and the mapping relations of sid and cid are returned to client.Client is according to the mapping relations of sid and cid received, and be updated in corresponding synchrodata by sid by cid, final data simultaneous operation completes.Final result is:
Server and client data are synchronously consistent;
All data structures of client are: sid+cid+status (N/U/D)+dataInfo;
All data structures of server are: sid+status (N/U/D)+dataInfo.
Further, after terminating alternately, server all can return to client by updating message key at every turn, uses time mutual for next time, and namely server and client are often mutual once just refreshes a message key, thus improves the fail safe of data interaction.
See Fig. 4, propose another embodiment of data synchronization unit that the present invention realizes above-mentioned method of data synchronization, the data synchronization unit of the present embodiment is applied to server end, comprises generation unit, verification unit, the first lock unit and the second lock unit, wherein:
Generation unit: for generating access credentials and message key and sending to client.
Concrete, client uses the user profile access services devices such as account and the password of user (password value can carry out the value after md5 encryption for clear-text passwords together with other parameter), server is verified the user profile such as account number and password, after checking, generation unit is generation server access credentials (TokenId) and message key then, and sends to client.
Wherein, message key is used for carrying out encryption and decryption to information mutual between subsequent client and server, i.e. transmit after all information of subsequent client and server interaction all need to be encrypted by message key again.Access credentials is by server address, user profile, client ip address or/and timestamp forms, and namely generation unit generates access credentials according to any one in server address, user profile, client ip address and timestamp or combination in any.
Verification unit: the access credentials for providing client verifies.
Concrete, when client uses access credentials access services device, during data to be synchronized to server for services device end, verification unit then verifies the access credentials that client provides, the legitimacy of authentication-access voucher.When verify by time, verification unit then to first lock unit send check results.
First lock unit: for when verification by after, obtain server end Data Concurrent to be synchronized and give client, carry out data synchronization processing to make client according to server end data to be synchronized.
Concrete, verify by rear, the first lock unit obtains server end data to be synchronized, and sends to client after using message key to be encrypted server end data to be synchronized.
The structure of the server end data to be synchronized that the first lock unit sends is: sid+status (N/U/D)+dataInfo.First lock unit can obtain server end data to be synchronized in the following manner: the timestamp that last modification time stabs and the last time is synchronous of every the data stored compares by the first lock unit, obtains after last simultaneous operation completes and has the data of amendment as server end data to be synchronized.Such as, if certain data last modification time stamp is later than the last synchronous timestamp, then think that these data have amendment after upper once simultaneous operation completes, otherwise then think there is no amendment.
Second lock unit: for receiving the client data to be synchronized that client sends, carrying out data synchronization processing according to client data to be synchronized, and result is returned to client.
Concrete, after the complete server end of client process data to be synchronized, the client data to be synchronized of two kinds of forms are sent to server end, one is: sid+cid+status (N/U/D)+dataInfo, another kind is: cid+status (N)+dataInfo (when client does not have the data of sid, status is all set to newly-increased N).Second lock unit is resolved it after receiving client data to be synchronized, then carries out data synchronization processing according to client data to be synchronized, and result is returned to client.If what client had the current transmission of mark is last packet, the second lock unit then nullifies access credentials and the message key of this operation simultaneously.
When second lock unit synchronously processes, be the data of sid+cid+status (N/U/D)+dataInfo for structure, be then directly updated in the database of server according to sid; For the data that structure is cid+status (N)+dataInfo, then directly increase newly in the database of server, and obtain the mapping relations one to one that are made up of sid and the cid of this part newly-increased data, and the mapping relations of sid and cid are returned to client.Client is according to the mapping relations of sid and cid received, and be updated in corresponding synchrodata by sid by cid, final data simultaneous operation completes.
Further, after terminating alternately, generation unit all can return to client by updating message key at every turn, uses time mutual for next time, and namely server and client are often mutual once just refreshes a message key, thus improves the fail safe of data interaction.
Thus, the method of data synchronization of the present embodiment and device, the performance of Appropriate application mobile terminal, when carrying out data syn-chronization, the operation logic of data syn-chronization is given mobile terminal (client) process, substantially reduce the pressure of server, effectively improve the concurrent processing quantity of server.Meanwhile, server end does not need the mapping relations table of maintain synchronization data client Id and server end ID, simplifies simultaneous operation flow process.And, the present invention adopts access credentials School Affairs message key to encrypt the mode of swap data, improve authentication mode mutual between server and client side, decrease the number of times that server and client side is mutual, optimize the browsing process of client and server, effectively improve the efficiency of whole simultaneous operation.
Embodiment three
See Fig. 5, for data synchronous system one embodiment of the present invention, described data synchronous system comprises client and server, described client and server is client and server involved in previous embodiment one and embodiment two, or can be understood as, described client comprises data synchronization unit involved in previous embodiment one, and described server comprises data synchronization unit involved in previous embodiment two, does not repeat them here.
The data synchronous system of the present embodiment, the performance of Appropriate application mobile terminal, when carrying out data syn-chronization, the operation logic of data syn-chronization being given mobile terminal (client) process, substantially reducing the pressure of server, effectively improve the concurrent processing quantity of server.Meanwhile, server end does not need the mapping relations table of maintain synchronization data client ID and server end ID, simplifies simultaneous operation flow process.And, the present invention adopts access credentials School Affairs message key to encrypt the mode of swap data, improve authentication mode mutual between server and client side, decrease the number of times that server and client side is mutual, optimize the browsing process of client and server, effectively improve the efficiency of whole simultaneous operation.
One of ordinary skill in the art will appreciate that, realize the hardware that all or part of step in above-described embodiment method can control to be correlated with by program to complete, described program can be stored in a computer read/write memory medium, and described storage medium can be ROM/RAM, disk, CD etc.
Should be understood that; these are only the preferred embodiments of the present invention; can not therefore limit the scope of the claims of the present invention; every utilize specification of the present invention and accompanying drawing content to do equivalent structure or equivalent flow process conversion; or be directly or indirectly used in other relevant technical fields, be all in like manner included in scope of patent protection of the present invention.

Claims (13)

1. a method of data synchronization, is applied to client, it is characterized in that, comprises step:
Client obtains access credentials and message key from server, and described message key is used for data mutual between encryption and decryption subsequent client and server;
Client uses described access credentials access services device, to server for services device end data to be synchronized;
The described server end data to be synchronized that client sends according to server carry out data synchronization processing;
After having processed, client obtains client Data Concurrent to be synchronized and gives server, to make server carry out data synchronization processing according to described client data to be synchronized, and the result that confirmed service device sends.
2. method of data synchronization according to claim 1, it is characterized in that, described client obtains client data to be synchronized and comprises: the timestamp that last modification time stabs and the last time is synchronous of every data compares by client, obtain the data having amendment after last simultaneous operation completes, and as client data to be synchronized after therefrom rejecting the data crossed by described server end data synchronization updating to be synchronized.
3. method of data synchronization according to claim 1 and 2, is characterized in that, described access credentials by server address, user profile, client ip address or/and timestamp forms.
4. a method of data synchronization, is applied to server end, it is characterized in that, comprises step:
Server generates access credentials and message key and sends to client, and described message key is used for data mutual between encryption and decryption subsequent client and server;
Server verifies the access credentials that client provides;
When verification by after, server obtains server end Data Concurrent to be synchronized and gives client, carries out data synchronization processing to make client according to described server end data to be synchronized;
The client data to be synchronized that server receives client sends, carry out data synchronization processing according to described client data to be synchronized, and result are returned to client.
5. method of data synchronization according to claim 4, it is characterized in that, described server obtains server end data to be synchronized and comprises: the timestamp that last modification time stabs and the last time is synchronous of every data compares by server, obtains after last simultaneous operation completes and has the data of amendment as server end data to be synchronized.
6. method of data synchronization according to claim 4, is characterized in that, described method also comprises: after terminating alternately, server update message key returns to client at every turn, uses time mutual for next time.
7. the method for data synchronization according to any one of claim 4-6, is characterized in that, described access credentials by server address, user profile, client ip address or/and timestamp forms.
8. a data synchronization unit, is applied to client, it is characterized in that, comprises acquisition module, the first synchronization module and the second synchronization module, wherein:
Described acquisition module, for obtaining access credentials and message key from server, described message key is used for data mutual between encryption and decryption subsequent client and server;
Described first synchronization module, for using described access credentials access services device, to server for services device end data to be synchronized, carries out data synchronization processing according to the described server end data to be synchronized that server sends;
Described second synchronization module, for after the first synchronization module process completes, obtain client Data Concurrent to be synchronized and give server, to make server carry out data synchronization processing according to described client data to be synchronized, and the result that confirmed service device sends.
9. data synchronization unit according to claim 8, is characterized in that, described second synchronization module is used for:
The timestamp that last modification time stabs and the last time is synchronous of every data is compared, obtain the data having amendment after last simultaneous operation completes, and as client data to be synchronized after therefrom rejecting the data crossed by described server end data synchronization updating to be synchronized.
10. a data synchronization unit, is applied to server end, it is characterized in that, comprises generation unit, verification unit, the first lock unit and the second lock unit, wherein:
Described generation unit, for generating access credentials and message key and sending to client, described message key is used for data mutual between encryption and decryption subsequent client and server;
Described verification unit, verifies for the access credentials provided client;
Described first lock unit, for when verification by after, obtain server end Data Concurrent to be synchronized and give client, carry out data synchronization processing to make client according to described server end data to be synchronized;
Described second lock unit, for receiving the client data to be synchronized that client sends, carrying out data synchronization processing according to described client data to be synchronized, and result is returned to client.
11. data synchronization units according to claim 10, it is characterized in that, described first lock unit is used for: compared by the timestamp that last modification time stabs and the last time is synchronous of every data, obtain after last simultaneous operation completes and have the data of amendment as server end data to be synchronized.
12. data synchronization units according to claim 10, is characterized in that, described generation unit also for: after terminating alternately, updating message key returns to client at every turn, uses time mutual for next time.
13. data synchronization units according to any one of claim 10-12, it is characterized in that, described generation unit is used for: according to server address, user profile, client ip address or/and timestamp generates access credentials.
CN201510173247.8A 2015-04-13 2015-04-13 Method of data synchronization and device Active CN104780211B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510173247.8A CN104780211B (en) 2015-04-13 2015-04-13 Method of data synchronization and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510173247.8A CN104780211B (en) 2015-04-13 2015-04-13 Method of data synchronization and device

Publications (2)

Publication Number Publication Date
CN104780211A true CN104780211A (en) 2015-07-15
CN104780211B CN104780211B (en) 2016-09-07

Family

ID=53621445

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510173247.8A Active CN104780211B (en) 2015-04-13 2015-04-13 Method of data synchronization and device

Country Status (1)

Country Link
CN (1) CN104780211B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105915537A (en) * 2016-05-27 2016-08-31 努比亚技术有限公司 Token generation method, token calibration method and token authentication server
CN106506582A (en) * 2015-09-03 2017-03-15 Ls 产电株式会社 Apparatus and method for the data syn-chronization of EMS
CN108632300A (en) * 2017-03-15 2018-10-09 阿里巴巴集团控股有限公司 Data synchronous system, method, server, client and electronic equipment
WO2021174882A1 (en) * 2020-09-02 2021-09-10 平安科技(深圳)有限公司 Data fragment verification method, apparatus, computer device, and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102904887A (en) * 2012-09-26 2013-01-30 东软集团股份有限公司 Method and system for data synchronization of Web client and server
CN103825917A (en) * 2012-11-16 2014-05-28 中国移动通信集团公司 Data synchronization method, data synchronization system, data synchronization server and terminal
CN104301428A (en) * 2014-10-29 2015-01-21 广州视源电子科技股份有限公司 Data synchronization method and server

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103685333B (en) * 2012-08-31 2018-01-19 腾讯科技(深圳)有限公司 Method of data synchronization, terminal device, registrar and web page server
US8635373B1 (en) * 2012-09-22 2014-01-21 Nest Labs, Inc. Subscription-Notification mechanisms for synchronization of distributed states
CN104202385A (en) * 2014-08-27 2014-12-10 四川长虹电器股份有限公司 Data backup and updating method of distributed file system
CN104320447B (en) * 2014-10-15 2017-12-19 新疆同晨信息技术有限公司 A kind of middle-size and small-size cloud storage method of data synchronization and computer-readable medium, system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102904887A (en) * 2012-09-26 2013-01-30 东软集团股份有限公司 Method and system for data synchronization of Web client and server
CN103825917A (en) * 2012-11-16 2014-05-28 中国移动通信集团公司 Data synchronization method, data synchronization system, data synchronization server and terminal
CN104301428A (en) * 2014-10-29 2015-01-21 广州视源电子科技股份有限公司 Data synchronization method and server

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506582A (en) * 2015-09-03 2017-03-15 Ls 产电株式会社 Apparatus and method for the data syn-chronization of EMS
US10237345B2 (en) 2015-09-03 2019-03-19 Lsis Co., Ltd. Apparatus and method for data synchronizing of energy management system
CN106506582B (en) * 2015-09-03 2019-06-04 Ls 产电株式会社 The device and method synchronous for the data of Energy Management System
CN105915537A (en) * 2016-05-27 2016-08-31 努比亚技术有限公司 Token generation method, token calibration method and token authentication server
CN108632300A (en) * 2017-03-15 2018-10-09 阿里巴巴集团控股有限公司 Data synchronous system, method, server, client and electronic equipment
WO2021174882A1 (en) * 2020-09-02 2021-09-10 平安科技(深圳)有限公司 Data fragment verification method, apparatus, computer device, and readable storage medium

Also Published As

Publication number Publication date
CN104780211B (en) 2016-09-07

Similar Documents

Publication Publication Date Title
CN110958118B (en) Certificate authentication management method, device, equipment and computer readable storage medium
WO2020177768A1 (en) Network verification method, apparatus, and system
CN106487743B (en) Method and apparatus for supporting multi-user cluster identity verification
WO2017107732A1 (en) Login status synchronization method and system
CN109560931B (en) Equipment remote upgrading method based on certificate-free system
CN113055867A (en) Method and device for auxiliary network distribution of terminal and electronic equipment
CN105099673A (en) Authorization method, authorization requesting method and devices
CN105187431A (en) Log-in method, server, client and communication system for third party application
CN105141645A (en) Login method of terminal devices, terminal devices and cloud server
CN111884811B (en) Block chain-based data evidence storing method and data evidence storing platform
CN110944319B (en) 5G communication identity verification method, equipment and storage medium
CN105635062A (en) Network access equipment verification method and device
CN104660397A (en) Secret key managing method and system
CN114531254B (en) Authentication information acquisition method and device, related equipment and storage medium
CN107707562B (en) Method and device for encrypting and decrypting algorithm of asymmetric dynamic token
CN104144167A (en) User login authentication method of open intelligent gateway platform
CN104168304A (en) System and method for single-sign-on in virtual desktop infrastructure environment
CN104780211A (en) Data synchronization method and device
CN104935435A (en) Login methods, terminal and application server
CN113132977A (en) Network distribution method, network distribution system and computer readable storage medium
WO2019019593A1 (en) Stateless communication security signature method, terminal and server end
CN112533211A (en) Certificate updating method and system for eSIM card and storage medium
CN111405016B (en) User information acquisition method and related equipment
CN102970308A (en) User authentication method and server
US20230164131A1 (en) Accessing cloud data providers with user-impersonation

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant