Disclosure of Invention
In view of this, the embodiment of the invention provides a method for synchronizing data, a first server and a system for synchronizing data, wherein the first server monitors a second pointer on a second server in real time, and when judging that the second pointer is different from a first pointer of the first server, the first server can determine data to be synchronized on the second server according to the second pointer in time, so that the effect of synchronizing the first data of the first server in time is achieved. In addition, the first server can only synchronize the data to be synchronized on the determined second server, and the whole data of the second server does not need to be traversed, so that the operation resources of the first server are saved, and the performance of the first server can be effectively exerted.
To achieve the above object, according to one aspect of an embodiment of the present invention, there is provided a method of synchronizing data.
The method for synchronizing data is applied to a first server, wherein the first server comprises first data and a first pointer, the first pointer is used for indicating the last updated data in the first data, and the method comprises the following steps:
monitoring a second pointer on a second server in real time, wherein the second pointer is used for indicating the last updated data in second data on the second server;
judging whether the first pointer is the same as the second pointer, if not, determining data to be synchronized on the second server according to the second pointer;
and synchronizing the first data with the second data according to the data to be synchronized.
Alternatively, the process may be carried out in a single-stage,
According to the data to be synchronized, synchronizing the first data with the second data, including:
And updating the first data according to the data to be synchronized so as to realize the synchronization of the first data and the second data.
Alternatively, the process may be carried out in a single-stage,
Updating the first data according to the data to be synchronized, including:
determining a cache queue for storing data to be synchronized, wherein the cache queue comprises the data to be synchronized and a second pointer identifier corresponding to the data to be synchronized;
The following steps are circularly executed until the first pointer and the second pointer are the same:
And the first pointer is increased, a second pointer identification which is the same as the increased first pointer is determined from the cache queue, and the first data is updated according to the data to be synchronized corresponding to the determined second pointer identification.
Alternatively, the process may be carried out in a single-stage,
Judging whether the first pointer and the second pointer are the same, comprising:
and determining whether the first pointer and the second pointer are identical by receiving data updating broadcast sent by the central server or monitoring the second pointer in real time.
Alternatively, the process may be carried out in a single-stage,
The method further comprises the steps of:
And starting timing after the first data are synchronized, and acquiring second data from a second server and replacing the first data according to the acquired second data when the recorded duration reaches a first preset duration threshold and new synchronization is not performed on the first data in the recorded duration.
Alternatively, the process may be carried out in a single-stage,
The first data includes any one or more of an item identification, an inventory count of items, and a storage location of the items.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided a first server.
The first server of the embodiment of the invention comprises a monitoring module, a judging module and a synchronizing module, wherein:
the monitoring module is used for monitoring a second pointer on the second server in real time, and the second pointer is used for indicating the last updated data in the second data on the second server;
The judging module is used for judging whether the first pointer is the same as the second pointer acquired by the monitoring module, if not, determining the data to be synchronized on the second server according to the second pointer;
And the synchronization module is used for synchronizing the first data and the second data according to the data to be synchronized determined by the judgment module.
To achieve the above object, according to still another aspect of an embodiment of the present invention, a system for synchronizing data is provided.
The system for synchronizing data in the embodiment of the invention comprises a first server and a second server, wherein the first server and the second server are provided in the embodiment of the invention, and the first server comprises:
The second server comprises second data and a second pointer, wherein the second pointer is used for indicating the last updated data in the second data, and when the second data is updated, the second pointer is updated.
Alternatively, the process may be carried out in a single-stage,
The second server is further configured to cyclically execute the following steps until the updated data is all saved to the second data:
Increment the second pointer and save the updated data to the second data.
Alternatively, the process may be carried out in a single-stage,
The second server is further used for storing the updated data and the corresponding second pointer identification into a cache queue, and taking the updated data as data to be synchronized, so that the first server updates the first data according to the data to be synchronized corresponding to the second pointer identification.
Alternatively, the process may be carried out in a single-stage,
And the second server is further used for deleting the data to be synchronized and the second pointer identification in the cache queue when the data to be synchronized in the cache queue is not read within a second preset duration threshold.
To achieve the above object, according to still another aspect of an embodiment of the present invention, there is provided a server for synchronizing data.
The server for synchronizing data according to the embodiment of the invention comprises one or more processors and a storage device, wherein the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are enabled to realize the method for synchronizing data according to the embodiment of the invention.
To achieve the above object, according to still another aspect of the embodiments of the present invention, there is provided a computer-readable storage medium.
A computer readable storage medium of an embodiment of the present invention has stored thereon a computer program which, when executed by a processor, implements a method of synchronizing data of an embodiment of the present invention.
The embodiment of the invention has the advantages that when the data on the second server is changed, the corresponding data on the first server can be synchronously updated in time, and the first server only synchronously updates the changed data on the second server without traversing all the data of the second server, so that the operation resources of the first server are saved, and the performance of the first server is more effectively exerted.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that the embodiments of the present invention and the technical features in the embodiments may be combined with each other without collision.
Fig. 1 is a schematic diagram of main steps of a method of synchronizing data according to an embodiment of the present invention.
As shown in fig. 1, a method for synchronizing data according to an embodiment of the present invention mainly includes the following steps:
and step S101, monitoring a second pointer on the second server in real time, wherein the second pointer is used for indicating the last updated data in the second data on the second server.
The method for synchronizing data is applied to a first server, wherein the first server is a server configured locally in a related technology of a distributed system, and the first server is a virtual machine configured locally in a related technology of a virtual machine. The first server stores first data and a first pointer, wherein the first data refers to cache data on the first server, and the first pointer is used for indicating data which is updated last in the first data.
In an embodiment of the present invention, the first data may include any one or more of an item identification, an inventory count of items, and a storage location of the items.
In the embodiment of the invention, the first server monitors the second pointer on the second server in real time so as to ensure that whether the second data on the second server is updated or not is timely known. The second server is a central server in the related technology of the distributed system or the related technology of the virtual machine, and can be deployed on the line or the cloud. The second server stores second data and a second pointer, and the second pointer is used for indicating the last updated data in the second data.
In the embodiment of the invention, when the second data on the second server is not updated or the second data is updated and the first server is synchronous, the first data and the second data are the same, and when the second data on the second server is changed and the first server is synchronous, the first data and the second data are different. However, the second pointer on the second server is monitored in real time by the first server, when the second data on the second server is updated, the process of synchronizing the data by the first server can be started in time, and the time consumption of the synchronization process is very short under the current network transmission technology, so that the first data on the first server is consistent with the second data on the second server in most of time, and the problem that the data on different servers cannot be synchronized in time currently is solved to a great extent.
Step S102, judging whether the first pointer and the second pointer are the same, if not, determining the data to be synchronized on the second server according to the second pointer.
In the embodiment of the invention, the first pointer and the second pointer can respectively store the quantity of the first data and the second data, at this time, the first pointer and the second pointer are equivalent to a counter, when the data is updated, the second pointer is circularly added with 1, and when the data is synchronized, the first pointer is circularly added with 1, so that the first pointer and the second pointer respectively indicate the last updated data in the first data and the second data. For example, the first pointer is 182 at a certain moment, which means that 182 data exists in the first data, the 182 th data is the last updated data of the first server, and the first server monitors 184 second pointers, which means 184 data exists in the second data, and 184 th data is the last updated data of the second server, so that the first server can determine that the first pointer and the second pointer are different, and further determine the data to be synchronized on the second server according to the second pointer.
In the embodiment of the invention, when the physical starting address of the first data on the first server is the same as the physical starting address of the second data on the second server, the first pointer and the second pointer can also respectively store the physical address of the last updated data in the first data and the second data, when the data is updated, the second pointer circularly adds a step length, and when the data is synchronized, the first pointer circularly adds a step length. For example, at a certain moment, the first pointer points to "11230H", which means that the last updated data in the first data is stored in "11230H", and at this moment, the first server monitors to know that the second pointer points to "1123AH", which means that the last updated data in the second data is stored in "1123AH", so that the first server can determine that the first pointer and the second pointer are different, and further determine the data to be synchronized on the second server according to the second pointer.
In the embodiment of the invention, the first server can also monitor the second data pointed by the second pointer in real time, and determine whether the second data is updated by judging whether the first data pointed by the first pointer is the same as the second data pointed by the second pointer. When the first data pointed by the first pointer is different from the second data pointed by the second pointer, the second data is changed, and the first server determines the data to be synchronized on the second server according to the second pointer.
In the embodiment of the invention, the data to be synchronized is the data which is updated on the second server but not synchronized by the first server. When the first pointer and the second pointer are judged to be different, the first server can determine the data to be synchronized on the second server according to the second pointer. Thus, the first server can only execute the synchronous operation on the data to be synchronized, without traversing the second data on the second server to determine the data to be synchronized, and without realizing the function of synchronizing the data by acquiring all the second data on the second server. As can be seen from the above description, the embodiment of the present invention can realize the function of synchronizing data under the condition of occupying very few server resources, and does not affect the normal performance of the server.
In the embodiment of the invention, the first server can determine whether the first pointer is identical to the second pointer by monitoring the second pointer in real time, or can determine whether the first pointer is identical to the second pointer by receiving data update broadcast sent by the second server.
Step S103, according to the data to be synchronized, the first data and the second data are synchronized.
In the embodiment of the invention, after the first server determines the data to be synchronized on the second server according to the second pointer, the first data is updated according to the data to be synchronized so as to realize synchronization of the first data and the second data. Fig. 2 is a schematic diagram illustrating main steps of a method for updating first data according to data to be synchronized according to an embodiment of the present invention.
As shown in fig. 2, a method for updating first data according to data to be synchronized according to an embodiment of the present invention mainly includes the following steps:
Step S201, determining a cache queue for storing data to be synchronized, wherein the cache queue comprises the data to be synchronized and a second pointer identifier corresponding to the data to be synchronized;
Step S202, a first pointer is increased, and a second pointer identification which is the same as the increased first pointer is determined from a cache queue;
Step 203, updating the first data according to the determined data to be synchronized corresponding to the second pointer identification;
Step S204, judging whether the first pointer and the second pointer are the same, if not, returning to the step S202, and if so, executing the step S205;
Step 205, the current flow is ended.
In the embodiment of the invention, the updating of the second data comprises operations such as adding, deleting and modifying, and the data amount in the second data is increased at the moment, namely, when new data exists, the second server directly writes the new data into the second data, and when the original data is deleted or modified, the second server adds a deleting or modifying identifier based on the original second data so as to generate new second data. The second pointer records the changed position of the second data in an incremental mode.
The first server synchronizes the first data and the second server updates the second data similarly, specifically, when the second data has new data, the first server directly writes the new data into the first data, and when the second data has deleting or modifying operation, the first server adds deleting or modifying identification based on the original first data so as to generate new first data. At this time, the data amount in the first data is increased, and the first pointer records the position where the first data is changed in an incremental manner.
In the embodiment of the invention, the change track of the second data is stored in the cache queue. The cache queue may include data to be synchronized and a second pointer identifier corresponding to the data to be synchronized, where the second pointer identifier is used to store a value of the second pointer when the corresponding data to be synchronized is indicated by the second pointer. At this time, the first server directly determines corresponding data to be synchronized according to the second pointer identification which is the same as the first pointer after the increment, and updates the first data according to the data to be synchronized.
In the embodiment of the invention, the cache queue may also include a data id to be synchronized and a second pointer identifier corresponding to the data id to be synchronized, where the second pointer identifier is used to store a value of the second pointer when the corresponding data id to be synchronized is indicated by the second pointer. At this time, the first server determines the corresponding data id to be synchronized according to the second pointer identification which is the same as the first pointer after the increment, then determines the corresponding data to be synchronized from the second data according to the data id to be synchronized, and then updates the first data according to the data to be synchronized.
In the embodiment of the present invention, the first pointer and the second pointer may be incremented from 1, and each time the first data and the second data change, the first pointer and the second pointer are respectively incremented by one step.
In the embodiment of the invention, when the first server is not synchronized with the second server for a long time, all the second data can be pulled from the second server and the first data can be replaced, so that accidental errors in the data transmission process can be avoided. The first server starts timing after updating the first data, and when the recorded duration reaches a first preset duration threshold and no new data update occurs in the recorded duration, the first server acquires all second data from the second server and replaces the first data according to all acquired second data. And if the first server performs synchronous operation in the timing process, resetting the recorded duration and re-timing. In a preferred embodiment of the present invention, the first preset time period threshold may be 30 minutes.
According to the method for synchronizing data, disclosed by the embodiment of the invention, the first server can determine the data to be synchronized on the second server according to the second pointer in time when judging that the second pointer is different from the first pointer of the first server by monitoring the second pointer on the second server in real time, so that the effect of synchronizing the first data of the first server in time is realized. In addition, the first server can only synchronize the data to be synchronized on the determined second server, and the whole data of the second server does not need to be traversed, so that the operation resources of the first server are saved, and the performance of the first server can be effectively exerted.
Fig. 3 is a schematic diagram of main modules of a first server according to an embodiment of the present invention.
As shown in fig. 3, a first server 300 according to an embodiment of the present invention includes a monitoring module 301, a judging module 302, and a synchronizing module 303, where:
The monitoring module 301 is configured to monitor, in real time, a second pointer on the second server, where the second pointer is used to indicate data that is updated last in second data on the second server;
A judging module 302, configured to judge whether the first pointer is the same as the second pointer acquired by the monitoring module 301, if not, determine data to be synchronized on the second server according to the second pointer;
And the synchronizing module 303 is configured to synchronize the first data with the second data according to the data to be synchronized determined by the determining module 302.
In the embodiment of the present invention, the synchronization module 303 may be further configured to update the first data according to the data to be synchronized, so as to achieve synchronization between the first data and the second data.
In the embodiment of the invention, the synchronization module 303 may be further configured to determine a cache queue for storing the data to be synchronized, where the cache queue includes the data to be synchronized and a second pointer identifier corresponding to the data to be synchronized, and circularly execute the following steps until the first pointer is the same as the second pointer, increment the first pointer, determine the second pointer identifier same as the incremented first pointer from the cache queue, and update the first data according to the data to be synchronized corresponding to the determined second pointer identifier.
In an embodiment of the present invention, the determining module 302 may also be configured to determine whether the first pointer and the second pointer are the same by receiving a data update broadcast sent by the central server, or monitoring the second pointer in real time.
In this embodiment of the present invention, the synchronization module 303 may be further configured to start timing after updating the first data, obtain the second data from the second server when the recorded duration reaches the preset duration threshold and no new data update occurs within the recorded duration, and replace the first data according to the obtained second data.
In an embodiment of the invention, the first data includes any one or more of an item identification, an inventory count of items, and a storage location of the items.
According to the first server, the first server monitors the second pointer on the second server in real time, and when judging that the second pointer is different from the first pointer of the first server, the first server can determine the data to be synchronized on the second server according to the second pointer in time, so that the effect of synchronizing the first data of the first server in time is achieved. In addition, the first server can only synchronize the data to be synchronized on the determined second server, and the whole data of the second server does not need to be traversed, so that the operation resources of the first server are saved, and the performance of the first server can be effectively exerted.
Fig. 4 is a schematic diagram of main modules of a system for synchronizing data according to an embodiment of the present invention.
As shown in fig. 4, a system 400 for synchronizing data according to an embodiment of the present invention includes a first server 300 and a second server 401 provided in the above embodiment of the present invention, where:
the second server 401 includes second data and a second pointer for indicating data that is updated last in the second data, and updates the second pointer when the second data is updated.
In an embodiment of the present invention, the second server 401 may be further configured to perform the steps of cyclically executing the steps of incrementing the second pointer until the updated data is all saved in the second data, and saving the updated data in the second data.
In the embodiment of the present invention, the second server 401 may be further configured to store the updated data and the corresponding second pointer identifier into a cache queue, and use the updated data as the data to be synchronized, so that the first server updates the first data according to the data to be synchronized corresponding to the second pointer identifier.
In the embodiment of the present invention, the second server 401 may be further configured to set an expiration policy, that is, delete the data to be synchronized and the second pointer identifier in the cache queue when the data to be synchronized in the cache queue is not read within the second preset duration threshold, so as to avoid occurrence of erroneous data.
In the embodiment of the present invention, the cache queue may also include a data id to be synchronized and a second pointer identifier corresponding to the data id to be synchronized, where the second server 401 may be further configured to delete the data id to be synchronized and the second pointer identifier in the cache queue when the data id to be synchronized in the cache queue is not read within a second preset duration threshold. In a preferred embodiment of the present invention, the second preset time period threshold may be 30 minutes.
According to the system for synchronizing data, which is disclosed by the embodiment of the invention, the first server can determine the data to be synchronized on the second server according to the second pointer in time when judging that the second pointer is different from the first pointer of the first server by monitoring the second pointer on the second server in real time, so that the effect of synchronizing the first data of the first server in time is realized. In addition, the first server can only synchronize the data to be synchronized on the determined second server, and the whole data of the second server does not need to be traversed, so that the operation resources of the first server are saved, and the performance of the first server can be effectively exerted.
A method of synchronizing data provided by the present scheme is described below in accordance with a more complete embodiment.
Fig. 5 is a schematic diagram of main steps of another method of synchronizing data according to an embodiment of the present invention.
As shown in fig. 5, another method for synchronizing data according to an embodiment of the present invention mainly includes the following steps:
In step S501, the first server monitors, in real time, a second pointer on the second server, where the second pointer is used to indicate data that is updated last in the second data on the second server.
Step S502, the second server receives the updated data, circularly adds 1 to the second pointer, and stores the updated data into the second data.
In step S503, the second server uses the updated data as the data to be synchronized, stores the id of the data to be synchronized and the corresponding second pointer identification into the cache queue, and sets an expiration policy.
In the embodiment of the invention, the purpose of setting the expiration policy is to save the space of the cache queue, because when the data in the cache queue is read by all the first servers, the data is not used, and error data may also occur, the data id to be synchronized and the second pointer identifier in the cache queue are deleted after expiration.
In step S504, the first server judges whether the first pointer and the second pointer are the same, and when the first pointer and the second pointer are different, the first server reads data to be synchronized from a cache queue of the second server.
In step S505, the first server circularly adds 1 to the first pointer, determines the corresponding data id to be synchronized according to the second pointer identification identical to the first pointer, and determines the corresponding data to be synchronized from the second data according to the data id to be synchronized.
In step S506, the first server synchronizes the first data according to the data to be synchronized.
Fig. 6 illustrates an exemplary system architecture 600 of a method of synchronizing data or a first server to which embodiments of the invention may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 is used as a medium to provide communication links between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 605 via the network 604 using the terminal devices 601, 602, 603 to receive or send messages, etc. Various communication client applications, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc., may be installed on the terminal devices 601, 602, 603.
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 605 may be a server providing various services, such as a background management server providing support for shopping-type websites browsed by the user using the terminal devices 601, 602, 603. The background management server can analyze and other processing on the received data such as the product information inquiry request and the like, and feed back processing results (such as target push information and product information) to the terminal equipment.
It should be understood that the number of terminal devices, networks and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, there is illustrated a schematic diagram of a computer system 700 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 7 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, ROM 702, and RAM 703 are connected to each other through a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
Connected to the I/O interface 705 are an input section 706 including a keyboard, a mouse, and the like, an output section 707 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like, a storage section 708 including a hard disk, and the like, and a communication section 709 including a network interface card such as a LAN card, a modem, and the like. The communication section 709 performs communication processing via a network such as the internet. The drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read therefrom is mounted into the storage section 708 as necessary.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 709, and/or installed from the removable medium 711. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 701.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of a computer-readable storage medium may include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, a processor may be described as comprising a monitoring module, a judging module and a synchronizing module. The names of these modules do not in any way limit the module itself, for example, the monitoring module may also be described as "module for monitoring the second pointer on the second server in real time".
As a further aspect, the invention also provides a computer readable medium which may be comprised in the device described in the above embodiments or may be present alone without being fitted into the device. The computer readable medium carries one or more programs, which when executed by the device, cause the device to include monitoring a second pointer on the second server in real time, the second pointer indicating data that is last updated in second data on the second server, determining whether the first pointer and the second pointer are the same, if not, determining data to be synchronized on the second server according to the second pointer, and synchronizing the first data and the second data according to the data to be synchronized.
According to the technical scheme provided by the embodiment of the invention, the first server monitors the second pointer on the second server in real time, and when judging that the second pointer is different from the first pointer of the first server, the first server can timely determine the data to be synchronized on the second server according to the second pointer, so that the effect of timely synchronizing the first data of the first server is realized. In addition, the first server can only synchronize the data to be synchronized on the determined second server, and the whole data of the second server does not need to be traversed, so that the operation resources of the first server are saved, and the performance of the first server can be effectively exerted.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.