CN108337303A - A kind of method of data synchronization and distributed system - Google Patents

A kind of method of data synchronization and distributed system Download PDF

Info

Publication number
CN108337303A
CN108337303A CN201810072776.2A CN201810072776A CN108337303A CN 108337303 A CN108337303 A CN 108337303A CN 201810072776 A CN201810072776 A CN 201810072776A CN 108337303 A CN108337303 A CN 108337303A
Authority
CN
China
Prior art keywords
server
local data
data
checking parameter
check information
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
CN201810072776.2A
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.)
China Unionpay Co Ltd
Original Assignee
China Unionpay 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 China Unionpay Co Ltd filed Critical China Unionpay Co Ltd
Priority to CN201810072776.2A priority Critical patent/CN108337303A/en
Publication of CN108337303A publication Critical patent/CN108337303A/en
Priority to PCT/CN2018/124451 priority patent/WO2019144761A1/en
Priority to TW108102487A priority patent/TWI751402B/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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3297Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving time stamps, e.g. generation of time stamps

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Hardware Redundancy (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present embodiments relate to data field of synchronization more particularly to a kind of method of data synchronization and distributed systems, to solve the problems, such as that Data Data synchronization real-time is poor between server in the prior art.In the embodiment of the present invention, it is applied to distributed system, system includes at least two servers;At least two servers include first server and second server;Method includes:First server receives the first check information that second server is sent;First check information includes the first checking parameter;First checking parameter be second server when determining that local data changes, according to after variation local data generate;First server synchronizes the data for second server when determining that the first checking parameter received and the second checking parameter being locally stored are inconsistent, by local data;Second checking parameter is that first server is generated according to current local data.Help to improve the real-time that data synchronize between first server and second server.

Description

A kind of method of data synchronization and distributed system
Technical field
The present embodiments relate to data field of synchronization more particularly to a kind of method of data synchronization and distributed systems.
Background technology
With the development of technology, data sharing has become people and obtains the indispensable mode of latest data resource, data It is one of most important resource-sharing means to synchronize.The data method of synchronization has the advantage that:Highly redundant improves data and combats a natural disaster to hold Calamity ability, teledata localization, reduces network overhead when accessing data, improves data access efficiency;It can be fully sharp With the central processing unit (Central Processing Unit, abbreviation CPU) and input/output end port of each server (Input/Output, abbreviation I/O) improves overall data access efficiency.
If data are continuous dynamic changes, need to ensure that newest data can also carry out real-time synchronization.But it is existing Have in technology, the real-time that data synchronize is poor.The open source projects for warehouse management system of favor are especially received at present GitLab servers.GitLab servers are to use Git as data organizing tool, and erect the ring come on this basis Ball Information Network (World Wide Web, abbreviation WEB) (also known as WWW) service;GitLab servers are serviced compared to others The advantage of device is there is WEB interface, and the overall condition of data can be seen in order to manager.But GitLab servers cannot It realizes real time data synchronization, needs the synchronization of manager's data between the specific time carries out GitLab servers manually.By Data synchronization can only be carried out in the specific time in GitLab servers, therefore, the reality of data synchronization between server can be caused When property is poor.
Invention content
A kind of method of data synchronization of offer of the embodiment of the present invention and distributed system, to solve server in the prior art Between data synchronize real-time difference problem.
The embodiment of the present invention provides a kind of method of data synchronization, including:Applied to distributed system, the system comprises extremely Few two servers;At least two server includes first server and second server;The method includes:Described One server receives the first check information that the second server is sent;First check information includes that the first verification is joined Number;First checking parameter be the second server when determining that local data changes, according to the local after variation What data generated;The first server is determining first checking parameter received and second be locally stored verification ginseng When number is inconsistent, local data is synchronized into the data for the second server;Wherein, second checking parameter is described the One server is generated according to current local data.
Optionally, the method further includes:The first server generates third after determining that local data changes Check information;The third check information includes third checking parameter;Wherein, the third checking parameter is the first service Device is generated when determining that local data changes according to the local data after variation;The first server is to described Two servers send the third check information;The first server receives the synchronized update request of the second server, Synchronized update request is the second server in for determining the third checking parameter received and being locally stored What four checking parameters were sent when inconsistent, wherein the 4th checking parameter is the second server according to current local What data generated.
Optionally, first check information further includes stabbing at the first time, and first time stamp is used to indicate described the At the time of two server local data change;If the first server is determining that it is early that the first time received stabs When the second timestamp being locally stored, then first local data is synchronized be the second server data, after by described the Three check informations are sent to the second server;Wherein, it is local to be used to indicate the first server for second timestamp At the time of data change.
Optionally, if the first server is determining the first time received stamp earlier than being locally stored When the second timestamp, then first by local data synchronize be the second server data, after by the third check information send out It send to the second server, including:If the first server is determining the first time received stamp earlier than local When the second timestamp of storage, determine that the first time stabs file identification corresponding with second timestamp respectively;If institute It states first server and is determining that first time stamp file identification corresponding with second timestamp is identical, then it first will be local Data synchronize be the second server data, after the third check information is sent to the second server.
Optionally, first checking parameter is that the second server carries out Hash operation to the local data after variation It generates;Second checking parameter and the third checking parameter are respectively the first server to the local number after variation According to progress Hash operation generation;4th checking parameter is that the second server carries out Hash to current local data What operation generated.
The embodiment of the present invention provides a kind of distributed system that data synchronize, and the system comprises at least two servers; At least two server includes first server and second server;Wherein, the first server includes:It receives single Member, the first check information sent for receiving the second server;First check information includes the first checking parameter; First checking parameter be the second server when determining that local data changes, according to the local data after variation It generates;Processing unit, for determining first checking parameter received and the second checking parameter being locally stored not When consistent, local data is synchronized into the data for the second server;Wherein, second checking parameter is first clothes It is engaged in what device was generated according to current local data.
Optionally, the processing unit, is additionally operable to:After determining that local data changes, third check information is generated; The third check information includes third checking parameter;Wherein, the third checking parameter is the first server in determination When local data changes, generated according to the local data after variation;
Further include transmission unit, is used for:The third check information is sent to the second server;
The receiving unit, is used for:The synchronized update request of the second server is received, the synchronized update request is The second server is when determining that the third checking parameter received and the 4th checking parameter being locally stored are inconsistent It sends, wherein the 4th checking parameter is that the second server is generated according to current local data.
Optionally, first check information further includes stabbing at the first time, and first time stamp is used to indicate described the At the time of two server local data change;The processing unit, is used for:If it is determined that the first time stamp received When earlier than the second timestamp being locally stored, then first local data is synchronized be the second server data, after will be described Third check information is sent to the second server;Wherein, second timestamp is used to indicate the first server sheet At the time of ground data change.
Optionally, the processing unit, is used for:If it is determined that the first time stamp received is earlier than the be locally stored When two timestamps, determine that the first time stabs file identification corresponding with second timestamp respectively;If it is determined that described One timestamp file identification corresponding with second timestamp is identical, then it is the second server first to synchronize local data Data, after the third check information is sent to the second server.
Optionally, first checking parameter is that the second server carries out Hash operation to the local data after variation It generates;Second checking parameter and the third checking parameter are respectively the first server to the local number after variation According to progress Hash operation generation;4th checking parameter is that the second server carries out Hash to current local data What operation generated.
The embodiment of the present invention provides a kind of computer readable storage medium, and the computer-readable recording medium storage has meter Calculation machine executable instruction, the computer executable instructions are used to that the computer to be made to execute the method.
The embodiment of the present invention provides a kind of computer equipment, including:Memory, for storing program instruction;Processor is used In calling the program instruction stored in the memory, the method is executed according to the program of acquisition.
Since in the embodiment of the present invention, method of data synchronization is applied to distributed system, and the system comprises at least two Server, first server receive the first check information that the second server is sent, and first check information is described Second server generates, i.e. the sheet of second server when determining that local data changes according to the local data after variation After ground data change, second server generates the first check information according to the data after variation, wherein the first check information Including the first checking parameter;The first server is in the second verification ginseng for determining that the receive first verification participation is locally stored When number is inconsistent, local data is synchronized into the data for the second server.As it can be seen that the data when second server become After change, the first check information can be generated;The first verification letter that the second server that first server receives by comparing is sent In the first checking parameter and when inconsistent the second checking parameter for being locally stored, illustrate data and described second in first server Data are different in server, then it is data in second server that first server, which synchronizes local data, in this way, helping to improve The real-time that data synchronize between first server and the second server.
Description of the drawings
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly introduced, it should be apparent that, drawings in the following description are only some embodiments of the invention, for this For the those of ordinary skill in field, without having to pay creative labor, it can also be obtained according to these attached drawings His attached drawing.
Fig. 1 is a kind of configuration diagram of distributed system provided in an embodiment of the present invention;
Fig. 2 is a kind of method flow schematic diagram of method of data synchronization provided in an embodiment of the present invention;
Fig. 3 is the method flow schematic diagram of another method of data synchronization provided in an embodiment of the present invention;
Fig. 4 is the structural schematic diagram of first server provided in an embodiment of the present invention.
Specific implementation mode
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention make into It is described in detail to one step, it is clear that described embodiments are only a part of the embodiments of the present invention, rather than whole implementation Example.Based on the embodiments of the present invention, obtained by those of ordinary skill in the art without making creative efforts All other embodiment, shall fall within the protection scope of the present invention.
Fig. 1 shows a kind of configuration diagram of distributed system using the embodiment of the present invention.As shown in Figure 1, this is System framework may include at least two servers, with first server 101 and second server 102 in Fig. 1 of the embodiment of the present invention For;It is stored with identical data on first server 101 and second server 102;And first server 101 and second service Data on device 102 need to keep identical in real time.In the embodiment of the present invention, second server 102 is to monitor local data elder generation Changed server, first server 101 are and 102 associated server of second server.First server 101 and It can be attached by wireless or wired mode between two servers 102.The system can be distributed open source software generation Code warehouse system, first server 101 and second server 102 can be GitLab servers.
First server 101 and second server 102 can be the network equipments for being communicated with terminal device.The Rsync (the mirror back-up of data tool i.e. under Linux system) is mounted on one server 101 and second server 102, with Realize the remote synchronization of data.First it is subsynchronous when rsync can replicate full content, but only transmission was changed next time Data, rsync can carry out compression and decompression operation during transmission data, therefore can use less bandwidth. Real time monitoring script and real-time synchronization script are deployed in first server 101 and second server 102;Monitor script in real time For monitoring whether data on first server 101 and second server 102 change;Real-time synchronization script is used for first Data on server 101 and second server 102 carry out real-time synchronization.
Based on system architecture shown in FIG. 1, Fig. 2 illustrates a kind of data side of synchronization provided in an embodiment of the present invention The method flow schematic diagram of method, as shown in Fig. 2, the method for data synchronization includes the following steps:
Step 201, first server receives the first check information that second server is sent;First check information includes the One checking parameter;First checking parameter be second server when determining that local data changes, according to the local after variation What data generated;
Step 202, first server is determining the first checking parameter received and the second checking parameter being locally stored When inconsistent, local data is synchronized into the data for second server;Wherein, the second checking parameter is first server according to working as What preceding local data generated.
Since in the embodiment of the present invention, method of data synchronization is applied to distributed system, system includes at least two services Device, first server receive the first check information that second server is sent, and the first check information is second server in determination When local data changes, generated according to the local data after variation, i.e. after the local data of second server changes, Second server generates the first check information according to the data after variation, wherein the first check information includes the first checking parameter; First server is when the second checking parameter for determining that the receive first verification participation is locally stored is inconsistent, by local data Synchronous is the data of second server.As it can be seen that after the data of second server change, the first check information can be generated; In the first verification letter that second server that first server receives by comparing is sent the first checking parameter be locally stored The second checking parameter it is inconsistent when, illustrate that data are different from data in second server in first server, then first service It is data in second server that device, which synchronizes local data, in this way, helping to improve between first server and second server The real-time that data synchronize.
It should be noted that the first clothes of real time monitoring script real time monitoring disposed on first server and second server The data being engaged in the data and second server in device.In step 201, when the real time monitoring script on second server monitors When changing to the data in second server, second server generates the first check information, and the first check information is protected There are the locals of second server.Wherein, the first check information includes the first checking parameter.The first school in first check information It can be the cryptographic Hash that second server carries out the local data after variation Hash operation generation to test parameter.
In the embodiment of the present invention, the process of check information, the local data in first server are generated in second server May also it be changed.First server generates third check information after determining that local data changes;Third verifies Information includes third checking parameter;Wherein, third checking parameter be first server when determining that local data changes, root It is generated according to the local data after variation;First server sends third check information to second server;First server connects The synchronized update request of second server is received, synchronized update request is that second server is determining the third checking parameter received It is sent when inconsistent with the 4th checking parameter that is locally stored, wherein the 4th checking parameter is second server according to currently Local data generate.
Optionally, the second checking parameter and third checking parameter be respectively first server to the local data after variation into The cryptographic Hash that row Hash operation generates;4th checking parameter is that second server carries out Hash operation life to current local data At cryptographic Hash.
Optionally, first server generates the second checking parameter and third checking parameter, second server generate the 4th school It tests and is originally stored in respective local after parameter, the checking parameter be convenient for and received is compared, to determine the need for pair Local data synchronizes.
In the embodiment of the present invention, when second server determines the third checking parameter received and the 4th school being locally stored Test parameter it is inconsistent when, need to synchronize the local data of second service be first server local data.Optionally, second Server sends synchronized update request to first server;First server is in the synchronized update for receiving second server transmission After request, the data after variation are sent to second server by first server, and second server sends first server Data update is to local, to realize the real-time synchronization of data in data and first server in second server.
In the embodiment of the present invention, first server has received the first check information of second server transmission, and first Server generates third check information to the data after local change.Synchrodata or missed synchronization are duplicated in order to prevent The problem of data, in the embodiment of the present invention, the first check information further includes stabbing at the first time, and stamp is used to indicate second at the first time At the time of server local data change;If first server is determining the first time received stamp earlier than being locally stored The second timestamp when, then first local data is synchronized be second server data, after third check information is sent to the Two servers;Wherein, at the time of the second timestamp is used to indicate first server local data and changes.
If first server determines that the first time stamp received earlier than the second timestamp being locally stored, illustrates the second clothes Device be engaged in during generating the first check information, the local data of first server is changed.For this situation, this hair In bright embodiment, first server is sent after first being synchronized to local data.
If first server determines the first time received, stamp is later than the second timestamp being locally stored, and illustrates the first clothes Device be engaged in before receiving the first check information, local data does not change.Therefore, first server is same by local data Step is the data in second server.
If first server determines that the first time stamp received is consistent with the second timestamp being locally stored, it is determined that connect Whether the first checking parameter and the second checking parameter being locally stored are consistent in the first check information received.If consistent, say Data in bright first server are identical with the data in second server, need not synchronize;If inconsistent, the first clothes Business device synchronizes local data for the data in second server.
In the embodiment of the present invention, it is different in a relatively short period of time can to solve identical file for stamp and the second timestamp at the first time In server occur different data variation when file collision problem, may make first server and second server according to when Between the sequencing that stabs carry out the synchronizations of data.Specifically, if first server determine receive first time stamp earlier than When the second timestamp being locally stored, determines stab file identification corresponding with the second timestamp at the first time respectively;If it is determined that the One timestamp and the corresponding file identification of the second timestamp are identical, then local data are first synchronized the data for second server, Third check information is sent to second server afterwards.
It can be seen from the above:In the embodiment of the present invention, due in the embodiment of the present invention, method of data synchronization application In distributed system, system includes at least two servers, and first server receives the first verification letter that second server is sent Breath, the first check information be second server when determining that local data changes, according to after variation local data generate, That is after the local data of second server changes, second server generates the first check information according to the data after variation, Wherein the first check information includes the first checking parameter;First server participates in being locally stored in determining the first verification received The second checking parameter it is inconsistent when, by local data synchronize be second server data.As it can be seen that when the number of second server After changing, the first check information can be generated;Second server that first server receives by comparing send the First checking parameter and when inconsistent the second checking parameter for being locally stored in one verification letter, illustrate in first server data with Data are different in second server, then it is data in second server that first server, which synchronizes local data, in this way, contributing to Improve the real-time that data synchronize between first server and second server.
Above method flow is introduced in order to clearer, Fig. 3 illustrates another kind provided in an embodiment of the present invention Method of data synchronization.First server and second server can be GitLab servers in the embodiment.GitLab servers have WEB interface, the case where data in server can be understood in real time.Distributed system includes at least two GitLab servers, Each GitLab server real-time monitoring local datas;Any GitLab servers when monitoring local data and changing, Generate the first check information;Wherein, the first check information includes the first checking parameter and stabs at the first time.In the embodiment of the present invention It is first monitored for local data changes by second server;Local data is monitored in second server to change When, second server generates the first check information, and the first check information is sent to first server, in order to first service The first check information that device is sent according to second server determines whether to update local number with the second check information being locally stored According to.The real-time synchronization of data between different server may be implemented in the program.Specifically data synchronization process sees below content.
As shown in figure 3, the method for data synchronization includes:
Step 301, second server generates the first check information after determining that local data changes;First verification Information includes the first checking parameter and stabs at the first time;First checking parameter is that second server is determining that local data becomes When change, generated according to the local data after variation;Stamp is used to indicate second server local data and changes at the first time At the time of;
Step 302, second server sends the first check information to first server;
Step 303, first server determines what the first time in the first check information received stabbed and was locally stored Whether the second timestamp is consistent;Wherein, at the time of the second timestamp is used to indicate first server local data and changes;If Unanimously, 304 are thened follow the steps;If inconsistent, 305 are thened follow the steps, or execute step 306;
Step 304, first server determines the first checking parameter in the first check information for receiving and is locally stored The second checking parameter it is whether consistent;Wherein, the second checking parameter is that first server is generated according to current local data; If inconsistent, 307 are thened follow the steps;If consistent, 312 are thened follow the steps;
Step 305, if first server determines that the first time stamp in the first check information received is later than local deposit Local data is synchronized the data for second server by the second timestamp of storage, first server;Step 312 is executed later;
Step 306, if first server determines that the first time stamp in the first check information received is deposited earlier than local Second timestamp of storage, then local data synchronization is the data of second server by first server;Step 308 is executed later;
Step 307, local data is synchronized the data for second server by first server;
Step 308, first server generates third check information after determining that local data changes;Third verifies Information includes third checking parameter;Wherein, third checking parameter be first server when determining that local data changes, root It is generated according to the local data after variation;
Step 309, third check information is sent to second server by first server;
Step 310, second server is determining the third checking parameter received and the 4th checking parameter being locally stored When inconsistent, the first update request is generated, and update request is sent to first server;Wherein, the 4th checking parameter is second Server is generated according to current local data;
Step 311, first server receives the synchronized update request of second server, and corresponding data are sent to the Two servers;
Step 312, flow terminates.
It can be seen from the above:In the embodiment of the present invention, due in the embodiment of the present invention, method of data synchronization application In distributed system, system includes at least two servers, and first server receives the first verification letter that second server is sent Breath, the first check information be second server when determining that local data changes, according to after variation local data generate, That is after the local data of second server changes, second server generates the first check information according to the data after variation, Wherein the first check information includes the first checking parameter;First server participates in being locally stored in determining the first verification received The second checking parameter it is inconsistent when, by local data synchronize be second server data.As it can be seen that when the number of second server After changing, the first check information can be generated;Second server that first server receives by comparing send the First checking parameter and when inconsistent the second checking parameter for being locally stored in one verification letter, illustrate in first server data with Data are different in second server, then it is data in second server that first server, which synchronizes local data, in this way, contributing to Improve the real-time that data synchronize between first server and second server.
Based on the same technical idea, the embodiment of the present invention also provides a kind of first server, which is number According to any server in synchronous distributed system;The first server can perform above method embodiment.Fig. 4 is the present invention Embodiment provides a kind of structural schematic diagram of first server, as shown in figure 4, the first server 400 includes receiving unit 401, processing unit 402;Optionally, further include transmission unit 403.Wherein:
Receiving unit, the first check information for receiving second server transmission;First check information includes the first school Test parameter;First checking parameter be second server when determining that local data changes, according to the local data after variation It generates;
Processing unit, for determining that the first checking parameter received and the second checking parameter being locally stored are inconsistent When, local data is synchronized into the data for second server;Wherein, the second checking parameter is first server according to current sheet What ground data generated.
Optionally, processing unit is additionally operable to:After determining that local data changes, third check information is generated;Third Check information includes third checking parameter;Wherein, third checking parameter is that first server is determining that local data changes When, it is generated according to the local data after variation;
Further include transmission unit, is used for:Third check information is sent to second server;
Receiving unit is used for:The synchronized update request of second server is received, synchronized update request is that second server exists It is sent when the determining third checking parameter received and inconsistent the 4th checking parameter being locally stored, wherein the 4th verification Parameter is that second server is generated according to current local data.
Optionally, the first check information further includes stabbing at the first time, and stamp is used to indicate second server local at the first time At the time of data change;Processing unit is used for:If it is determined that when the first time received stabs earlier than second be locally stored Between when stabbing, then first local data is synchronized be second server data, after third check information is sent to second server; Wherein, at the time of the second timestamp is used to indicate first server local data and changes.
Optionally, processing unit is used for:If it is determined that the first time received stabs earlier than the second timestamp being locally stored When, it determines stab file identification corresponding with the second timestamp at the first time respectively;If it is determined that stabbing and the second timestamp at the first time Corresponding file identification is identical, then first by local data synchronize be second server data, after third check information is sent To second server.
Optionally, the first checking parameter is that second server carries out Hash operation generation to the local data after variation; Second checking parameter and third checking parameter are respectively that first server carries out Hash operation generation to the local data after variation 's;4th checking parameter is that second server carries out Hash operation generation to current local data.
It can be seen from the above:In the embodiment of the present invention, due in the embodiment of the present invention, method of data synchronization application In distributed system, system includes at least two servers, and first server receives the first verification letter that second server is sent Breath, the first check information be second server when determining that local data changes, according to after variation local data generate, That is after the local data of second server changes, second server generates the first check information according to the data after variation, Wherein the first check information includes the first checking parameter;First server participates in being locally stored in determining the first verification received The second checking parameter it is inconsistent when, by local data synchronize be second server data.As it can be seen that when the number of second server After changing, the first check information can be generated;Second server that first server receives by comparing send the First checking parameter and when inconsistent the second checking parameter for being locally stored in one verification letter, illustrate in first server data with Data are different in second server, then it is data in second server that first server, which synchronizes local data, in this way, contributing to Improve the real-time that data synchronize between first server and second server.
In the above-described embodiments, can come wholly or partly by software, hardware, firmware or its arbitrary combination real Now, it when being realized using software program, can entirely or partly realize in the form of a computer program product.Computer program Product includes one or more instructs.When loading on computers and executing computer program instructions, entirely or partly generate According to the flow or function of the embodiment of the present application.Computer can be all-purpose computer, special purpose computer, computer network or Other programmable devices of person.Instruction can be stored in computer storage media, or from a computer storage media to another One computer storage media transmission, for example, instruction can be logical from a web-site, computer, server or data center Wired (such as coaxial cable, optical fiber, Digital Subscriber Line (DSL)) or wireless (such as infrared, wireless, microwave etc.) mode are crossed to another One web-site, computer, server or data center are transmitted.Computer storage media, which can be computer, to be deposited Any usable medium taken is either set comprising data storages such as one or more usable mediums integrated server, data centers It is standby.Usable medium can be magnetic medium, (for example, floppy disk, hard disk, tape, magneto-optic disk (MO) etc.), optical medium (for example, CD, DVD, BD, HVD etc.) or semiconductor medium (such as ROM, EPROM, EEPROM, nonvolatile memory (NAND FLASH), Solid state disk (Solid State Disk, SSD)) etc..It should be understood by those skilled in the art that, the embodiment of the present application can provide For method, system or computer program product.Therefore, it is real that complete hardware embodiment, complete software can be used in the embodiment of the present application Apply the form of example or embodiment combining software and hardware aspects.Moreover, the embodiment of the present application can be used it is one or more its In include computer usable program code computer-usable storage medium (include but not limited to magnetic disk storage, CD-ROM, Optical memory etc.) on the form of computer program product implemented.
The embodiment of the present application is with reference to the method, equipment (system) and computer program product according to the embodiment of the present application Flowchart and/or the block diagram describe.It should be understood that can be by each flow in instruction implementation flow chart and/or block diagram And/or the combination of the flow and/or box in box and flowchart and/or the block diagram.These instructions can be provided and arrive general meter Calculation machine, special purpose computer, Embedded Processor or other programmable data processing devices processor to generate a machine, make The instruction executed by computer or the processor of other programmable data processing devices is obtained to generate for realizing in flow chart one The device for the function of being specified in a flow or multiple flows and/or one box of block diagram or multiple boxes.These instructions also may be used Being stored in can guide in computer or other programmable data processing devices computer-readable memory operate in a specific manner, So that instruction generation stored in the computer readable memory includes the manufacture of command device, which, which realizes, exists The function of being specified in one flow of flow chart or multiple flows and/or one box of block diagram or multiple boxes.
These instructions also can be loaded onto a computer or other programmable data processing device so that computer or other Series of operation steps are executed on programmable device to generate computer implemented processing, in computer or other are programmable The instruction that is executed in equipment is provided for realizing in one flow of flow chart or multiple flows and/or one box of block diagram or more The step of function of being specified in a box.
Obviously, those skilled in the art can carry out the embodiment of the present application various modification and variations without departing from this Shen Spirit and scope please.In this way, if these modifications and variations of the embodiment of the present application belong to the application claim and its wait Within the scope of technology, then the application is also intended to include these modifications and variations.

Claims (12)

1. a kind of method of data synchronization, which is characterized in that be applied to distributed system, the system comprises at least two services Device;At least two server includes first server and second server;The method includes:
The first server receives the first check information that the second server is sent;First check information includes the One checking parameter;First checking parameter be the second server when determining that local data changes, according to variation What local data afterwards generated;
The first server differs in determining first checking parameter received with the second checking parameter being locally stored When cause, local data is synchronized into the data for the second server;Wherein, second checking parameter is the first service Device is generated according to current local data.
2. the method as described in claim 1, which is characterized in that further include:
The first server generates third check information after determining that local data changes;The third check information Including third checking parameter;Wherein, the third checking parameter is that the first server is determining that local data changes When, it is generated according to the local data after variation;
The first server sends the third check information to the second server;
The first server receives the synchronized update request of the second server, and the synchronized update request is described second What server was sent when determining that the third checking parameter received and the 4th checking parameter being locally stored are inconsistent, In, the 4th checking parameter is that the second server is generated according to current local data.
3. method as claimed in claim 2, which is characterized in that first check information further includes stabbing at the first time, described At the time of stamp is used to indicate the second server local data and changes at the first time;
If the first server when determining that first time for receiving stabs earlier than the second timestamp being locally stored, First local data is synchronized be the second server data, after the third check information is sent to the second service Device;Wherein, at the time of second timestamp is used to indicate the first server local data and changes.
4. method as claimed in claim 3, which is characterized in that if the first server is described in determining receive When stamp is earlier than the second timestamp being locally stored at the first time, then local data is first synchronized to the number for the second server According to, after the third check information is sent to the second server, including:
If the first server when determining that the first time received stabs earlier than the second timestamp being locally stored, is divided The first time file identification corresponding with second timestamp Que Ding not be stabbed;
If the first server is determining that first time stamp file identification corresponding with second timestamp is identical, First local data is synchronized be the second server data, after the third check information is sent to the second service Device.
5. method as claimed in claim 2, which is characterized in that first checking parameter is the second server to variation Local data afterwards carries out Hash operation generation;
Second checking parameter and the third checking parameter are respectively the first server to the local data after variation Carry out Hash operation generation;
4th checking parameter is that the second server carries out Hash operation generation to current local data.
6. the distributed system that a kind of data synchronize, the system comprises at least two servers;At least two server Including first server and second server;Wherein, the first server includes:
Receiving unit, the first check information sent for receiving the second server;First check information includes the One checking parameter;First checking parameter be the second server when determining that local data changes, according to variation What local data afterwards generated;
Processing unit, for determining that first checking parameter received and the second checking parameter being locally stored are inconsistent When, local data is synchronized into the data for the second server;Wherein, second checking parameter is the first server It is generated according to current local data.
7. distributed system as claimed in claim 6, which is characterized in that the processing unit is additionally operable to:
After determining that local data changes, third check information is generated;The third check information includes third verification ginseng Number;Wherein, the third checking parameter be the first server when determining that local data changes, after variation What local data generated;
Further include transmission unit, is used for:
The third check information is sent to the second server;
The receiving unit, is used for:
The synchronized update request of the second server is received, the synchronized update request is that the second server connects in determination It is sent when the third checking parameter received and inconsistent the 4th checking parameter being locally stored, wherein the 4th school It is that the second server is generated according to current local data to test parameter.
8. distributed system as claimed in claim 7, which is characterized in that first check information further includes at the first time At the time of stamp, first time stamp are used to indicate the second server local data and change;
The processing unit, is used for:If it is determined that when the first time received stabs earlier than the second timestamp being locally stored, Then first by local data synchronize be the second server data, after by the third check information be sent to it is described second clothes Business device;Wherein, at the time of second timestamp is used to indicate the first server local data and changes.
9. distributed system as claimed in claim 8, which is characterized in that the processing unit is used for:
If it is determined that when the first time received stabs earlier than the second timestamp being locally stored, when determining described first respectively Between corresponding with second timestamp file identification of stamp;
If it is determined that first time, to stab file identification corresponding with second timestamp identical, then first local data is synchronized For the data of the second server, after the third check information is sent to the second server.
10. distributed system as claimed in claim 7, which is characterized in that first checking parameter is the second service Device carries out Hash operation generation to the local data after variation;
Second checking parameter and the third checking parameter are respectively the first server to the local data after variation Carry out Hash operation generation;
4th checking parameter is that the second server carries out Hash operation generation to current local data.
11. a kind of computer readable storage medium, which is characterized in that the computer-readable recording medium storage has computer can It executes instruction, the computer executable instructions are for making the computer perform claim require described in 1 to 5 any claim Method.
12. a kind of computer equipment, which is characterized in that including:
Memory, for storing program instruction;
Processor, for calling the program instruction stored in the memory, according to acquisition program execute as claim 1 to Method described in 5 any claims.
CN201810072776.2A 2018-01-24 2018-01-24 A kind of method of data synchronization and distributed system Pending CN108337303A (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN201810072776.2A CN108337303A (en) 2018-01-24 2018-01-24 A kind of method of data synchronization and distributed system
PCT/CN2018/124451 WO2019144761A1 (en) 2018-01-24 2018-12-27 Data synchronization method, distributed system and device
TW108102487A TWI751402B (en) 2018-01-24 2019-01-23 Data synchronization method, distributed system, computer readable storage and retrieval media, computer equipment and distributed equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810072776.2A CN108337303A (en) 2018-01-24 2018-01-24 A kind of method of data synchronization and distributed system

Publications (1)

Publication Number Publication Date
CN108337303A true CN108337303A (en) 2018-07-27

Family

ID=62925871

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810072776.2A Pending CN108337303A (en) 2018-01-24 2018-01-24 A kind of method of data synchronization and distributed system

Country Status (3)

Country Link
CN (1) CN108337303A (en)
TW (1) TWI751402B (en)
WO (1) WO2019144761A1 (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109146417A (en) * 2018-08-16 2019-01-04 安徽云才信息技术有限公司 A kind of project management method that single service line entry based on git is parallel
CN109362236A (en) * 2018-08-31 2019-02-19 深圳大学 Secure storage method of data, device, equipment and storage medium based on double clouds
CN109525654A (en) * 2018-11-02 2019-03-26 北京奇艺世纪科技有限公司 A kind of data acquisition, sending method, device, client and server
WO2019144761A1 (en) * 2018-01-24 2019-08-01 中国银联股份有限公司 Data synchronization method, distributed system and device
CN111326035A (en) * 2018-12-13 2020-06-23 腾讯科技(深圳)有限公司 Task synchronization method and remote teaching system
CN111352749A (en) * 2020-03-02 2020-06-30 珠海随变科技有限公司 Data synchronization method, device, equipment and storage medium
WO2021027115A1 (en) * 2019-08-13 2021-02-18 平安科技(深圳)有限公司 Data synchronization method, device, computer equipment and storage medium
CN112487470A (en) * 2019-09-11 2021-03-12 浙江宇视科技有限公司 Information verification method and device, terminal equipment and computer readable storage medium
CN113127082A (en) * 2021-04-23 2021-07-16 中国工商银行股份有限公司 Data processing method, server, service node, system and storage medium
CN114553895A (en) * 2022-04-24 2022-05-27 浙江中控技术股份有限公司 Data synchronization method, system, storage medium and electronic equipment
CN114648820A (en) * 2020-12-17 2022-06-21 浙江宇视科技有限公司 Information synchronization method, device, electronic equipment and medium

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110704226B (en) * 2019-09-19 2023-02-17 贝壳技术有限公司 Data verification method, device and storage medium
CN111245548B (en) * 2020-01-14 2024-08-20 平安国际智慧城市科技股份有限公司 Data synchronization method and device based on time stamp and computer equipment
CN113312367A (en) * 2021-06-25 2021-08-27 上海致景信息科技有限公司 Yield efficiency recalculation method, apparatus, storage medium and processor
CN113986243B (en) * 2021-10-26 2023-06-13 腾讯科技(深圳)有限公司 Resource synchronization method and related equipment
CN114697346B (en) * 2022-04-22 2024-06-11 厦门飞鱼科技有限公司 Method for synchronizing data between server nodes

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5862346A (en) * 1996-06-28 1999-01-19 Metadigm Distributed group activity data network system and corresponding method
CN1480859A (en) * 2002-09-03 2004-03-10 鸿富锦精密工业(深圳)有限公司 Synchronous system in distributed files and method
CN104243508A (en) * 2013-06-07 2014-12-24 富鸿康科技(深圳)有限公司 Server, client side and file synchronization method
CN105763644A (en) * 2016-04-21 2016-07-13 广州杰赛科技股份有限公司 Cloud disk file synchronization updating method and apparatus thereof
CN106330465A (en) * 2016-11-21 2017-01-11 航天信息股份有限公司 Processing method, server and system for distributed timestamp
CN106375362A (en) * 2015-07-24 2017-02-01 广州市百果园信息技术有限公司 Cache synchronization method and system for distributed server
CN107123045A (en) * 2017-04-14 2017-09-01 北京金融资产交易所有限公司 The data synchronous system and its method of data synchronization merchandised based on bond

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101043318B (en) * 2007-03-19 2010-12-15 华为技术有限公司 Method for synchronizing front-background data and apparatus thereof
US8332433B2 (en) * 2010-10-18 2012-12-11 Verisign, Inc. Database synchronization and validation
CN103731452A (en) * 2012-10-15 2014-04-16 鸿富锦精密工业(深圳)有限公司 File synchronization system and method
CN103997525B (en) * 2014-05-21 2017-10-20 北京天禾元创软件股份有限公司 A kind of Distributed Data Synchronization method and system
CN104092740B (en) * 2014-06-25 2016-05-04 腾讯科技(深圳)有限公司 Application data synchronous method and device
CN106980625B (en) * 2016-01-18 2020-08-04 阿里巴巴集团控股有限公司 Data synchronization method, device and system
TWI569159B (en) * 2016-05-31 2017-02-01 威聯通科技股份有限公司 Data synchronization method and device without redundant replication
CN106254094B (en) * 2016-07-19 2019-08-13 中国银联股份有限公司 A kind of method of data synchronization and system
CN108337303A (en) * 2018-01-24 2018-07-27 中国银联股份有限公司 A kind of method of data synchronization and distributed system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5862346A (en) * 1996-06-28 1999-01-19 Metadigm Distributed group activity data network system and corresponding method
CN1480859A (en) * 2002-09-03 2004-03-10 鸿富锦精密工业(深圳)有限公司 Synchronous system in distributed files and method
CN104243508A (en) * 2013-06-07 2014-12-24 富鸿康科技(深圳)有限公司 Server, client side and file synchronization method
CN106375362A (en) * 2015-07-24 2017-02-01 广州市百果园信息技术有限公司 Cache synchronization method and system for distributed server
CN105763644A (en) * 2016-04-21 2016-07-13 广州杰赛科技股份有限公司 Cloud disk file synchronization updating method and apparatus thereof
CN106330465A (en) * 2016-11-21 2017-01-11 航天信息股份有限公司 Processing method, server and system for distributed timestamp
CN107123045A (en) * 2017-04-14 2017-09-01 北京金融资产交易所有限公司 The data synchronous system and its method of data synchronization merchandised based on bond

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019144761A1 (en) * 2018-01-24 2019-08-01 中国银联股份有限公司 Data synchronization method, distributed system and device
CN109146417A (en) * 2018-08-16 2019-01-04 安徽云才信息技术有限公司 A kind of project management method that single service line entry based on git is parallel
CN109362236A (en) * 2018-08-31 2019-02-19 深圳大学 Secure storage method of data, device, equipment and storage medium based on double clouds
CN109525654A (en) * 2018-11-02 2019-03-26 北京奇艺世纪科技有限公司 A kind of data acquisition, sending method, device, client and server
CN109525654B (en) * 2018-11-02 2021-06-04 北京奇艺世纪科技有限公司 Data acquisition and sending method, device, client and server
CN111326035A (en) * 2018-12-13 2020-06-23 腾讯科技(深圳)有限公司 Task synchronization method and remote teaching system
WO2021027115A1 (en) * 2019-08-13 2021-02-18 平安科技(深圳)有限公司 Data synchronization method, device, computer equipment and storage medium
CN112487470A (en) * 2019-09-11 2021-03-12 浙江宇视科技有限公司 Information verification method and device, terminal equipment and computer readable storage medium
CN112487470B (en) * 2019-09-11 2024-04-05 浙江宇视科技有限公司 Information verification method, device, terminal equipment and computer readable storage medium
CN111352749A (en) * 2020-03-02 2020-06-30 珠海随变科技有限公司 Data synchronization method, device, equipment and storage medium
CN114648820A (en) * 2020-12-17 2022-06-21 浙江宇视科技有限公司 Information synchronization method, device, electronic equipment and medium
CN113127082A (en) * 2021-04-23 2021-07-16 中国工商银行股份有限公司 Data processing method, server, service node, system and storage medium
CN114553895A (en) * 2022-04-24 2022-05-27 浙江中控技术股份有限公司 Data synchronization method, system, storage medium and electronic equipment

Also Published As

Publication number Publication date
TW201933135A (en) 2019-08-16
TWI751402B (en) 2022-01-01
WO2019144761A1 (en) 2019-08-01

Similar Documents

Publication Publication Date Title
CN108337303A (en) A kind of method of data synchronization and distributed system
US11520808B2 (en) System and method for synchronizing data between communication devices in a networked environment without a central server
CN109951331B (en) Method, device and computing cluster for sending information
WO2019154394A1 (en) Distributed database cluster system, data synchronization method and storage medium
CN108664496B (en) Data migration method and device
CN109683826B (en) Capacity expansion method and device for distributed storage system
CN109522363B (en) Cloud platform synchronization method, system, equipment and storage medium based on block chain
CN110708196B (en) Data processing method and device
CN105471960A (en) Information interaction system and method between private clouds and public cloud
CN108932338A (en) Data-updating method, device, equipment and medium
US8756389B2 (en) Prevention of overlay of production data by point in time copy operations in a host based asynchronous mirroring environment
US20180234325A1 (en) Data Processing System with Machine Learning Engine to Provide Enterprise Monitoring Functions
CN110188103A (en) Data account checking method, device, equipment and storage medium
CN105760519A (en) Cluster file system and file lock allocation method thereof
EP4060514A1 (en) Distributed database system and data disaster backup drilling method
US11829609B2 (en) Data loss recovery in a secondary storage controller from a primary storage controller
CN115599665A (en) Disaster recovery system testing method and device, electronic equipment and storage medium
US10397071B2 (en) Automated deployment of cloud-hosted, distributed network monitoring agents
CN114422331A (en) Disaster tolerance switching method, device and system
US10776392B2 (en) Apparatus and method to establish a connection between apparatuses while synchronization of connection information thereof is suspended
CN106294033A (en) The method of testing of a kind of many machine rooms cache synchronization function and device
WO2019240274A1 (en) Orchestration device, vnfm device, management device and program
US20190340043A1 (en) Message affinity in geographically dispersed disaster restart systems
CN102868594B (en) Method and device for message processing
CN109062731A (en) Idempotent control method and device when a kind of database switches

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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 1257736

Country of ref document: HK

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20180727