CN107295031A - A kind of method of data synchronization and device - Google Patents

A kind of method of data synchronization and device Download PDF

Info

Publication number
CN107295031A
CN107295031A CN201610195298.5A CN201610195298A CN107295031A CN 107295031 A CN107295031 A CN 107295031A CN 201610195298 A CN201610195298 A CN 201610195298A CN 107295031 A CN107295031 A CN 107295031A
Authority
CN
China
Prior art keywords
data
service server
type assemblies
distributed type
server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610195298.5A
Other languages
Chinese (zh)
Inventor
贾新禹
马华标
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610195298.5A priority Critical patent/CN107295031A/en
Publication of CN107295031A publication Critical patent/CN107295031A/en
Pending legal-status Critical Current

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
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery

Abstract

This application discloses a kind of method of data synchronization and device.This method includes:After the data that the distributed type assemblies are listened on a service server as eavesdropping target change, data synchronization request is sent to as each service server of eavesdropping target, so that each service server is after the data synchronization request is received, data syn-chronization is carried out by the distributed type assemblies.Therefore solution is solved in the prior art, after service end sets master and slave server, the problem of data syn-chronization between each server relies on master server.

Description

A kind of method of data synchronization and device
Technical field
The application is related to field of computer technology, more particularly to a kind of method of data synchronization and device.
Background technology
With flourishing for Internet technology, people more and more handle various industry by internet Business.During these business processings, service request generally is submitted from user terminal to service end, by servicing Hold come the data produced by carrying out in business processing and record traffic processing procedure.In actual applications, due to Business processing request based on internet is more, it will usually multiple servers are arranged in service end, by these Server carries out business processing.But, it is this by way of multiple servers processing business is asked, lead to The nonsynchronous problem of data can often be run into.For example, user terminal submits the service request for adding good friend to service end, The service request is handled by server A in service end, and records produced in the business procession Data, but the record in server B and server C but not on the business processing.
Prior art is by by the multiple servers of service end, being respectively set to master and slave (Master, Slave) The problem of mode of server is to solve data syn-chronization.This mode is generally by a certain server of service end Other servers outside (Master) server based on setting, the server are set to take from (Slave) Business device, and every is attached with master server respectively from server.When wherein one from server After data update, the data syn-chronization after can this be updated is to master server, then after master server updates this Data syn-chronization to others from server, so as to complete the data syn-chronization between each server.
However, this problem of the prior art is, and after service end is set to master and slave server, each clothes Data synchronization process between business device all relies on master server.When the master server breaks down, generally Each server of service end, which can be caused, can not carry out data syn-chronization.
The content of the invention
The embodiment of the present application provides a kind of method of data synchronization and device, for solving in the prior art, in clothes It is engaged in after the master and slave server of end setting, the problem of data syn-chronization between each server relies on master server.
The embodiment of the present application provides a kind of method of data synchronization, and methods described is used to realize different business server Between data syn-chronization, the service server is connected with distributed type assemblies, and the service server exists in advance Eavesdropping target is registered as in the distributed type assemblies, methods described includes:
When the data that the distributed type assemblies are listened on a service server as eavesdropping target occur After change, data synchronization request is sent to as each service server of eavesdropping target, so as to each business Server carries out data syn-chronization after the data synchronization request is received by the distributed type assemblies.
Preferably, the distributed type assemblies are specially Zookeeper distributed type assemblies;Then,
In the Zookeeper distributed type assemblies, the service server is registered as by following methods Eavesdropping target:
The Zookeeper distributed type assemblies receive the industry for being registered as eavesdropping target that service server is sent Business request;
The Zookeeper distributed type assemblies are generated for monitoring the business service by the service request The monitoring node of device.
Preferably, the Zookeeper distributed type assemblies are listened to as eavesdropping target's by following methods Data on service server change:
Saved when the Zookeeper distributed type assemblies are listened to as the service server of eavesdropping target to monitoring When point carries out data manipulation, determine that the data on the service server change, the data manipulation tool Body is result of the service server according to the data variation on the service server, to described The data manipulation that node is carried out is monitored on Zookeeper distributed type assemblies.
Preferably, the data manipulation is specifically included:Data are write and/or data are deleted.
Preferably, the service server as eavesdropping target carries out the specific bag of data write-in to monitoring node Include:The service server sends the service request for adding distributed lock to the Zookeeper distributed type assemblies, So as to the Zookeeper distributed type assemblies, judged whether according to the use state of the distributed lock can be to The service server adds distributed lock;
After the service server adds distributed lock, data write-in is carried out to the monitoring node.
Preferably, the service server as eavesdropping target carries out the specific bag of data deletion to monitoring node Include:The service server deletes the store path for monitoring data described in node.
Preferably, the distributed type assemblies include at least two sync servers, the sync server and industry The data being engaged between server connection and each sync server can be synchronous;Then,
It is described to be specifically included by distributed type assemblies progress data syn-chronization:By in the distributed type assemblies The sync server being connected with each service server carries out data syn-chronization.
The embodiment of the present application also provides a kind of method of data synchronization, and methods described is used to realize different business service Data syn-chronization between device, the service server is connected with distributed type assemblies, and the service server is advance Eavesdropping target is registered as in the distributed type assemblies, methods described includes:
Data synchronization request is received as each service server of eavesdropping target, the data synchronization request is Data of the distributed type assemblies on the service server listened to as eavesdropping target change Afterwards, to the data synchronization request of each service server transmission as eavesdropping target;
As each service server of eavesdropping target after data synchronization request is received, pass through the distribution Cluster carries out data syn-chronization.
The embodiment of the present application also provides a kind of data synchronization unit, and described device is used to realize different business service Data syn-chronization between device, the service server is connected with distributed type assemblies, and the service server is advance Eavesdropping target is registered as in the distributed type assemblies, described device includes:Monitoring unit and transmitting element, Wherein:
Monitoring unit, is monitored as on each service server of eavesdropping target for the distributed type assemblies Whether data change;
Transmitting element, for listening to a service server as eavesdropping target when the distributed type assemblies On data change after, to as eavesdropping target each service server send data synchronization request, So that each service server is after the data synchronization request is received, line number is entered by the distributed type assemblies According to synchronization.
The embodiment of the present application also provides a kind of data synchronization unit, and described device is used to realize different business service Data syn-chronization between device, the service server is connected with distributed type assemblies, and the service server is advance Eavesdropping target is registered as in the distributed type assemblies, described device includes:Receiving unit and synchronization unit, Wherein:
Receiving unit, data synchronization request is received for each service server as eavesdropping target, described Data synchronization request is the distributed type assemblies on a service server as eavesdropping target is listened to Data change after, to as eavesdropping target each service server transmission data synchronization request;
Synchronization unit, for each service server as eavesdropping target after data synchronization request is received, Data syn-chronization is carried out by the distributed type assemblies.
At least one above-mentioned technical scheme that the embodiment of the present application is used can reach following beneficial effect:
After distributed type assemblies are listened to as the service server of eavesdropping target by carry out data manipulation, to bag Multiple eavesdropping targets transmission data synchronization request including the eavesdropping target is included, to cause each as monitoring The service server of object carries out data syn-chronization after data synchronization request is received by distributed type assemblies.By The data syn-chronization between each service server is realized by way of distributed type assemblies, so may be used in this method To cause, when any one service server breaks down, other service servers are not interfered with Normal work, would not also cause service end because a certain service server break down and can not work Phenomenon.Therefore solution is solved in the prior art, after service end sets master and slave server, each service The problem of data syn-chronization between device relies on master server.
Brief description of the drawings
Accompanying drawing described herein is used for providing further understanding of the present application, constitutes one of the application Point, the schematic description and description of the application is used to explain the application, does not constitute to the application not Work as restriction.In the accompanying drawings:
Fig. 1 is the service server and distributed type assemblies in a kind of practical application that the embodiment of the present application 1 is provided Connected mode schematic diagram;
Fig. 2 implements schematic flow sheet for a kind of method of data synchronization of the offer of the embodiment of the present application 1;
Fig. 3 is the service server and Zookeeper in a kind of practical application that the embodiment of the present application 1 is provided The connected mode schematic diagram of distributed type assemblies;
Fig. 4 is a kind of realization of the method for data synchronization of the offer of the embodiment of the present application 2 under concrete application scene Schematic flow sheet;
Fig. 5 implements schematic flow sheet for a kind of method of data synchronization of the offer of the embodiment of the present application 3;
Fig. 6 is a kind of concrete structure schematic diagram for data synchronization unit that the embodiment of the present application 4 is provided;
Fig. 7 is a kind of concrete structure schematic diagram for data synchronization unit that the embodiment of the present application 5 is provided.
Embodiment
It is specifically real below in conjunction with the application to make the purpose, technical scheme and advantage of the application clearer Apply example and technical scheme is clearly and completely described corresponding accompanying drawing.Obviously, it is described Embodiment is only some embodiments of the present application, rather than whole embodiments.Based on the implementation in the application Example, the every other implementation that those of ordinary skill in the art are obtained under the premise of creative work is not made Example, belongs to the scope of the application protection.
Below in conjunction with accompanying drawing, the technical scheme that each embodiment of the application is provided is described in detail.
Embodiment 1
As described above, current increasing rapidly due to Internet service amount, the service end of Internet service is usual Multiple servers can be arranged, service is provided by these servers.But, these servers of service end Between would ordinarily be encountered the problem of data can not be synchronous.For example, user have sent e-payment to service end Service request, service end would generally distribute corresponding server and the service request is handled, and will processing Data during the service request are recorded, and at this moment do not have the business in other servers of service end The relative recording of processing procedure.
In order to which the data of each server of service end are synchronized, prior art takes one of service end Business device is appointed as master server, and other servers of service end is appointed as from server, and each is from service Device is attached with master server respectively.So, after data manipulation is carried out from server for wherein one, meeting By the data syn-chronization after operation to master server, then by master server by the data syn-chronization to other from service Device, so as to complete the data syn-chronization between each server.For example, carried out from server A after data manipulation, The new data after operating can be synchronized to main server-b, by the main server-b that the new data is synchronous To from server C and D.
However, this problem of the prior art is, the data syn-chronization between the server of each in service end according to Rely in master server.When the master server breaks down, it will usually cause each server of service end can not Carry out data syn-chronization.For example, in above-mentioned example, when main server-b breaks down, from server A New data after operation can not be synchronized to from server C and D by main server-b.In addition, in reality In, when portfolio is larger, each data syn-chronization between server of service end is very frequent, this Sample would generally cause master server to bear huge computing pressure, so as to cause master server event easily occur Barrier.
Embodiment 1 provides a kind of method of data synchronization, for solve in the prior art service end set it is main, After server, the problem of data syn-chronization between each server relies on master server.It should be noted that It can be realized by this method in service end, the data syn-chronization between different business server, the business clothes Business device be connected with distributed type assemblies, connected mode can as shown in Figure 1 (in Fig. 1, service server 1, Service server 2, service server n refer to different service servers respectively).The method of data synchronization Idiographic flow schematic diagram is as shown in Fig. 2 comprise the steps:
Step S11:Each service server is registered as eavesdropping target respectively in distributed type assemblies in advance.
Herein, service server refers in service end, the server of the business for handling user terminal submission. For example, user terminal (can be mobile phone, PC etc.) submitted to service end can in service request, service end The server for handling the service request is exactly described service server.It is larger in portfolio in practical application In the case of, generally for the efficiency for accelerating business processing, many service servers can be arranged in service end, These business concurrently and/or are concurrently handled by this many service servers.It should be noted that here The business to service server processing does not make restriction, that is to say, that the business of service server processing can Think payment transaction, or instant messaging business, or other business.
Distributed type assemblies are commonly used for managing the data syn-chronization between each service server, namely pass through this Distributed type assemblies can be managed to the data syn-chronization between each service server.In actual applications, lead to Distributed application program can be often installed in distributed type assemblies, pass through installed distributed application program come Manage the data syn-chronization between each service server.Such distributed application program can generally have a variety of, Such as a kind of preferred scheme is Chubby distributed application programs, and another preferred scheme is Zookeeper distributed application programs.For the ease of reading and writing, by Zookeeper in the application is follow-up Distributed application program is referred to as Zookeeper, and Chubby distributed application programs are referred to as into Chubby, The distributed type assemblies for being mounted with Zookeeper distributed application programs are referred to as Zookeeper distribution collection The distributed type assemblies for being mounted with Chubby distributed application programs are referred to as Chubby distribution collection by group Group.Wherein, Zookeeper is one distributed, the distributed application program of open source code, the application Program can be that distributed type assemblies application provide the software of Consistency service, using the teaching of the invention it is possible to provide function include:Match somebody with somebody Put maintenance, domain name service, distributed type assemblies data syn-chronization, group service etc..
In addition, service server is registered as after eavesdropping target in distributed type assemblies, the distributed type assemblies energy Whether the data enough listened on the service server change, and can be sent to the service server Service request.
According to the difference of distributed type assemblies, service server is registered as eavesdropping target's in distributed type assemblies Mode can also be different.
A kind of preferred scheme is, when the distributed type assemblies are specially Zookeeper distributed type assemblies, institute Stating service server can be distributed in the Zookeeper in advance by following step S111 and step S112 Eavesdropping target is registered as in formula cluster:
Step S111:What the Zookeeper distributed type assemblies reception service server was sent is registered as prison Listen the service request of object;
Step S112:The Zookeeper distributed type assemblies are generated described for supervising by the service request The monitoring node of service server.
In actual applications, service server is registered as monitoring to what Zookeeper distributed type assemblies were sent The mode of the service request of object can have a variety of.For example, service server can pass through Zookeeper points The client of cloth cluster, the business for being registered as eavesdropping target sent to Zookeeper distributed type assemblies Request.The client of usual Zookeeper distributed type assemblies can also for curator clients and/or ZKclient clients etc..
After the monitoring node that Zookeeper distributed type assemblies are generated by the service request, the monitoring node It can be used for monitoring the service server.It is emphasized that when Zookeeper distributed type assemblies are received To multiple service servers the service request for being registered as eavesdropping target when, can generate one monitor section Point, while listening for these service servers, monitor resource can be so saved by the monitoring node; The service request that eavesdropping target can be registered as according to each generates a corresponding monitoring node, passes through These monitor node to monitor these service servers, can so make snoop results more accurate;Can also According to actual conditions, the mode of node is monitored with reference to both generations, a number of monitoring node is generated Monitor these service servers.For example, service server A, B, C are to Zookeeper distributed type assemblies The service request for being registered as eavesdropping target is sent, Zookeeper distributed type assemblies can generate a monitoring Node D, by the monitoring node D come monitoring service server A, B, C;Monitoring section can also be generated Point a, b, c, monitoring service server A, B, C are distinguished by monitoring node a, b, c;It can also give birth to Into node E, F is monitored, saved by monitoring node E monitoring services server A and B, and by monitoring Point F monitoring service servers C.
It should be noted that generally can be firm in Zookeeper distributed type assemblies in actual applications During startup, or when service server is in firm start, or there is in service end new service server During addition, service server can send the industry for being registered as eavesdropping target to the Zookeeper distributed type assemblies Business request, then the Zookeeper distributed type assemblies are according to each service request, and node is monitored in generation, By monitoring node come monitoring service server.
Step S12:The distributed type assemblies are monitored and are used as the data on each service server of eavesdropping target Whether change.
As it was previously stated, each service server of service end usually requires to carry out data syn-chronization, to handle use The business that family end is submitted.For example, in instant messaging, the deletion that service server a processing user terminals are submitted , it is necessary to which the data syn-chronization that deletion good friend business is produced is to other service servers after good friend's business, so as to The user terminal uses the instant messaging in follow-up.In order to which each service server of service end is carried out into data Synchronous, whether the data that distributed type assemblies usually require to monitor on each service server change.
As a rule, according to the difference of distributed type assemblies, whether the data on monitoring service server become The mode of change can also be different.A kind of preferred scheme is, when distributed type assemblies are Zookeeper distributed During cluster, Zookeeper distributed type assemblies can listen to the industry as eavesdropping target by following methods Data on business server change:When the Zookeeper distributed type assemblies are listened to as monitoring pair When the service server of elephant carries out data manipulation to monitoring node, the data hair on the service server is determined Changing.
Herein, the data manipulation is specially the service server according to the number on the service server According to the result of change, to the data manipulation that node is carried out of monitoring on the Zookeeper distributed type assemblies. That is, when distributed type assemblies are Zookeeper distributed type assemblies, the data on service server become After change, it will usually carried out according to the result of data variation on the monitoring node of Zookeeper distributed type assemblies Corresponding data manipulation, and monitoring the data manipulation on node can be supervised by Zookeeper distributed type assemblies Hear, when Zookeeper distributed type assemblies, which are listened to, monitors the data manipulation on node, it may be determined that industry Data on business server change.In practical application, Zookeeper distributed type assemblies are to monitoring node On the mode monitored of data manipulation can have a variety of, periodically training in rotation can for example monitor on node Data, when find monitor node on data change when, illustrate service server to the monitoring node Data manipulation is carried out.
It should be noted that when each service server is given birth to respectively in Zookeeper distributed type assemblies During into a corresponding monitoring node, service server carries out data manipulation to monitoring node here, described Monitoring node can be distributed type assemblies in any one monitor node, service server can also for clothes The service server at business end.That is, any one service server of service end is in distributed type assemblies Any one monitor node carry out data manipulation, be all the Zookeeper distributed type assemblies need monitor Object.
Step S13:When the distributed type assemblies are listened on a service server as eavesdropping target After data change, data synchronization request is sent to as each service server of eavesdropping target.
Herein, changed as the data on the service server of eavesdropping target, described one Service server can be any one service server in service end, it is only necessary to the number on the service server According to changing and listened to by the distributed type assemblies.
When the data that the distributed type assemblies are listened on a service server as eavesdropping target occur After change, data synchronization request is sent to as each service server of eavesdropping target.
In actual applications, the service request of the data syn-chronization can cause each business as eavesdropping target Server carries out data syn-chronization after the data synchronization request is received by the distributed type assemblies.
Step S14:Each service server passes through the distribution after the data synchronization request is received Cluster carries out data syn-chronization.
, can be by this after the data synchronization request that each service server receives distributed type assemblies transmission Distributed type assemblies carry out data syn-chronization.For example, the distributed type assemblies are Zookeeper distributed type assemblies, respectively Individual service server can directly in distributed type assemblies new data after pulling data operation, so as to enter line number According to synchronization.
It should be noted that in actual applications, generally for improving each service server data syn-chronization Efficiency, can configure the data between multiple sync servers, these sync servers in distributed type assemblies Can be synchronous, and each sync server is connected with each other with several different service servers respectively.Also It is to say, the distributed type assemblies include at least two sync servers, the sync server and business service Device is connected with each other, and the data between each sync server can be synchronous;Then, distribution is being passed through It is described to be specifically included by the distributed type assemblies progress data syn-chronization when cluster carries out data syn-chronization:Pass through The sync server being connected in the distributed type assemblies with each service server carries out data syn-chronization.
With reference to Fig. 3, by taking Zookeeper distributed type assemblies as an example, included in the Zookeeper distributed type assemblies Mutually closed between two Zookeeper sync server A and B, this two Zookeeper sync servers Connection, can be managed so that the data energy between them by Zookeeper distributed application programs Enough states in synchronization.Also, Zookeeper sync servers A and service server A1, business service Device A2 connections, Zookeeper sync servers B is connected with service server B1, service server B2. It can so cause, service server A1, service server A2, service server B1 and business service Device B2 passes through respectively after the data synchronization request of Zookeeper distributed type assemblies transmission is received Zookeeper sync server A and Zookeeper sync servers B carries out data syn-chronization.
This method provided using embodiment 1, when the distributed type assemblies listen to one as eavesdropping target After data on individual service server change, number is sent to as each service server of eavesdropping target According to synchronization request, so that each service server is after the data synchronization request is received, pass through the distribution Formula cluster carries out data syn-chronization.Because this method realizes each service server by way of distributed type assemblies Between data syn-chronization, can so cause, can't when any one service server breaks down The normal work of other service servers is had influence on, would not also cause service end due to a certain business service The phenomenon that device breaks down and can not worked.Therefore solve solution in the prior art, service end set it is main, After server, the problem of data syn-chronization between each server relies on master server.
It should be noted that the executive agent that embodiment 1 provides each step of method may each be same and set It is standby, or, each step of this method can also be used as executive agent by distinct device.Such as, step 11 Executive agent with step 12 can be equipment 1;Again such as, the executive agent of step 11 can be equipment 1, the executive agent of step 12 sum can be equipment 2;Etc..
Embodiment 2
In the case where distributed type assemblies are Zookeeper distributed type assemblies, it refer in embodiment 1 Zookeeper distributed type assemblies can carry out data manipulation with monitoring service server to monitoring node.In fact, In actual applications, the mode of this data manipulation can have a variety of, for example, can be write for data and/or number According to deletion and/or data modification etc..
For example, data manipulation can be data write-in.Generally for the multiple same prisons of service server of holding The uniformity for listening node data to write, can add distributed lock, be managed or controlled by the distributed lock Data write-in to the eavesdropping target.Therefore, service server carries out the preferred of data write-in to monitoring node Scheme is as shown in step S21 to step S23:
Step S21:The service server sends the industry for adding distributed lock to Zookeeper distributed type assemblies Business request, to cause Zookeeper distributed type assemblies to be judged whether according to the use state of the distributed lock Distributed lock can be added to the service server;
Step S22:After the service server adds distributed lock, data are carried out to the monitoring node and write Enter;
Step S23:After the service server adds distributed lock failure, data to be written are abandoned.
As a rule, Zookeeper distributed type assemblies are receiving the business of service server plus distributed lock After request, meeting is according to the use state of distributed lock, and judging whether can be to the service server bonus point cloth Lock.The use state of distributed lock can be not used including the use of neutralizing, and the distributed lock is being represented in use just Used, be not used and represent the distributed lock just in idle condition.Generally, when the use shape of distributed lock When state is in use, Zookeeper distributed type assemblies can refuse the business of the service server plus distributed lock Request, that is to say, that service server adds distributed lock to fail;When the use state of distributed lock is unused When, Zookeeper distributed type assemblies can agree to the service request of the service server plus distributed lock, also It is the service request for saying distributed type assemblies response service server plus distributed lock.
Certainly it should be noted that adding distributed lock in Zookeeper distributed type assemblies response service server Service request after, service server during distributed lock is added, generally also due to a variety of causes is led Cause lock failure, such as when adding distributed lock, due to disconnecting cause plus distributed lock operation overtime. Therefore, only after the completion of service server adds distributed lock, data write-in could be carried out to monitoring node. It should be noted that writing after completion to monitoring node progress data, generally also need to discharge the distribution Lock so that follow-up business server is write by adding the distributed lock to the monitoring node.
In addition, data manipulation can also delete for data.The service server carries out data to monitoring node The preferred scheme of deletion is as stated in step s 31.
Step S31:The service server deletes the store path for monitoring data described in node.
That is, data delete process and do not need bonus point cloth lock, because only need to be by the monitoring node The store path of the data to be deleted is deleted.
It is specially the feelings of Zookeeper distributed type assemblies in distributed type assemblies using this method of embodiment 2 Under condition, data manipulation is continued to be divided into data write-in, data deletion and data modification etc., in Zookeeper During distributed type assemblies are monitored, can more be had according to the difference of data manipulation and targetedly be supervised Listen.
Above-described embodiment 1 and embodiment 2 are illustrating to the method for data synchronization of the application offer, are Readily appreciate, present invention also provides one kind under practical application scene, implement the explanation of methods described, As shown in Figure 4.Under the application scenarios, distributed type assemblies are specially Zookeeper distributed type assemblies, should The client of Zookeeper distributed type assemblies is specially curator clients, and data manipulation is specially that data are write Enter.The method of data synchronization of the application can be used under this application scenarios, specific as follows shown:
Step S41:Each service server is sent by curator clients to Zookeeper distributed type assemblies It is registered as the service request of eavesdropping target.
Step S42:Zookeeper distributed type assemblies are according to each service request, and generation respectively is monitored each The monitoring node of the service server.
Herein, at least two Zookeeper synchronous services are included in the Zookeeper distributed type assemblies It is interrelated between device, each Zookeeper sync servers and distributed by Zookeeper Application program is managed so that the data between each Zookeeper sync servers are in synchronous shape State;In addition, Zookeeper sync servers and service server are attached.
Step S43:Current business server sends to Zookeeper distributed type assemblies and carried out to monitoring node The service request of data write-in.
Here current business server can be any one service server of service end, monitor node Node can be monitored for any one registered in distributed type assemblies.
Step S44:Zookeeper distributed type assemblies are according to the state of distributed lock to the service request bonus point Cloth is locked, when adding distributed lock to fail, and performs step S45, when adding distributed lock success, performs step Rapid S46.
The distributed lock is used to manage carries out data write-in and/or modification to the eavesdropping target.
Step S45:Abandon the data for preparing to write the eavesdropping target.
Step S46:Data write-in is carried out to the monitoring node.
Step S47:Zookeeper distributed type assemblies send data synchronization request to each service server.
Step S48:Each service server is collected according to the data synchronization request by Zookeeper distributions The sync server being connected in group with each service server carries out data syn-chronization.
Above-mentioned is the explanation to implementing the method for data synchronization under the application scenarios, in actual applications, generally In order that the service logic for obtaining service end data syn-chronization is simpler, the quantity of code is reduced, can generally be adopted Realized with the Zookeeper distributed type assemblies.
Embodiment 3
Embodiment 3 provides a kind of method of data synchronization, for solve in the prior art service end set it is main, After server, the problem of data syn-chronization between each server relies on master server.It should be noted that It can be realized by this method in service end, the data syn-chronization between different business server, the business clothes Business device is connected with distributed type assemblies.The idiographic flow schematic diagram of methods described is as shown in figure 5, including following steps Suddenly:
Step S51:Each service server is registered as eavesdropping target in distributed type assemblies respectively.
Step S51 and step S11 in embodiment 1 is essentially identical, just repeats no more herein.
Step S52:Data synchronization request is received as each service server of eavesdropping target.
The data synchronization request is that the distributed type assemblies are listening to a business as eavesdropping target After data on server change, the data to each service server transmission as eavesdropping target are same Step request;
Step S53:As each service server of eavesdropping target after data synchronization request is received, pass through The distributed type assemblies carry out data syn-chronization.
This method provided using the embodiment of the present application 3, distributed type assemblies are listening to some business clothes After data on business device change, the data synchronization request sent to each service server, in each industry Business server is received after the request, and data syn-chronization is carried out by the distributed type assemblies.Due to the distributed type assemblies It can be used in managing the data syn-chronization between each service server, can so cause, in any one business When server breaks down, the normal work of other service servers is not interfered with, would not be caused yet Service end is due to a certain service server breaks down and can not work phenomenon.So as to solve existing skill In art, master and slave server is set in service end, causes the data syn-chronization of each service server to rely on main service The problem of device.
Embodiment 4
Based on inventive concept same as Example 1, embodiment 4 provides a kind of data synchronization unit.Should Device 60 is used to realize the data syn-chronization between different business server, the service server and distribution Cluster is connected, and the service server is registered as eavesdropping target in the distributed type assemblies in advance.Such as Fig. 6 Shown, the device 60 includes:Monitoring unit 601 and transmitting element 602, wherein:
Monitoring unit 601, each service server as eavesdropping target is monitored for the distributed type assemblies On data whether change;
Transmitting element 602, for listening to the business clothes as eavesdropping target when the distributed type assemblies After data on business device change, sending data syn-chronization to each service server as eavesdropping target please Ask, so that each service server is after the data synchronization request is received, entered by the distributed type assemblies Row data syn-chronization.
Device 60 provided using embodiment 4, because the device 60 is using same as Example 1 Inventive concept, therefore can obtain and the identical invention effect of embodiment 1.In addition, in actual applications should Device 60 can also obtain other technique effects by combining specific hardware facility.For example, can be with Increase the internal memory of each equipment in distributed type assemblies, then will need synchronous data storage in distributed type assemblies In the internal memory of each equipment, service server can be so caused to carry out data syn-chronization by distributed type assemblies When, speed is faster.
Embodiment 5
Based on inventive concept same as Example 3, embodiment 5 provides a kind of data synchronization unit.Should Device 70 data syn-chronizations between different business server is realized, the service server and distribution Cluster is connected, and the service server is registered as eavesdropping target in the distributed type assemblies in advance.Such as Fig. 7 Shown, the device 70 includes:Receiving unit 701 and synchronization unit 702, wherein:
Receiving unit 701, for receiving data synchronization request as each service server of eavesdropping target, The data synchronization request is that the distributed type assemblies are listening to a business service as eavesdropping target , please to the data syn-chronization of each service server transmission as eavesdropping target after data on device change Ask;
Synchronization unit 702, data synchronization request is being received for each service server as eavesdropping target Afterwards, data syn-chronization is carried out by the distributed type assemblies
Device 70 provided using embodiment 5, because the device 70 is based on hair same as Example 2 Bright design, therefore, it is possible to obtain the technique effect of embodiment 2.In addition, in actual applications, the device 70 Other technique effects can also be obtained by combining hardware device.For example, in service server to monitoring pair As carrying out during data manipulation, because eavesdropping target is registered in distributed type assemblies, therefore business clothes can be improved Business device and connection (physical connection) mode of eavesdropping target, to accelerate the speed of data manipulation.
It should be understood by those skilled in the art that, embodiments herein can be provided as method, system or meter Calculation machine program product.Therefore, the application can be using complete hardware embodiment, complete software embodiment or knot The form of embodiment in terms of conjunction software and hardware.Wherein wrapped one or more moreover, the application can be used Containing computer usable program code computer-usable storage medium (include but is not limited to magnetic disk storage, CD-ROM, optical memory etc.) on the form of computer program product implemented.
The application is produced with reference to according to the method, equipment (system) and computer program of the embodiment of the present application The flow chart and/or block diagram of product is described.It should be understood that can by computer program instructions implementation process figure and / or each flow and/or square frame in block diagram and the flow in flow chart and/or block diagram and/ Or the combination of square frame.These computer program instructions can be provided to all-purpose computer, special-purpose computer, insertion Formula processor or the processor of other programmable data processing devices are to produce a machine so that pass through and calculate The instruction of the computing device of machine or other programmable data processing devices is produced for realizing in flow chart one The device for the function of being specified in individual flow or multiple flows and/or one square frame of block diagram or multiple square frames.
These computer program instructions, which may be alternatively stored in, can guide computer or the processing of other programmable datas to set In the standby computer-readable memory worked in a specific way so that be stored in the computer-readable memory Instruction produce include the manufacture of command device, the command device realization in one flow or multiple of flow chart The function of being specified in one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices, made Obtain and perform series of operation steps on computer or other programmable devices to produce computer implemented place Reason, so that the instruction performed on computer or other programmable devices is provided for realizing in flow chart one The step of function of being specified in flow or multiple flows and/or one square frame of block diagram or multiple square frames.
In a typical configuration, computing device includes one or more processors (CPU), input/defeated Outgoing interface, network interface and internal memory.
Internal memory potentially includes the volatile memory in computer-readable medium, random access memory And/or the form, such as read-only storage (ROM) or flash memory (flash RAM) such as Nonvolatile memory (RAM). Internal memory is the example of computer-readable medium.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by appointing What method or technique realizes that information is stored.Information can be computer-readable instruction, data structure, program Module or other data.The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), dynamic random access memory (DRAM), its Random access memory (RAM), read-only storage (ROM), the electrically erasable of his type are read-only Memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage (CD-ROM), digital versatile disc (DVD) or other optical storages, magnetic cassette tape, tape magnetic Disk storage or other magnetic storage apparatus or any other non-transmission medium, can be calculated available for storage The information that equipment is accessed.Defined according to herein, computer-readable medium does not include temporary computer-readable matchmaker The data-signal and carrier wave of body (transitory media), such as modulation.
It should also be noted that, term " comprising ", "comprising" or its any other variant be intended to it is non- It is exclusive to include, so that process, method, commodity or equipment including a series of key elements are not only wrapped Include those key elements, but also other key elements including being not expressly set out, or also include for this process, Method, commodity or the intrinsic key element of equipment.In the absence of more restrictions, by sentence " including One ... " limit key element, it is not excluded that in the process including key element, method, commodity or equipment Also there is other identical element.
It will be understood by those skilled in the art that embodiments herein can be provided as method, system or computer journey Sequence product.Therefore, the application can using complete hardware embodiment, complete software embodiment or combine software and The form of the embodiment of hardware aspect.Moreover, the application can be used wherein includes calculating one or more Machine usable program code computer-usable storage medium (include but is not limited to magnetic disk storage, CD-ROM, Optical memory etc.) on the form of computer program product implemented.
Embodiments herein is these are only, the application is not limited to.For people in the art For member, the application can have various modifications and variations.It is all to be made within spirit herein and principle Any modification, equivalent substitution and improvements etc., should be included within the scope of claims hereof.

Claims (10)

1. a kind of method of data synchronization, it is characterised in that methods described is used to realize different business server Between data syn-chronization, the service server is connected with distributed type assemblies, and the service server exists in advance Eavesdropping target is registered as in the distributed type assemblies, methods described includes:
When the data that the distributed type assemblies are listened on a service server as eavesdropping target occur After change, data synchronization request is sent to as each service server of eavesdropping target, so as to each business Server carries out data syn-chronization after the data synchronization request is received by the distributed type assemblies.
2. the method as described in claim 1, it is characterised in that the distributed type assemblies are specially Zookeeper distributed type assemblies;Then,
In the Zookeeper distributed type assemblies, the service server is registered as by following methods Eavesdropping target:
The Zookeeper distributed type assemblies receive the industry for being registered as eavesdropping target that service server is sent Business request;
The Zookeeper distributed type assemblies are generated for monitoring the business service by the service request The monitoring node of device.
3. method as claimed in claim 2, it is characterised in that the Zookeeper distributed type assemblies lead to The data that following methods are listened on the service server as eavesdropping target are crossed to change:
Saved when the Zookeeper distributed type assemblies are listened to as the service server of eavesdropping target to monitoring When point carries out data manipulation, determine that the data on the service server change, the data manipulation tool Body is result of the service server according to the data variation on the service server, to described The data manipulation that node is carried out is monitored on Zookeeper distributed type assemblies.
4. method as claimed in claim 3, it is characterised in that the data manipulation is specifically included:Number Deleted according to write-in and/or data.
5. method as claimed in claim 4, it is characterised in that the business as eavesdropping target takes Business device is specifically included to monitoring node progress data write-in:
The service server is sent to the Zookeeper distributed type assemblies plus the business of distributed lock please Ask, so that the Zookeeper distributed type assemblies judge whether energy according to the use state of the distributed lock It is enough to add distributed lock to the service server;
After the service server adds distributed lock, data write-in is carried out to the monitoring node.
6. method as claimed in claim 4, it is characterised in that the business as eavesdropping target takes Business device is specifically included to monitoring node progress data deletion:The service server is deleted in the monitoring node The store path of the data.
7. the method as described in claim 1, it is characterised in that the distributed type assemblies include at least two Individual sync server, between the sync server and service server connection and each sync server Data can be synchronous;Then,
It is described to be specifically included by distributed type assemblies progress data syn-chronization:By in the distributed type assemblies The sync server being connected with each service server carries out data syn-chronization.
8. a kind of method of data synchronization, it is characterised in that methods described is used to realize different business server Between data syn-chronization, the service server is connected with distributed type assemblies, and the service server exists in advance Eavesdropping target is registered as in the distributed type assemblies, methods described includes:
Data synchronization request is received as each service server of eavesdropping target, the data synchronization request is Data of the distributed type assemblies on the service server listened to as eavesdropping target change Afterwards, to the data synchronization request of each service server transmission as eavesdropping target;
As each service server of eavesdropping target after data synchronization request is received, pass through the distribution Cluster carries out data syn-chronization.
9. a kind of data synchronization unit, it is characterised in that described device is used to realize different business server Between data syn-chronization, the service server is connected with distributed type assemblies, and the service server exists in advance Eavesdropping target is registered as in the distributed type assemblies, described device includes:Monitoring unit and transmitting element, its In:
Monitoring unit, is monitored as on each service server of eavesdropping target for the distributed type assemblies Whether data change;
Transmitting element, for listening to a service server as eavesdropping target when the distributed type assemblies On data change after, to as eavesdropping target each service server send data synchronization request, So that each service server is after the data synchronization request is received, line number is entered by the distributed type assemblies According to synchronization.
10. a kind of data synchronization unit, it is characterised in that described device is used to realize different business server Between data syn-chronization, the service server is connected with distributed type assemblies, and the service server exists in advance Eavesdropping target is registered as in the distributed type assemblies, described device includes:Receiving unit and synchronization unit, its In:
Receiving unit, data synchronization request is received for each service server as eavesdropping target, described Data synchronization request is the distributed type assemblies on a service server as eavesdropping target is listened to Data change after, to as eavesdropping target each service server transmission data synchronization request;
Synchronization unit, for each service server as eavesdropping target after data synchronization request is received, Data syn-chronization is carried out by the distributed type assemblies.
CN201610195298.5A 2016-03-30 2016-03-30 A kind of method of data synchronization and device Pending CN107295031A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610195298.5A CN107295031A (en) 2016-03-30 2016-03-30 A kind of method of data synchronization and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610195298.5A CN107295031A (en) 2016-03-30 2016-03-30 A kind of method of data synchronization and device

Publications (1)

Publication Number Publication Date
CN107295031A true CN107295031A (en) 2017-10-24

Family

ID=60086822

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610195298.5A Pending CN107295031A (en) 2016-03-30 2016-03-30 A kind of method of data synchronization and device

Country Status (1)

Country Link
CN (1) CN107295031A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107908708A (en) * 2017-11-09 2018-04-13 北京锐安科技有限公司 A kind of method, system, equipment and the storage medium of group document synchronization
CN110489491A (en) * 2019-08-26 2019-11-22 湖南中车时代通信信号有限公司 A kind of full dose data synchronization unit for netting double clusters suitable for A/B
CN111354124A (en) * 2020-03-11 2020-06-30 北京创联云睿科技有限公司 Intelligent Internet of things vending system, service equipment and vending machine
CN111736874A (en) * 2020-06-28 2020-10-02 深圳前海微众银行股份有限公司 Application updating method and device
CN112118294A (en) * 2020-08-20 2020-12-22 山东浪潮通软信息科技有限公司 Request processing method, device and medium based on server cluster
CN116560864A (en) * 2023-07-06 2023-08-08 苏州浪潮智能科技有限公司 Method, device, system, equipment and storage medium for realizing distributed lock

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130117225A1 (en) * 2011-11-03 2013-05-09 Michael W. Dalton Distributed storage medium management for heterogeneous storage media in high availability clusters
CN103312809A (en) * 2013-06-24 2013-09-18 北京汉柏科技有限公司 Distributed management method for service in cloud platform
CN103916481A (en) * 2014-04-17 2014-07-09 北京京东尚科信息技术有限公司 Method and device for processing data
CN104536834A (en) * 2014-11-26 2015-04-22 华为技术有限公司 Method for authorizing lock permission and distributed lock manager
US20160004603A1 (en) * 2014-07-02 2016-01-07 Hedvig, Inc. Storage system with virtual disks
CN105245603A (en) * 2015-10-15 2016-01-13 北京乐动卓越科技有限公司 Cluster server control method and system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130117225A1 (en) * 2011-11-03 2013-05-09 Michael W. Dalton Distributed storage medium management for heterogeneous storage media in high availability clusters
CN103312809A (en) * 2013-06-24 2013-09-18 北京汉柏科技有限公司 Distributed management method for service in cloud platform
CN103916481A (en) * 2014-04-17 2014-07-09 北京京东尚科信息技术有限公司 Method and device for processing data
US20160004603A1 (en) * 2014-07-02 2016-01-07 Hedvig, Inc. Storage system with virtual disks
CN104536834A (en) * 2014-11-26 2015-04-22 华为技术有限公司 Method for authorizing lock permission and distributed lock manager
CN105245603A (en) * 2015-10-15 2016-01-13 北京乐动卓越科技有限公司 Cluster server control method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
何慧虹: "《分布式环境下基于zookeeper服务的数据同步的研究》", 《信息网络安全》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107908708A (en) * 2017-11-09 2018-04-13 北京锐安科技有限公司 A kind of method, system, equipment and the storage medium of group document synchronization
CN110489491A (en) * 2019-08-26 2019-11-22 湖南中车时代通信信号有限公司 A kind of full dose data synchronization unit for netting double clusters suitable for A/B
CN110489491B (en) * 2019-08-26 2023-07-04 湖南中车时代通信信号有限公司 Full data synchronization device suitable for A/B network double clusters
CN111354124A (en) * 2020-03-11 2020-06-30 北京创联云睿科技有限公司 Intelligent Internet of things vending system, service equipment and vending machine
CN111736874A (en) * 2020-06-28 2020-10-02 深圳前海微众银行股份有限公司 Application updating method and device
CN112118294A (en) * 2020-08-20 2020-12-22 山东浪潮通软信息科技有限公司 Request processing method, device and medium based on server cluster
CN116560864A (en) * 2023-07-06 2023-08-08 苏州浪潮智能科技有限公司 Method, device, system, equipment and storage medium for realizing distributed lock
CN116560864B (en) * 2023-07-06 2023-11-03 苏州浪潮智能科技有限公司 Method, device, system, equipment and storage medium for realizing distributed lock

Similar Documents

Publication Publication Date Title
CN107295031A (en) A kind of method of data synchronization and device
CN109617759A (en) Block catenary system stability test method, apparatus, equipment and storage medium
CN104811366B (en) A kind of loaming method and device of network communication message
CN105915529B (en) A kind of message forming method and device
CN106878363A (en) A kind of information processing method, apparatus and system
CN110908812B (en) Service data processing method, device, readable storage medium and computer equipment
CN107040576A (en) Information-pushing method and device, communication system
CN110728498A (en) Information interaction method and device
CN107423942A (en) A kind of method and device of work flow
CN112860343A (en) Configuration changing method, system, device, electronic equipment and storage medium
US11544119B2 (en) Business rules processing framework for implementing new desired functionality in a telecommunication application
CN109167819A (en) Data synchronous system, method, apparatus and storage medium
CN111669434A (en) Method, system, device and equipment for establishing communication group
CN105095310B (en) Data processing method, first server, second server and data processing system
US20200242702A1 (en) Capital chain information traceability method, system, server and readable storage medium
CN116975125A (en) Data statistics method, device, system, storage medium and program product
CN111628903A (en) Monitoring method and monitoring system for transaction system running state
WO2017041523A1 (en) Relationship chain processing method and system, and storage medium
EP4142258A1 (en) Edge computing network, data transmission method and apparatus, device and storage medium
CN110022323A (en) A kind of method and system of the cross-terminal real-time, interactive based on WebSocket and Redux
CN109410049A (en) Block chain bookkeeping methods, device, computer equipment and storage medium
CN106487561A (en) The method and system that a kind of server service updates
CN113778709A (en) Interface calling method, device, server and storage medium
CN113923227A (en) Block chain message distribution method and device
CN113259119A (en) Block chain message distribution method and device

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
TA01 Transfer of patent application right

Effective date of registration: 20200925

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200925

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Applicant before: Alibaba Group Holding Ltd.

TA01 Transfer of patent application right
RJ01 Rejection of invention patent application after publication

Application publication date: 20171024

RJ01 Rejection of invention patent application after publication