CN107592199A - A kind of method and system of data syn-chronization - Google Patents

A kind of method and system of data syn-chronization Download PDF

Info

Publication number
CN107592199A
CN107592199A CN201710764065.7A CN201710764065A CN107592199A CN 107592199 A CN107592199 A CN 107592199A CN 201710764065 A CN201710764065 A CN 201710764065A CN 107592199 A CN107592199 A CN 107592199A
Authority
CN
China
Prior art keywords
key
business
service
synchronous
sent
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
CN201710764065.7A
Other languages
Chinese (zh)
Other versions
CN107592199B (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 QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and 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 QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201710764065.7A priority Critical patent/CN107592199B/en
Publication of CN107592199A publication Critical patent/CN107592199A/en
Application granted granted Critical
Publication of CN107592199B publication Critical patent/CN107592199B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiments of the invention provide a kind of method and system of data syn-chronization, it is related to field of computer technology.The method of data synchronization is applied to the synchronous service end of operation in the server, including:The key request that sync client is sent is received, wherein, sync client is arranged on business machine;According to the key request, the first key of the server is obtained;The first key is sent to the sync client, wherein, the sync client is used to provide the second key to the business machine according to the first key.The embodiment of the present invention is after sync client startup, key newest in server can be actively obtained to synchronous service end, solve the problems, such as that the key of the server and business machine caused by the failure of server active push key is inconsistent, ensure the reliability of key synchronization renewal.

Description

A kind of method and system of data syn-chronization
Technical field
The present invention relates to field of computer technology, method and a kind of data syn-chronization more particularly to a kind of data syn-chronization System.
Background technology
In WWW (Web) application, in order to identify normal user's request and steal chain behavior, general requesting party can add Token (token) information is in the request.To use Message Digest Algorithm 5 (Message Digest Algorithm MD5 exemplified by) cipher mode draws token, the token can include specification agreement parameter item and private key.Specifically, requesting party can A token information token is drawn in a manner of using MD5, and token information token can be added in request, is sent To service end.Service end upon receiving a request, identical md5 encryption mode can be used to draw a new token information new_ Token, and may determine that whether the new token information new_token is equal with the token in request, if equal, i.e., please The private key for the side of asking is consistent with the private key of service end, then it is assumed that the request is legitimate request;If unequal, i.e. the private key of requesting party It is inconsistent with the private key of service end, then it is assumed that the request is illegal request.Obviously, private key uniformity is vital.
It is other in order to improve system safety strategy in actual distribution formula operation system, prevent someone's malicious attack from colliding private key, Private key can be updated with the fixed cycle, and with document form storage on the server.In the conventional renewal method of synchronization, generally before this By a central server, private key, while maintenance service machine list are periodically generated.When discovery private key has renewal, the center takes Being engaged in device can be with all business machine on file mode synchronized update private key to business machine list.But this renewal synchronization side Formula is under the factors such as unstable networks, it is difficult to ensure that private key renewal is arrived into target machine, the target machine is to need to update The business machine of private key.
The content of the invention
In view of the above problems, it is proposed that the embodiment of the present invention overcomes above mentioned problem or at least in part to provide one kind The device of the method for the inter-system data synchronization to solve the above problems and corresponding inter-system data synchronization.
In order to solve the above problems, the embodiment of the invention discloses a kind of method of data synchronization, is serviced applied to operating in Synchronous service end in device, including:
The key request that sync client is sent is received, wherein, the sync client is arranged on business machine;
According to the key request, the first key of the server is obtained;
The first key is sent to the sync client, wherein, the sync client is used for according to described the One key provides the second key to the business machine.
Alternatively, methods described also includes:
The business service heartbeat packet that sync client is sent is received, the business service heartbeat packet carries business service letter Breath;
According to the business service heartbeat packet, update the first key and correspond to default agent list information;
Object synchronization client is determined according to the agent list information;
When detecting the first key change, more new key, described more Xinmi City are sent to the object synchronization client Key is the first key after change.
Alternatively, it is described according to the business service heartbeat packet, update the first key and correspond to default agent list letter Breath, including:
Record and the time is received corresponding to the business service heartbeat packet;
Detect the first key and correspond to default agent list information and whether there is the business service information;
If the business service information is not present, the business service information and the reception time are added to described In agent list information, wherein the reception time is as renewal time corresponding to the business service information;
If the business service information be present, when will receive the time as being updated corresponding to the business service information Between, and update into the agent list information.
Alternatively, it is described to determine object synchronization client according to the agent list information, including:
According to the renewal time, detecting sync client corresponding to each business service information in the agent list information is No is offline synchronization client;
If so, business service information corresponding to the offline synchronization client is then deleted from the agent list information.
Alternatively, second key includes the first key or remote cipher key, and the remote cipher key is the synchronization Client generates according to the first key, it is described determine object synchronization client according to the agent list information after, also Including:
After remote cipher key is received, judge whether the remote cipher key is correct, the remote cipher key is the synchronous visitor What family end provided;
When the remote cipher key is incorrect, the more new key is sent to the object synchronization client, to trigger Object synchronization client is stated to be corrected the remote cipher key.
The embodiment of the invention also discloses a kind of method of data synchronization, applied to the sync client in business machine End, methods described include:
Key request is sent to synchronous service end, it is first close to be used for that transmission server to provide for the synchronous service end Key;
Receive the synchronous service end and be directed to the first key that the key request returns;
According to the first key the second key is provided to business machine.
Alternatively, methods described also includes:
Business service heartbeat packet is sent to the synchronous service end, to trigger the synchronous service end renewal agent list letter Breath, the business service heartbeat packet carry business service information, and the agent list information is used for synchronous service end described the More new key is sent after one cipher key change, the more new key is the first key after change;
Receive the more new key that the synchronous service end is sent;
Using the more new key, second key is updated.
Alternatively, it is described to provide the second key to the business machine according to the first key, including:
The first key received is stored, generates corresponding remote cipher key;
Using the first key as the second key, there is provided to the business machine.
Alternatively, in addition to:
The remote cipher key is supplied to the synchronous service end, with trigger the synchronous service end judge it is described long-range close Whether key is correct;
When the remote cipher key is incorrect, the more new key sent according to the synchronous service end is corrected to described, The more new key is the first key after change.
The embodiment of the invention also discloses a kind of data synchronous system, the system includes sync client and synchronous service End, wherein:
Run in the server, for the first key of the server to be sent into the synchronization at the synchronous service end Client;
The sync client is arranged in business machine, for being communicated with the synchronous service end, and according to institute State first key and provide the second key to the business machine, second key packet contains remote cipher key or first key, described Remote cipher key is according to first key generation.
The embodiment of the present invention includes advantages below:
, in sync client (RsyncClient) upon actuation, can be actively to synchronous service by the embodiment of the present invention (RsyncServer) is held to obtain key newest in server, so as to avoid the failure of server active push key from being led The problem of causing the key of server and business machine inconsistent, ensure the reliability of key synchronization renewal.
In addition, server can receive AppServer by RsyncServer sends business service heartbeat packet, and can root According to the automatic management service list of the business service heartbeat packet, i.e., need not manually machine maintenance list, such as in upper offline expansion When holding service simultaneously, it is not necessary to add key to dilatation machine, it is not necessary to manual intervention, alleviate operation maintenance cost, reduce Error probability has been seen, has serviced safety and reliability.
To sum up, the embodiment of the present invention can use push (push) and pull (pull) bi-directional mechanism, substantially increase close Key synchronization dependability;And can be by RsyncServer and RsyncClient, the automatic correctness for monitoring remote cipher key, solution The problem of existing central server of having determined can not monitor private key correctness automatically.
Brief description of the drawings
Fig. 1 is a kind of structured flowchart of data synchronous system embodiment of the present invention;
Fig. 2 is a kind of step flow chart of method of data synchronization synchronous service side embodiment of the present invention;
Fig. 3 is a kind of step flow of method of data synchronization sync client side embodiment of the present invention;
Fig. 4 is a kind of step flow chart of method of data synchronization alternative embodiment of the present invention;
Fig. 5 is the step flow that data synchronous system in an optional implementation of the invention monitors key correctness automatically Figure;
Fig. 6 is the schematic diagram interacted between the RsyncServer in an example of the present invention and RsyncClient.
Embodiment
In order to facilitate the understanding of the purposes, features and advantages of the present invention, it is below in conjunction with the accompanying drawings and specific real Applying mode, the present invention is further detailed explanation.
In existing synchronized update flow, central server to each business machine with file mode synchronized update private key, It is low using active push mode, renewal reliability.
One of the core concepts of the embodiments of the present invention is that central server can be no longer with file to each business machine Mode synchronized update key, but by independently going out synchronous service end (RsyncServer) and sync client (RsyncClient) it is responsible for all management related to key, to improve the reliability of key synchronization renewal.
As the application of the present invention, sync client and synchronous service end can be based on, forms a data syn-chronization System.The data synchronous system can be used for updating the key synchronization of server into business machine, with ensure server with Cipher consistency between business machine.It should be noted that key can include the private key that server automatically generates, the present invention Embodiment is not restricted to this.
Reference picture 1, show a kind of structured flowchart of data synchronous system embodiment of the present invention.
In embodiments of the present invention, data synchronous system can specifically include:Synchronous service end 101 and sync client 102.Wherein, synchronous service end 101 may operate in server, described same for the first key of the server to be sent to Walk client 102;Sync client 102 may be mounted in business machine, for being communicated with synchronous service end 101, and According to the first key the second key can be provided to the business machine.Second key can be used for business machine and be added It is close, it can specifically include remote cipher key or first key.The remote cipher key can be according to the first key generation received.
Wherein, first key can include referring to the key in server, the key automatically generated such as server;Remote cipher key Local key can be stored in including sync client, such as can be using the local key of document form storage, the present invention Embodiment is not restricted to this.
It should be noted that in order to distinguish the key in the embodiment of the present invention, the embodiment of the present invention will be close in server Key is referred to as first key, and the key in business machine is referred to as into the second key.Wherein, first key and the content of the second key Can be with identical.
In embodiments of the present invention, key request actively can be sent to synchronous service end by sync client, so as to So that the synchronous service end obtains the key in server for the key request, and sync client is fed back to, and then can be with It is supplied to business personnel's machine to use the key by the sync client, i.e., central server and business machine is updated into private key Synchronous documents mode be converted into synchronous service end and sync client service between calling, improve key synchronization reliability.
Reference picture 2, a kind of step flow chart of method of data synchronization synchronous service side embodiment of the present invention is shown, Specifically it may include steps of:
Step 201, the key request that sync client is sent is received, wherein, the sync client is arranged on kiosk Device.
In embodiments of the present invention, after business machine startup, RsyncClient can be called, passes through the RsyncClient Key request is sent to RsyncServe, so that RsyncServe can receive key request.Key request can be used In the key that acquisition request server is newest.
Step 202, according to the key request, the first key of server is obtained.
Step 203, the first key is sent to the sync client, wherein, the sync client be used for according to According to the first key the second key is provided to the business machine.
RsyncServe can be disposed in the server, after key request is received, can be obtained for the key request The key that server is newest is taken, as first key;And the first key can be sent to RsyncClient so that should RsyncClient can receive the first key.
In embodiments of the present invention, synchronous service end in the server is run after key request is received, can be with pin Key in server is obtained to the key request, and is sent to sync client, so that being mounted with sync client Business machine can actively obtain key newest in server by the sync client to synchronous service end, so as to The problem of avoiding the key of the server and business machine caused by the failure of server active push key inconsistent, ensures key The reliability of synchronized update.
Reference picture 3, a kind of step flow chart of method of data synchronization sync client side embodiment of the present invention is shown, Specifically it may include steps of:
Step 301, key request is sent to synchronous service end, the synchronous service end is used for what transmission server provided First key.
In embodiments of the present invention, RsyncClient actively can send key request to RsyncServe, be obtained with request The newest private key for taking server to provide.
Step 302, receive the synchronous service end and be directed to the first key that the key request returns.
Step 303, the second key is provided to business machine according to the first key.
After the first key transmitted by RsyncServe is received, RsyncClient can be carried out to the first key Storage, as remote cipher key;And can be using the first key and/or remote cipher key as the second key, there is provided to kiosk Device so that business machine can be encrypted according to second key.For example, in the case of network is normal, RsyncClient Using the first key received as the second key business machine can be supplied to use;And can be close by receive first Key is stored as remote cipher key, so that in the case of Network Abnormal, business machine is supplied to using the remote cipher key as the second key Use.
By the embodiment of the present invention, RsyncClient upon actuation, actively can obtain server to RsyncServer In newest key, so as to avoid the key of server caused by the failure of server active push key and business machine not The problem of consistent, ensure the reliability of key synchronization renewal.
It is described close to business machine offer second according to the first key in the optional implementation of the present invention Key, it can include:The first key received is stored, generates corresponding remote cipher key;Using the first key as Two keys, there is provided to the business machine.
The present invention implement in, alternatively, RsyncClient can with file mode by the key storage in the machine, That is remote cipher key corresponding to generation, so as to which when obtaining the key failure of server, the remote cipher key is supplied into business Server so that service server can be encrypted using the remote cipher key.
As the example of the present invention, RsyncServer may operate on central server, and RsyncClient can be with It is embedded into the application service (AppServer) on business machine (APPHost), all pipes related to private key can be responsible for Reason.Wherein, RsyncServer can be used for being responsible for the private key change for monitoring server, and can change in the private key of server Afterwards, the newest private key after change is pushed to RsyncClient, with by the RsyncClient that newest private key is synchronous more Newly arrive business machine.
In this example, RsyncServer can note from the reliable coordination system (Zookeeper) of trend distributed system Volume, for facilitating AppServer to find the RsyncServer automatically.
After AppServer starts, can according to the registered address in Zookeeper, by RsyncClient, to RsyncServer sends heartbeat packet with fixed frequency.The heartbeat packet can include business service information, be properly termed as business clothes again Business heartbeat packet.The business service information is determined for business service, such as can be host:Port, wherein, host can be used In host identification, port can be used to indicate that interface identifier.
The heartbeat packet that RsyncServer can come up according to submission, automatic management service list.Specifically, RsyncServer can be in units of service corresponding to business service heartbeat packet, such as with host:Port is unit, to receiving Business service heartbeat packet recorded, service list corresponding to formation.When the private key of central server has change, RsyncServer in units of service, newest private key can be pushed to AppServer according to service list.If push is lost Lose, then can be with alarm prompt.
To sum up, after central server updates private key, RsyncServer can will more according to the service list safeguarded automatically Private key after new is pushed to RsyncClient, so as to be updated by the AppServer embedded by the RsyncClient Private key afterwards is supplied to business machine, realizes private key synchronized update.
It can be seen that using the embodiment of the present invention, the synchronous documents mode of central server and business machine renewal private key can be with The calling being converted between RsyncServer and AppServer services.The present invention implements that push (push) can be used and pulled (pull) bi-directional mechanism, key synchronization reliability is substantially increased.
Reference picture 4, a kind of step flow chart of method of data synchronization alternative embodiment of the present invention is shown, specifically can be with Comprise the following steps:
Step 401, sync client sends business service heartbeat packet to the synchronous service end, to trigger the synchronous clothes Business end renewal agent list information.
Wherein, the business service heartbeat packet can carry business service information.
Step 402, synchronous service end receives the business service heartbeat packet that sync client is sent.
Step 403, synchronous service end updates the first key and corresponds to default clothes according to the business service heartbeat packet Business table information.
Wherein, the agent list information can include business service information that the business service heartbeat packet that receives carries and right The renewal time answered, it such as can be used for generating service list.
In the optional implementation of the present invention, above-mentioned steps 403, following sub-step can be included:
Sub-step 4031, record and the time is received corresponding to the business service heartbeat packet;
Sub-step 4032, detect the first key and correspond to default agent list information with the presence or absence of business service letter Breath;
Sub-step 4033, if the business service information is not present, during by the business service information and the reception Between be added in the agent list information, wherein it is described reception the time as renewal time corresponding to the business service information;
Sub-step 4034, if the business service information be present, the time will be received as the business service information pair The renewal time answered, and update into the agent list information.
Step 404, synchronous service end determines object synchronization client according to the agent list information.
Specifically, agent list information can be used for synchronous service end sends more new key after first key change, The more new key can be the first key after change.Object synchronization client can be used for sign, and to be currently needed for synchronized update close The sync client of key, the on-line synchronous client determined according to the agent list information can be included, the embodiment of the present invention is to this It is not restricted.
In the optional implementation of the present invention, above-mentioned steps 404 can include:According to the renewal time, institute is detected State whether sync client corresponding to each business service information in agent list information is offline synchronization client;If so, then from institute State and business service information corresponding to the offline synchronization client is deleted in agent list information;If it is not, i.e. business service information pair The sync client answered is on-line synchronous client, then on-line synchronous client can be defined as to object synchronization client.
As the example of the present invention, if it find that coming from new business services heartbeat packet, then synchronous service end can be certainly It is dynamic that service corresponding to the new business services heartbeat packet is added to service list;If it find that the business service heart corresponding to certain service Jump bag do not received long very much away from last time, as business service heartbeat packet the reception time not preset the stand-by period in update, then Synchronous service end can extract this service from service list automatically, solve to close caused by offline client transmission key The problem of key renewal failure, the reliability of key updating is improved, realizes automatic management service list.
Step 405, when detecting the first key change, synchronous service end is sent more to the object synchronization client New key.
Step 406, sync client receives the more new key that the synchronous service end is sent.
Step 407, more new key described in sync client use, is updated to second key.
It can be seen that whether the key that the embodiment of the present invention can monitor server by RsyncServer changes;If hair Changing, then, according to the agent list information safeguarded automatically, the key updating after change can be arrived by the RsyncServer In business machine corresponding to each RsyncClient, server and the cipher consistency in business machine ensure that.
By the embodiment of the present invention, server can receive AppServer by RsyncServer and send the business service heart Jump bag, and can according to the automatic management service list of the business service heartbeat packet, i.e., need not manually machine maintenance list, such as In upper offline dilatation service, it is not necessary to add key to dilatation machine, it is not necessary to manual intervention, alleviate operation maintenance into This, while reduce and seen error probability, service safety and reliability.
In embodiments of the present invention, optionally, synchronous service end is determining object synchronization visitor according to the agent list information After the end of family, can automatically monitoring objective sync client provide remote cipher key correctness, to ensure object synchronization client The uniformity of the first key of the remote cipher key provided and server is provided.
Reference picture 5, show that the data synchronous system in an optional implementation of the invention monitors key correctness automatically Flow chart of steps, specifically it may include steps of:
Step 501, the remote cipher key is supplied to the synchronous service end by sync client, to trigger the synchronous clothes Business end judges whether the remote cipher key is correct.
Step 502, synchronous service end judges whether the remote cipher key is correct after remote cipher key is received, described remote Journey key is what the sync client provided.
Step 503, when remote cipher key is incorrect, the more new key is sent to the object synchronization visitor by synchronous service end Family end, the remote cipher key is corrected with triggering the object synchronization client.
Step 504, sync client is corrected according to the more new key that the synchronous service end is sent to described, described More new key is the first key after change.
For example, RsyncServer detects the long-range private key in service list according to some cycles, such as can be with every 10 minutes Detect the long-range private key in service list, to determine whether remote cipher key is consistent with the private key of central server, its medium-long range Private key can be provided by RsyncClient.If it find that when the private key of long-range private key and central server is inconsistent, can alert Prompting.
The embodiment of the present invention can be monitored private key correctness automatically, be solved by RsyncServer and RsyncClient The problem of existing central server can not monitor private key correctness automatically.
It should be noted that for embodiment of the method, in order to be briefly described, therefore it is all expressed as to a series of action group Close, but those skilled in the art should know, the embodiment of the present invention is not limited by described sequence of movement, because according to According to the embodiment of the present invention, some steps can use other orders or carry out simultaneously.Secondly, those skilled in the art also should Know, embodiment described in this description belongs to preferred embodiment, and the involved action not necessarily present invention is implemented Necessary to example.
In an alternate embodiment of the present invention where, the synchronous service end can include detection module and update module; Whether the detection module, the first key that can be used for detecting the server change;The update module, Ke Yiyong In when the detection module detects that first key changes, the first key after change is sent to the sync client End, renewal operation is performed to trigger the sync client, the renewal operation includes the operation for updating remote cipher key.
In the present invention is implemented, optionally, synchronous service end can also include:Service list management module.The service It list block, can be used for the business service heartbeat packet sent according to the sync client, determine to take corresponding to first key Business table information.Update module, it specifically can be used for the sync client corresponding to each business service heartbeat packet into agent list information First key after push change.
In an alternate embodiment of the present invention where, synchronous service end can also include:Monitoring module.Monitoring module can be with After remote cipher key is received, judge whether the remote cipher key is correct, the remote cipher key provides for object synchronization client 's.Synchronous service end be able to will update when monitoring module detects that the remote cipher key that object synchronization client provides is incorrect Key is sent to the object synchronization client, and the remote cipher key is corrected with triggering the object synchronization client. For example, monitoring module, can be used for the correctness for detecting institute's remote cipher key, and can be inconsistent with first key in remote cipher key Shi Jinhang warning prompts.
In an alternate embodiment of the present invention where, sync client can include heartbeat module and key management module. Wherein, the heartbeat module, for sending business service heartbeat packet to the synchronous service end, the business service heartbeat packet can be with Carry business service information;The key management module, it can be used for receiving the first key transmitted by synchronous service end, and And first key can be stored, corresponding remote cipher key is generated, and the remote cipher key can be supplied to synchronous service End.
In an alternate embodiment of the present invention where, sync client can include service discovery module.The service discovery Module, the second key is provided to business machine for searching available service, and according to the service found.
Reference picture 6, show and interacted between the RsyncServer in an example of the present invention and RsyncClient Schematic diagram.
In this example, data synchronous system can be included comprising RsyncServer, RsyncClient and private key generation Service end.Wherein, RsyncServer can be deployed on central server (CenterHost), be can be used for automatic safeguard and taken Business list, push private key and the long-range private key of monitoring;RsyncClient can not independent operating when, can be embedded in a manner of plug-in unit In application service AppServer on to business machine, for find RsyncServer addresss of service, management service private key with And send business service heartbeat packet to RsyncServer;Private key generation service end can be used for periodically being pushed to new private key In cloud storage service, as shown in fig. 6, can be by the key deposit cloud storage of the server of generation, the embodiment of the present invention is to this It is not restricted.
Specifically, RsyncServer can note from the reliable coordination system (Zookeeper) of trend distributed system Volume.RsyncClient can obtain available service (Server) address from Zookeeper, with according to the service got Address is established with RsyncServer and communicated to connect;And the heart can be sent to RsyncServer according to the address of service got Jump bag.
After RsyncClient and RsyncServe establishes communication connection, RsyncClient can obtain from RsyncServe Newest private key is taken, and can be by the newest key storage got into business machine.Certainly, RsyncServe can also be led Trend RsyncClient pushes newest private key, and this example is not restricted to this.
In addition, RsyncServe can monitor correctness of each APPServer by the RsyncClient private keys stored, Solve the problems, such as that existing central server can not monitor private key correctness automatically.
It should be noted that RsyncServe can such as be used main (Master) by using two kinds of mode of operations Pattern and from (Slave) mode of operation, to improve service reliability.As shown in fig. 6, RsyncServer can be divided into main synchronization Service end (RsyncServer Master) and from synchronous service end (RsyncServer Slave).RsyncServer Master and RsyncServer Slave can detect the private key of shared storage (Share Disk).
In this example, alternatively, RsyncServer can include detection module, update module, service list management mould Block, monitoring module.
Detection module, change available for automatic detection private key.For example, detection module can be become with private key of detection per second Change;If this time detection content and last time content are inconsistent, it is considered that private key has renewal, update module can be used;If Content is consistent, then can continue to detect next time.The detection cycle of detection module can be set according to actual conditions, such as work as private key When changing one time within one day, detection cycle be could be arranged to once a day, and the embodiment of the present invention is not restricted to this.
Update module, the service that can be used for into service list push new private key.Surpass for example, update module can use Text transfer protocol (HyperText Transfer Protocol, HTTP), AppServer is pushed to by newest private key, and Specific renewal operation can be performed by the RsyncClient in AppServer.If it is pushed to corresponding to certain service AppServer fails, and can retry 3 times and be pushed, and can be after 3 push failures, alarm prompt.
Service list management module, it can be used for being responsible for automatic management service list, the service list can be stored in clothes It is engaged in device.For example, service list management module can receive the business service heart sent from RsyncClient with fixed frequency Bag is jumped, the business service heartbeat packet can include host and port information.Each of service list can include business service Host, port and corresponding renewal time.When receiving business service heartbeat packet, service list management module, which can perform, to be sentenced The step of disconnected logic;If host:In the existing service lists of port, then its corresponding renewal time can be only updated;If host:Port is not present in service list, then can be added in service list.In addition, service list management module can also Each business service host in service list of inspection per minute:Renewal time corresponding to port.If a certain business service is corresponding Renewal time be more than default time threshold away from present system time, can be true as time threshold could be arranged to 10 minutes This fixed business service has been not present, then the business service can be extractd from service list, the embodiment of the present invention is not restricted to this.
Monitoring module, it is checked for long-range private key correctness.Specifically, monitoring module can be periodically to service list The service corresponding A ppServer of middle record asks long-range private key, and can provide branch by Private key management module in RsyncClient Hold.If it find that the private key of long-range private key and central server that Private key management module provides is inconsistent in RsyncClient, then Can be with alarm prompt.
To sum up, RsyncServer can use Master/Slave mode of operations, greatly improve as core middleware Service reliability, so as to ensure that synchronous private key is safe and reliable.
It should be noted that the RsyncClient during the present invention is implemented can start under two patterns:One kind is online Pattern, AppServer every time start after, can by RsyncClient to the newest private key of RsyncServer acquisition requests, and Business service heartbeat packet (HeartBeat) can be sent, the line model can be normal mode of operation;Another kind is offline mould Formula, RsyncClient in AppServer can not be to the newest private keys of RsyncServer acquisition requests, can not also be to RsyncServer sends business service heartbeat packet, and the remote cipher key being locally stored can be supplied into AppServer, should Off-line mode can be network is extremely unstable or debugging enironment under use.
Optionally, RsyncClient can mainly include service discovery module, heartbeat module and Private key management module.
Service discovery module can be used for searching available service on Zookeeper.For example, AppServer starts initially After changing RsyncClient, the service discovery module can search registered address of service on Zookeeper automatically, and can be with The service of RsyncServer Master and RsyncServer Slave offers is provided.
Optionally, in default situations, RsyncClient preferentially can communicate with RsyncServer Master, if Communicate failure with RsyncServer Master, can automatically switch to RsyncServerSlave and be communicated, so as to Ensure RsyncServer service reliability, the problem of avoiding the occurrence of Single Point of Faliure.
Heartbeat module can be used for sending the business service heart to RsyncServer Master or RsyncServer Slave Bag is jumped, host and port information is included in business service heartbeat packet, so as to realize the automatic management service row of RsyncServer Table.For example, heartbeat module, if sending failure, can be retried to send three times and be somebody's turn to do with transmission business service heartbeat packet per minute Business service heartbeat packet.If heartbeat module sent business service heartbeat packet to RsyncServer not successfully more than 10 minutes, Business service information corresponding to the service heartbeat packet is possible to be extractd from service list by RsyncServer, and can send Warning information.
Private key management module can be used for being responsible for transmitting private key with RsyncServer, and can localize storage private key.Tool Body, in order to ensure private key uniformity, exclusion machine, dilatation etc. of delaying leads to not normal synchronized situation, starts in AppServer Afterwards, Private key management module can actively ask newest private key to RsyncServer, and can be stored with document form to local Machine, native file private key is formed, that is, forms the remote cipher key being locally stored.When asking newest private key to RsyncServer The number continuously to fail reaches default frequency of failure threshold value, and such as after the number that private key continuously fails reaches 3 times, can give tacit consent to makes AppServer is supplied to the remote cipher key being locally stored.
It can be seen that RsyncClient employs push and pull bi-directional mechanisms, synchronization dependability is substantially increased;And can Private key content interface is inquired about to provide, facilitates the local private key correctness of RsyncServer remote monitorings.
, can be by agent list information that RsyncServe is safeguarded automatically in this example;But and the agent list information, will change Key updating afterwards updates remote cipher key, and can be stored according to business service to each AppServer by RsyncClient On business machine, server and the cipher consistency in business machine ensure that.
For device embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, it is related Part illustrates referring to the part of embodiment of the method.
Each embodiment in this specification is described by the way of progressive, what each embodiment stressed be with The difference of other embodiment, between each embodiment identical similar part mutually referring to.
It should be understood by those skilled in the art that, the embodiment of the embodiment of the present invention can be provided as method, apparatus or calculate Machine program product.Therefore, the embodiment of the present invention can use complete hardware embodiment, complete software embodiment or combine software and The form of the embodiment of hardware aspect.Moreover, the embodiment of the present invention can use one or more wherein include computer can With in the computer-usable storage medium (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.) of program code The form of the computer program product of implementation.
The embodiment of the present invention is with reference to method according to embodiments of the present invention, terminal device (system) and computer program The flow chart and/or block diagram of product describes.It should be understood that can be by computer program instructions implementation process figure and/or block diagram In each flow and/or square frame and the flow in flow chart and/or block diagram and/or the combination of square frame.These can be provided Computer program instructions are set to all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing terminals Standby processor is to produce a machine so that is held by the processor of computer or other programmable data processing terminal equipments Capable instruction is produced for realizing in one flow of flow chart or multiple flows and/or one square frame of block diagram or multiple square frames The device for the function of specifying.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing terminal equipments In the computer-readable memory to work in a specific way so that the instruction being stored in the computer-readable memory produces bag The manufacture of command device is included, the command device is realized in one flow of flow chart or multiple flows and/or one side of block diagram The function of being specified in frame or multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing terminal equipments so that Series of operation steps is performed on computer or other programmable terminal equipments to produce computer implemented processing, so that The instruction performed on computer or other programmable terminal equipments is provided for realizing in one flow of flow chart or multiple flows And/or specified in one square frame of block diagram or multiple square frames function the step of.
Although having been described for the preferred embodiment of the embodiment of the present invention, those skilled in the art once know base This creative concept, then other change and modification can be made to these embodiments.So appended claims are intended to be construed to Including preferred embodiment and fall into having altered and changing for range of embodiment of the invention.
Finally, it is to be noted that, herein, such as first and second or the like relational terms be used merely to by One entity or operation make a distinction with another entity or operation, and not necessarily require or imply these entities or operation Between any this actual relation or order be present.Moreover, term " comprising ", "comprising" or its any other variant meaning Covering including for nonexcludability, so that process, method, article or terminal device including a series of elements are not only wrapped Those key elements, but also the other element including being not expressly set out are included, or is also included for this process, method, article Or the key element that terminal device is intrinsic.In the absence of more restrictions, wanted by what sentence "including a ..." limited Element, it is not excluded that other identical element in the process including the key element, method, article or terminal device also be present.
Method to a kind of data syn-chronization provided by the present invention and a kind of system of data syn-chronization above, carry out in detail Introduce, specific case used herein is set forth to the principle and embodiment of the present invention, the explanation of above example It is only intended to help the method and its core concept for understanding the present invention;Meanwhile for those of ordinary skill in the art, according to this The thought of invention, there will be changes in specific embodiments and applications, in summary, this specification content should It is interpreted as limitation of the present invention.

Claims (10)

1. a kind of method of data synchronization, it is characterised in that applied to the synchronous service end of operation in the server, methods described bag Include:
The key request that sync client is sent is received, wherein, the sync client is arranged on business machine;
According to the key request, the first key of the server is obtained;
The first key is sent to the sync client, wherein, the sync client is used for close according to described first Key provides the second key to the business machine.
2. according to the method for claim 1, it is characterised in that methods described also includes:
The business service heartbeat packet that sync client is sent is received, the business service heartbeat packet carries business service information;
According to the business service heartbeat packet, update the first key and correspond to default agent list information;
Object synchronization client is determined according to the agent list information;
When detecting the first key change, more new key is sent to the object synchronization client, the more new key is First key after change.
3. according to the method for claim 2, it is characterised in that it is described according to the business service heartbeat packet, described in renewal First key corresponds to default agent list information, including:
Record and the time is received corresponding to the business service heartbeat packet;
Detect the first key and correspond to default agent list information and whether there is the business service information;
If the business service information is not present, the business service information and the reception time are added to the service In table information, wherein the reception time is as renewal time corresponding to the business service information;
If the business service information be present, the time will be received as renewal time corresponding to the business service information, and Update in the agent list information.
4. according to the method for claim 3, it is characterised in that described to determine object synchronization visitor according to the agent list information Family end, including:
According to the renewal time, detect in the agent list information sync client corresponding to each business service information whether be Offline synchronization client;
If so, business service information corresponding to the offline synchronization client is then deleted from the agent list information.
5. according to any described method of claim 2 to 4, it is characterised in that second key includes the first key Or remote cipher key, the remote cipher key is what the sync client generated according to the first key, described according to the clothes After business table information determines object synchronization client, in addition to:
After remote cipher key is received, judge whether the remote cipher key is correct, the remote cipher key is the sync client There is provided;
When the remote cipher key is incorrect, the more new key is sent to the object synchronization client, to trigger the mesh Mark sync client is corrected to the remote cipher key.
6. a kind of method of data synchronization, it is characterised in that applied to the sync client in business machine, methods described Including:
Key request is sent to synchronous service end, the synchronous service end is used for the first key that transmission server provides;
Receive the synchronous service end and be directed to the first key that the key request returns;
According to the first key the second key is provided to business machine.
7. according to the method for claim 6, it is characterised in that methods described also includes:
Business service heartbeat packet is sent to the synchronous service end, to trigger the synchronous service end renewal agent list information, institute State business service heartbeat packet and carry business service information, the agent list information is used for synchronous service end in the first key More new key is sent after change, the more new key is the first key after change;
Receive the more new key that the synchronous service end is sent;
Using the more new key, second key is updated.
8. the method according to claim 6 or 7, it is characterised in that it is described according to the first key to the kiosk Device provides the second key, including:
The first key received is stored, generates corresponding remote cipher key;
Using the first key as the second key, there is provided to the business machine.
9. according to the method for claim 8, it is characterised in that also include:
The remote cipher key is supplied to the synchronous service end, judges that the remote cipher key is to trigger the synchronous service end It is no correct;
When the remote cipher key is incorrect, the more new key sent according to the synchronous service end is corrected to described, described More new key is the first key after change.
A kind of 10. data synchronous system, it is characterised in that the system includes sync client and synchronous service end, wherein:
Run in the server, for the first key of the server to be sent into the sync client at the synchronous service end End;
The sync client is arranged in business machine, for being communicated with the synchronous service end, and according to described the One key provides the second key to the business machine, and second key packet contains remote cipher key or first key, described long-range Key is according to first key generation.
CN201710764065.7A 2017-08-30 2017-08-30 Data synchronization method and system Active CN107592199B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710764065.7A CN107592199B (en) 2017-08-30 2017-08-30 Data synchronization method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710764065.7A CN107592199B (en) 2017-08-30 2017-08-30 Data synchronization method and system

Publications (2)

Publication Number Publication Date
CN107592199A true CN107592199A (en) 2018-01-16
CN107592199B CN107592199B (en) 2020-04-21

Family

ID=61050579

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710764065.7A Active CN107592199B (en) 2017-08-30 2017-08-30 Data synchronization method and system

Country Status (1)

Country Link
CN (1) CN107592199B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109889336A (en) * 2019-03-08 2019-06-14 浙江齐治科技股份有限公司 A kind of middleware obtains the method, apparatus and system of password
CN110635905A (en) * 2019-09-30 2019-12-31 重庆小雨点小额贷款有限公司 Key management method, related equipment and computer readable storage medium
CN112422475A (en) * 2019-08-20 2021-02-26 阿里巴巴集团控股有限公司 Service authentication method, device, system and storage medium
CN114614985A (en) * 2022-05-12 2022-06-10 施维智能计量系统服务(长沙)有限公司 Communication key updating method, key server and readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020138725A1 (en) * 1997-08-29 2002-09-26 Moses Timothy E. Method and apparatus for obtaining status of public key certificate updates
WO2005078992A1 (en) * 2004-02-09 2005-08-25 Huawei Technologies Co., Ltd. A Method for Implementing Multimedia Broadcast Multicast Service Key Distribution
US20080279387A1 (en) * 2007-05-10 2008-11-13 Computer Associates Think, Inc. Propagating Keys from Servers to Clients
CN102158757A (en) * 2010-02-11 2011-08-17 中兴通讯股份有限公司 Terminal and method for playing television service thereof
CN105391549A (en) * 2015-12-10 2016-03-09 四川长虹电器股份有限公司 Method for realizing communication dynamic keys between client and server
US20160198203A1 (en) * 2011-06-23 2016-07-07 Ericsson Ab Method and System for Secure Over-the-Top Live Video Delivery

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020138725A1 (en) * 1997-08-29 2002-09-26 Moses Timothy E. Method and apparatus for obtaining status of public key certificate updates
WO2005078992A1 (en) * 2004-02-09 2005-08-25 Huawei Technologies Co., Ltd. A Method for Implementing Multimedia Broadcast Multicast Service Key Distribution
US20080279387A1 (en) * 2007-05-10 2008-11-13 Computer Associates Think, Inc. Propagating Keys from Servers to Clients
CN102158757A (en) * 2010-02-11 2011-08-17 中兴通讯股份有限公司 Terminal and method for playing television service thereof
US20160198203A1 (en) * 2011-06-23 2016-07-07 Ericsson Ab Method and System for Secure Over-the-Top Live Video Delivery
CN105391549A (en) * 2015-12-10 2016-03-09 四川长虹电器股份有限公司 Method for realizing communication dynamic keys between client and server

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109889336A (en) * 2019-03-08 2019-06-14 浙江齐治科技股份有限公司 A kind of middleware obtains the method, apparatus and system of password
CN109889336B (en) * 2019-03-08 2022-06-14 浙江齐治科技股份有限公司 Method, device and system for middleware to acquire password
CN112422475A (en) * 2019-08-20 2021-02-26 阿里巴巴集团控股有限公司 Service authentication method, device, system and storage medium
CN112422475B (en) * 2019-08-20 2022-12-09 阿里巴巴(北京)软件服务有限公司 Service authentication method, device, system and storage medium
CN110635905A (en) * 2019-09-30 2019-12-31 重庆小雨点小额贷款有限公司 Key management method, related equipment and computer readable storage medium
CN114614985A (en) * 2022-05-12 2022-06-10 施维智能计量系统服务(长沙)有限公司 Communication key updating method, key server and readable storage medium

Also Published As

Publication number Publication date
CN107592199B (en) 2020-04-21

Similar Documents

Publication Publication Date Title
CN107592199A (en) A kind of method and system of data syn-chronization
EP3490224B1 (en) Data synchronization method and system
CN106331098B (en) Server cluster system
US20200342002A1 (en) Data synchronization in a distributed data storage system
CN103544303B (en) A kind of method of data synchronization, system and equipment
KR101553488B1 (en) Method and apparatus for virtual pairing with a group of semi-connected devices
CN110166562B (en) Data synchronization method and device, storage medium and electronic equipment
WO2009111492A4 (en) Data synchronization protocol
CN104301140B (en) Service request response method, device and system
CN109101196A (en) Host node switching method, device, electronic equipment and computer storage medium
WO2018113543A1 (en) Management method, system, and device for master and standby databases
CN103281356B (en) File distribution method and system
CN104301990B (en) A kind of method and device of data syn-chronization
CN105933467A (en) Client host information change periodic detection method
EP2775675B1 (en) Synchronization method among network devices, network device and system
US20160269335A1 (en) Method and apparatus for identifying changed mailboxes in an internet message access protocol (imap) list
CN107172112B (en) Computer file transmission method and device
JP5558279B2 (en) MONITORING / CONTROL SYSTEM, MONITORING / CONTROL DEVICE USED FOR SAME, AND MONITORING / CONTROL METHOD
CN108009045B (en) Method and device for processing faults of main and standby databases
CN111193585B (en) Communication request management method and device
JP2019533254A (en) Information acquisition
CN110912676A (en) Key management method and system
US9350621B2 (en) Synchronization after restart of a FC switch
JP5685213B2 (en) Differential replication system, master database device, and slave database device
CN114125827A (en) Terminal management method, device and centralized management 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