Data synchronization method and device, equipment, storage medium and product
By setting synchronization rules in GitLab's data synchronization system and automating the synchronization process, the problem of low efficiency of data synchronization on dual-server side in cross-network environments is solved, efficient incremental synchronization is achieved, and the work efficiency of medium-sized R&D organizations is improved and system flexibility.
Patent Information
- Application Number
- CN202411312734.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-12-10
AI Technical Summary
GitLab lacks automated inter-repository synchronization solutions in cross-network environments, resulting in low data synchronization between dual servers, especially in medium-sized R&D organizations that require manual configuration of thousands of synchronization rules, which is inefficient in work.
By setting synchronization rules in the data synchronization system, the differential data between the source server and the destination server are automatically obtained and synchronized, incremental synchronization is achieved, manual intervention and data transmission is reduced, and multiple source servers are supported to synchronize data to the destination server.
It significantly improves the efficiency and flexibility of data synchronization, saves labor and time costs, reduces configuration complexity, and improves the scalability and accuracy of the system.
Smart Images

Figure CN119109936A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data processing technology, and in particular, relates to a data synchronization method, device, equipment, storage medium and product. Background Art
[0002] GitLab is an open source Git repository management platform that supports team collaborative development and integrates version control, issue tracking, continuous integration / continuous delivery and other functions. In GitLab, projects are managed through groups. Each group contains multiple project repositories to achieve centralized management of source code. The collaborative development process includes: Project initialization: The project leader creates a Git group and project repository, and sets the main branch. Local development: Developers clone the project repository locally and develop on their own branches. Code submission and review: After development is completed, the local branch code is pushed to the corresponding branch on the GitLab server for review. Code merge: After the review is passed, the code is merged into the main branch.
[0003] However, GitLab currently mainly supports a single network environment service model, that is, all code operations are completed in the same GitLab instance. For cross-network environments (such as deploying GitLab separately at the corporate headquarters and branches), GitLab does not natively support automatic synchronization between code repositories. There is no good solution for synchronization between dual-server Gitlabs in the prior art. Generally, it is synchronized through a single project repository, but the incremental synchronization method of a single project repository is cumbersome to configure, and the synchronization address and rules need to be configured separately for each project repository under the Git group to be synchronized. A medium-sized R&D organization usually has thousands of project code repositories. If synchronization between the two servers is performed through a single project repository synchronization, manual intervention is required, and thousands of synchronization rules are manually configured, which is inefficient. Summary of the invention
[0004] The embodiments of the present application provide a data synchronization method, apparatus, device, storage medium and product to solve the problem of low synchronization efficiency when synchronizing data between two servers.
[0005] In a first aspect, an embodiment of the present application provides a data synchronization method, which is applied to a data synchronization system, wherein the data synchronization system is connected to a destination server, and the method includes:
[0006] By means of the data synchronization system, a synchronization rule of the destination server is set, and the destination server obtains first data to be synchronized from at least one source server according to the synchronization rule;
[0007] When the synchronization rule is used to determine that the current time point reaches the synchronization time point, obtaining first data to be synchronized of the at least one source server, the first data to be synchronized being data that differs between the source server and the destination server from the last synchronization to the current time point;
[0008] The first data to be synchronized is synchronized to the destination server.
[0009] In a second aspect, an embodiment of the present application provides a data synchronization device, the device comprising:
[0010] A setting module, configured to set a synchronization rule of the destination server through the data synchronization system, and the destination server obtains first data to be synchronized from at least one source server according to the synchronization rule;
[0011] A first acquisition module is used to acquire first data to be synchronized of the at least one source server when the current time point is determined to reach the synchronization time point by using the synchronization rule, wherein the first data to be synchronized is data that differs between the source server and the destination server from the last synchronization to the current time point;
[0012] The first synchronization module is used to synchronize the first data to be synchronized to the destination server.
[0013] In a third aspect, an embodiment of the present application provides a terminal device, the device comprising: a processor and a memory storing computer program instructions;
[0014] When the processor executes the computer program instructions, the data synchronization method of the first aspect is implemented.
[0015] In a fourth aspect, an embodiment of the present application provides a computer storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the data synchronization method of the first aspect is implemented.
[0016] In a fifth aspect, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the data synchronization method of the first aspect.
[0017] The data synchronization method provided in the embodiment of the present application significantly reduces manual intervention and improves synchronization efficiency by centrally setting synchronization rules and automating the synchronization process. In particular, for medium-sized R&D organizations with a large number of project code repositories, this method avoids the tedious work of manually configuring thousands of synchronization rules, greatly saving manpower and time costs. Secondly, the method adopts an incremental synchronization mechanism, which only synchronizes data that has changed since the last synchronization to the current time point, effectively reducing the amount of data transmission and improving the synchronization speed and efficiency. In addition, the present embodiment only needs to configure the synchronization rules in the destination server to support synchronization of data from multiple source servers to the destination server, which improves the flexibility and scalability of the system and further improves the data synchronization efficiency between the two servers. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0019] Figure 1 It is a flowchart of a data synchronization method provided in an embodiment of the present application;
[0020] Figure 2 It is a connection diagram between the destination server and the source server provided in an embodiment of the present application;
[0021] Figure 3 is a flow chart for setting synchronization rules provided in an embodiment of the present application;
[0022] Figure 4 It is an overall flow chart of the data synchronization method provided in the embodiment of the present application;
[0023] Figure 5 is a structural diagram of a data synchronization device provided in an embodiment of the present application;
[0024] Figure 6 It is a schematic diagram of the structure of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0026] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0027] In order to solve the problems of the prior art, the embodiments of the present application provide a data synchronization method, device, equipment, storage medium and product.
[0028] The following first introduces the data synchronization method provided in the embodiment of the present application.
[0029] Figure 1 FIG. 1 is a flow chart of a data synchronization method provided by an embodiment of the present application. Figure 1 As shown, the method includes:
[0030] Step 101, setting a synchronization rule of the destination server through the data synchronization system, and the destination server obtains first data to be synchronized from at least one source server according to the synchronization rule;
[0031] In this embodiment, the data synchronization system is used to control the data synchronization of the destination server and is connected to the destination server. In addition, the source server is also connected to another data synchronization system, so that data synchronization between the source server and the destination server is achieved through the two data synchronization systems.
[0032] As an example, Figure 2 As shown, Figure 2The figure is a connection diagram between the destination server and the source server; GitLab service A can be the destination server, and synchronization system A is the data synchronization system connected to the destination server; GitLab service B can be the source server, and synchronization system B is the data synchronization system connected to the source server. By setting up data synchronization systems in different servers, data synchronization between different servers can be achieved.
[0033] It should be noted that the destination server is the target of data synchronization, that is, the server to which the data will be synchronized. The destination server can be a database server, a file server, or any system that needs to receive updated data. The source server is the server that contains the original data or updated data that needs to be synchronized to the destination server. There may be one or more source servers.
[0034] The above synchronization rules may include the service address of the source server, synchronization frequency, synchronization sub-rule and synchronization content. There may be multiple service addresses of the source server, corresponding to multiple different source servers, so that data can be synchronized from multiple source servers at the same time.
[0035] Step 102: when the current time point reaches the synchronization time point, obtaining first data to be synchronized of the at least one source server by using the synchronization rule;
[0036] In this embodiment, after the destination server performs data synchronization, it will update the next synchronization time point, so when the current time point reaches the synchronization time point, data synchronization can be performed. In addition, in addition to judging whether the current time reaches the synchronization time point, data synchronization can also be performed based on time (such as every hour, every day, etc.) or based on events (such as when data updates reach a certain amount).
[0037] Since the synchronization rule defines the specific details of synchronization, the synchronization rule needs to be used to determine the first data to be synchronized. The first data to be synchronized is the data with differences between the source server and the destination server from the last synchronization to the current time point.
[0038] Step 103: synchronize the first data to be synchronized to the destination server.
[0039] After obtaining the first data to be synchronized, the data synchronization system synchronizes the first data to be synchronized to the destination server, thereby completing the data synchronization between the destination server and the source server.
[0040] In this embodiment, by centrally setting the synchronization rules and automating the synchronization process, manual intervention is significantly reduced and synchronization efficiency is improved. Especially for medium-sized R&D organizations with a large number of project code repositories, this method avoids the tedious work of manually configuring thousands of synchronization rules, greatly saving manpower and time costs. Secondly, the method adopts an incremental synchronization mechanism, which only synchronizes data that has changed since the last synchronization to the current time point, effectively reducing the amount of data transmission and improving the synchronization speed and efficiency. In addition, this embodiment only needs to configure the synchronization rules in the destination server to support synchronization of data from multiple source servers to the destination server, which improves the flexibility and scalability of the system and further improves the data synchronization efficiency between the two servers.
[0041] In an embodiment of the present application, setting the synchronization rule of the destination server through the data synchronization system includes:
[0042] Receiving an interface input operation to the data synchronization system;
[0043] In response to the interface input operation, the synchronization frequency, synchronization address source and synchronization content of the destination server are set.
[0044] In this embodiment, the synchronization rules include synchronization frequency, synchronization address source, and synchronization content. Among them, the synchronization frequency refers to the frequency of data synchronization operation execution, such as once an hour, once a day, or triggered by a specific event. This frequency directly affects the timeliness of data updates and the occupation of system resources. The synchronization address source refers to the source address of the data to be synchronized, that is, the specific location or identification of the source server. In the scenario of cross-network environment or cross-system synchronization, this address can be a URL, IP address, or specific service interface. The synchronization content defines which data will be synchronized. This can be an entire database, a specific table, a file, or a data record that meets specific conditions. Accurate control of synchronization content helps reduce unnecessary data transmission and improve synchronization efficiency.
[0045] Users can operate through the graphical user interface provided by the data synchronization system without writing complex codes or scripts. When the user enters the relevant information of the synchronization rules through the interface, including: synchronization frequency, synchronization address source, synchronization content, etc., and submits it, the data synchronization system will immediately respond to these operations. The system will verify the validity and rationality of the input information and automatically configure the synchronization rules according to the user's settings.
[0046] Once the synchronization rules are set and verified, the data synchronization system will automatically perform data synchronization operations according to these rules. When the synchronization time point is reached, the system will automatically obtain the data to be synchronized from the specified source server and synchronize this data to the destination server, thereby achieving real-time or periodic data updates.
[0047] like Figure 3 As shown, Figure 3 This is a flowchart for setting synchronization rules; the Git group and Git in the figure both represent source servers, and sub-projects can be tables in the database, folders or files in the file system, etc. Figure 3 The synchronization source Git service address in is the synchronization address source. "Set to skip unsynchronized subprojects", "Set whether to create new subprojects synchronously", "Set whether to delete subprojects synchronously" and "Set whether to synchronize comment information" are all synchronization contents.
[0048] In addition, after the synchronization rule is configured, the synchronization rule can be sent to the source server so that the source server configures the synchronization rule to achieve two-way data transmission between the source server and the destination server.
[0049] In this embodiment, the synchronization rules are flexibly set through the interface input operation, providing users with a convenient and efficient data synchronization solution. This solution not only reduces technical difficulty and cost, but also improves the accuracy and reliability of data synchronization.
[0050] In an embodiment of the present application, the obtaining the first data to be synchronized of the at least one source server by using the synchronization rule includes:
[0051] Acquire a first sub-item of data change that occurs in each source server of the at least one source server from the last synchronization to the current time point, wherein the first sub-item is used to store data;
[0052] Comparing the changed data in the first sub-project with the original data in the destination server to see if there are any differences;
[0053] When there is a difference between the changed data in the first sub-project and the original data in the destination server, the changed data is determined as the first data to be synchronized using the synchronization rule, and the changed data is the data changed in the first sub-project.
[0054] In this embodiment, first, the system needs to detect which data has changed on each source server since the last synchronization operation to the current time point. This can usually be achieved by comparing specific data identifiers (such as timestamps, version numbers or hash values) in the source server or by using database transaction logs, change data capture mechanisms and other technologies. In this process, the system identifies the "first sub-items" that store data, and the data in these sub-items has changed since the last synchronization, where the first sub-item can refer to a table in a database, a folder or file in a file system, etc.
[0055] Next, the system will perform a detailed comparison of the data in the first sub-items that have changed to confirm whether there are any differences between the changed data and the original data already existing in the destination server. During the comparison process, the system can use record-by-record comparison, hash value comparison, or other efficient data comparison algorithms to quickly identify the difference data, which is not limited in this embodiment.
[0056] After confirming that there are data differences, the system will decide which changed data should be synchronized to the destination server based on the previously set synchronization rules. The synchronization content in the synchronization rules can also include conditions such as data type, data importance, and synchronization priority. If the changed data meets the conditions defined in the synchronization rules, these data are determined as "the first data to be synchronized". Here, "changed data" refers to the data that has actually changed in the first subproject, which are the targets of this synchronization operation.
[0057] Finally, the synchronization rules may also include a synchronization method. Once the first data to be synchronized is determined, the system will transfer the data from the source server to the destination server according to the synchronization frequency and synchronization method specified in the synchronization rules and other related configurations, and update the corresponding data in the destination server. The synchronization method may include full synchronization, incremental synchronization, etc.
[0058] In this embodiment, the accuracy and efficiency of data synchronization are ensured through sophisticated data change detection, difference comparison and synchronization rule application, while unnecessary data transmission and waste of resources are avoided.
[0059] In an embodiment of the present application, before comparing whether the changed data in the first sub-item is different from the original data in the destination server, the method further includes:
[0060] Using the synchronization rule, selecting a second sub-item to be synchronized from the first sub-item;
[0061] The comparing whether there are differences between the changed data in the first sub-item and the original data in the destination server includes:
[0062] Compare the changed data in the second sub-item with the original data in the destination server to see if there are any differences.
[0063] In this embodiment, the synchronization rules are refined here to determine which changed data in the first sub-project really needs to be synchronized. Through this screening process, the system can ignore those sub-projects that do not meet the synchronization conditions or do not need to be synchronized at present, thereby reducing the workload of subsequent data comparison and synchronization. The "second sub-project" is a subset containing the changed data to be synchronized that is further screened out based on the first sub-project according to the synchronization rules.
[0064] Since the synchronization content defines contents such as "setting to skip unsynchronized sub-items", "setting whether to synchronously create new sub-items", and "setting whether to synchronously delete sub-items", the sub-item that meets the above conditions in the first sub-item is the second sub-item.
[0065] After the second sub-project is determined, the system only needs to compare the changed data in these sub-projects, rather than the entire first sub-project or a wider data set. This significantly narrows the scope of the comparison and improves the efficiency and accuracy of the comparison.
[0066] In this embodiment, through the above process, the system can more intelligently determine which data needs to be synchronized and how to achieve synchronization most efficiently. This not only improves the timeliness and accuracy of data synchronization, but also reduces the overall operating cost and maintenance difficulty of the system.
[0067] In an embodiment of the present application, the using the synchronization rule to select the second sub-item to be synchronized from the first sub-item includes:
[0068] When the first sub-item includes a newly added sub-item and / or a deleted sub-item, and the newly added sub-item and / or the deleted sub-item are synchronization objects specified in the synchronization rule, the newly added sub-item and / or the deleted sub-item are determined as the second sub-item to be synchronized.
[0069] In this embodiment, the first sub-item may be a table in a database, a folder or file in a file system, a component in a software module, etc. They may be changed due to various business operations, including but not limited to the addition, modification, deletion, etc. of data.
[0070] Newly added sub-items are those first sub-items that have been newly created in the source server since the last synchronization, and deleted sub-items are those first sub-items that have been removed or marked for deletion.
[0071] The synchronization rules define what types of data changes should be synchronized to the destination server. When the first sub-project contains new sub-projects or deleted sub-projects, the system will check whether these sub-projects meet the synchronization object conditions specified in the synchronization rules.
[0072] If the newly added sub-items or deleted sub-items meet the synchronization conditions defined in the synchronization rules, these sub-items will be identified as the second sub-items to be synchronized. This means that in the subsequent data difference comparison and synchronization process, the changed data in these second sub-items (for newly added sub-items, it is the entire sub-item; for deleted sub-items, it may be related deletion operations or marks) will be synchronized to the destination server.
[0073] In this embodiment, the comprehensiveness and accuracy of the data synchronization process is ensured by clarifying the processing method of the synchronization rules for newly added sub-items and deleted sub-items.
[0074] In an embodiment of the present application, after using the synchronization rule to select the second sub-item to be synchronized from the first sub-item, the method further includes:
[0075] The second sub-project is synchronized to the destination server.
[0076] In this embodiment, in the data synchronization system, by screening out the second sub-items to be synchronized, the system has determined which data changes need to be transmitted to the destination server. These second sub-items may contain newly added data, modified data, or even data items that need to be deleted. They are synchronized to the destination server to ensure that the destination server data remains consistent with the source server.
[0077] In an embodiment of the present application, after synchronizing the first data to be synchronized to the destination server, the method further includes:
[0078] Acquire synchronization information during the process of synchronizing the first data to be synchronized to the destination server;
[0079] The synchronization information is stored in the destination server.
[0080] In this embodiment, synchronization information refers to various metadata generated during the data synchronization process, including but not limited to the synchronization start time, end time, amount of synchronized data, whether an error or exception occurred during the synchronization process, the specific content of the error and the solution, etc.
[0081] After the data synchronization operation is completed, the system needs to actively or passively obtain the synchronization information. This usually involves monitoring the log records of the synchronization process, capturing system events, or querying the status of the synchronization task. Through these means, the system can comprehensively collect various information during the synchronization process.
[0082] After obtaining the synchronization information, the next step is to store the information in the destination server. This is done to facilitate subsequent query, analysis, and use of the information. Storage methods may include writing the information to a database table, log file, or a dedicated monitoring system. Ensure that the synchronization information can be reliably stored and can be easily retrieved when needed.
[0083] In this embodiment, acquiring and storing the synchronization information in the destination server not only improves the transparency and monitorability of the synchronization process, but also provides valuable data support for subsequent troubleshooting, performance analysis, and optimization.
[0084] In an embodiment of the present application, the synchronization rule includes a service address of the at least one source server;
[0085] After setting the synchronization rule of the destination server by the data synchronization system, and before obtaining the first data to be synchronized of the at least one source server when the current time point is determined to reach the synchronization time point by using the synchronization rule, the method further includes:
[0086] determining an operating status of the at least one source server using the service address;
[0087] When the operating state is normal, the step is performed: when the current time point reaches the synchronization time point, the first data to be synchronized of the at least one source server is obtained by using the synchronization rule.
[0088] In this embodiment, the synchronization rule includes at least one service address of the source server, which is the basis for realizing data synchronization. The service address can be an IP address, a domain name, or a URL, etc., which is used to uniquely identify the location of the source server in the network. Through the service address, the data synchronization system can establish a connection with the source server and request the data to be synchronized.
[0089] Before trying to obtain data from the source server, the system first uses the service address to determine the operating status of the source server. This ensures that data synchronization is performed when the source server is operating normally to avoid data loss or synchronization failure due to server failure.
[0090] Specifically, the system may check the operating status of the source server by sending heartbeat packets, performing ping operations, querying the server status interface, etc. If the server responds normally, its operating status is considered normal; if the server does not respond or responds abnormally (such as returning an error code), its operating status is considered abnormal.
[0091] The system will continue to perform data synchronization only when it is confirmed that the source server is operating normally. This includes obtaining the first data to be synchronized from the source server using the synchronization rules when the current time point reaches the synchronization time point. This step ensures the security and reliability of the data synchronization operation and avoids invalid data requests when the source server is unavailable.
[0092] In this embodiment, by introducing a pre-step of checking the operating status of the source server, the robustness and stability of the data synchronization process are significantly improved. It ensures that data synchronization is performed only when the source server is working normally, thereby reducing the risk of data synchronization failure or data loss due to server failure.
[0093] In one embodiment of the present application, the synchronization rule includes a synchronization frequency;
[0094] After synchronizing the first data to be synchronized to the destination server, the method further includes:
[0095] The synchronization frequency and the current time point are used for calculation to determine the next synchronization time point of the destination server, so that when the destination server reaches the next synchronization time point, it executes the step of obtaining the first data to be synchronized of the at least one source server.
[0096] In this embodiment, the synchronization frequency refers to the time interval between two consecutive executions of data synchronization operations. It can be a fixed time period (such as every hour, every day, every week, etc.), or a dynamic time interval triggered by a specific event or condition. The setting of the synchronization frequency depends on business requirements, data update speed, system resources, and other factors.
[0097] After the first data to be synchronized is successfully synchronized to the destination server, the system will calculate based on the synchronization frequency and the current time point to determine the next synchronization time point of the destination server. Specifically, the current time point is added to the synchronization frequency, and the result obtained is the next synchronization time point.
[0098] When the system time of the destination server reaches the next synchronization time point, the system will automatically execute the corresponding steps to obtain the first data to be synchronized from at least one source server. This process is periodic, ensuring that the data synchronization operation can be carried out continuously at the preset frequency, thereby maintaining the freshness and accuracy of the data in the destination server.
[0099] In this embodiment, by introducing the synchronization frequency and the mechanism for determining the next synchronization time point, more comprehensive and efficient support is provided for the data synchronization process.
[0100] In an embodiment of the present application, after synchronizing the first data to be synchronized to the destination server, the method further includes:
[0101] In response to a data synchronization request sent by the source server, second data to be synchronized is synchronized to the source server, where the second data to be synchronized is data in the destination server that is different from the source server from the last synchronization to the current time point.
[0102] In this embodiment, the second data to be synchronized refers to the data in the destination server that is different from the source server from the last synchronization to the current time point. These data may be generated due to the user performing modification, addition or deletion operations on the destination server. In order to ensure the data consistency between the source server and the destination server, these difference data need to be synchronized back to the source server.
[0103] When the source server needs to synchronize data with the data in the destination server, it will send a data synchronization request to the data synchronization system. After receiving this request, the data synchronization system will start preparing and executing the data synchronization operation from the destination server to the source server.
[0104] When performing a data synchronization operation from the destination server to the source server, the data synchronization system will first identify the second data to be synchronized (that is, the data in the destination server that has changed since the last synchronization). Then, it will package this data and send it to the source server. After receiving this data, the source server will perform verification and merge operations to ensure that its data status is consistent with that of the destination server.
[0105] In this embodiment, by introducing a two-way synchronization mechanism, the flexibility and comprehensiveness of data synchronization are improved. It allows data changes between the source server and the destination server to be propagated and synchronized with each other, thereby ensuring the consistency and accuracy of the data. This is particularly important for business scenarios that require data synchronization between multiple systems or platforms. In addition, the two-way synchronization mechanism also helps reduce data conflicts and redundancies, and improves the overall performance and stability of the system.
[0106] In one embodiment of the present application, Figure 4 As shown, Figure 4 The figure is a schematic diagram of the overall process of the data synchronization method. The process includes:
[0107] The data synchronization system traverses the set synchronization rule base to determine whether the current time reaches the synchronization time point (i.e. the next update time);
[0108] When the current time reaches the synchronization time point, the synchronization rule is used to connect to the service address of the source server (i.e., connect to the synchronization source GIt service address);
[0109] Determine whether the source server is running normally (i.e., determine whether the source service is available);
[0110] When the source server is running normally, all sub-items in the source server are traversed to obtain the first sub-item (i.e., determine whether there is a new / modified / deleted sub-item);
[0111] Determine the first data to be synchronized in the first subproject (ie, traverse the code change records of each subproject during all periods, determine whether there is a code change, and synchronize the latest code to the corresponding subproject warehouse).
[0112] like Figure 5 As shown, the embodiment of the present application further provides a data synchronization device 200, and the data synchronization device 500 includes:
[0113] A setting module 501 is used to set a synchronization rule of the destination server through the data synchronization system, and the destination server obtains the first data to be synchronized from at least one source server according to the synchronization rule;
[0114] A first acquisition module 502 is used to acquire first data to be synchronized of the at least one source server when the current time point is determined to reach the synchronization time point by using the synchronization rule, wherein the first data to be synchronized is data that differs between the source server and the destination server from the last synchronization to the current time point;
[0115] The first synchronization module 503 is used to synchronize the first data to be synchronized to the destination server.
[0116] Optionally, the setting module 501 includes:
[0117] A receiving submodule, used for receiving an interface input operation to the data synchronization system;
[0118] The response submodule is used to set the synchronization frequency, synchronization address source and synchronization content of the destination server in response to the interface input operation.
[0119] Optionally, the first acquisition module 502 includes:
[0120] A first acquisition submodule, used to acquire a first sub-item of data changes that occurred in each source server of the at least one source server from the last synchronization to the current time point, wherein the first sub-item is used to store data;
[0121] A comparison submodule, used to compare whether there are differences between the changed data in the first subproject and the original data in the destination server;
[0122] The determination submodule is used to determine the changed data in the first subproject as the first data to be synchronized using the synchronization rule when there is a difference between the changed data in the first subproject and the original data in the destination server. The changed data is the data that has changed in the first subproject.
[0123] Optionally, the data synchronization device 500 further includes:
[0124] A screening module, used to screen out second sub-items to be synchronized from the first sub-items by using the synchronization rule;
[0125] Optionally, the comparison submodule is specifically used for:
[0126] Compare the changed data in the second sub-item with the original data in the destination server to see if there are any differences.
[0127] Optionally, a screening submodule is specifically used to:
[0128] When the first sub-item includes a newly added sub-item and / or a deleted sub-item, and the newly added sub-item and / or the deleted sub-item are synchronization objects specified in the synchronization rule, the newly added sub-item and / or the deleted sub-item are determined as the second sub-item to be synchronized.
[0129] Optionally, the data synchronization device 500 is specifically used for:
[0130] The second sub-project is synchronized to the destination server.
[0131] Optionally, the data synchronization device 500 further includes:
[0132] A second acquisition module, used to acquire synchronization information in the process of synchronizing the first data to be synchronized to the destination server;
[0133] The second synchronization module is used to store the synchronization information in the destination server.
[0134] Optionally, the data synchronization device 500 further includes:
[0135] a determination module, configured to determine the operating status of the at least one source server using the service address;
[0136] The execution module is used to execute the steps when the operating state is normal: when the current time point reaches the synchronization time point, using the synchronization rule to obtain the first data to be synchronized of the at least one source server.
[0137] Optionally, the data synchronization device 500 is specifically used for:
[0138] The synchronization frequency and the current time point are used for calculation to determine the next synchronization time point of the destination server, so that when the destination server reaches the next synchronization time point, it executes the step of obtaining the first data to be synchronized of the at least one source server.
[0139] Optionally, the data synchronization device 500 is specifically used for:
[0140] In response to a data synchronization request sent by the source server, second data to be synchronized is synchronized to the source server, where the second data to be synchronized is data in the destination server that is different from the source server from the last synchronization to the current time point.
[0141] It should be noted that the data synchronization device 500 is a device corresponding to the above-mentioned data synchronization method. All implementation methods in the above-mentioned method embodiment are applicable to the embodiment of the device and can achieve the same technical effect.
[0142] Figure 6 A schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application is shown.
[0143] The terminal device may include a processor 601 and a memory 602 storing computer program instructions.
[0144] Specifically, the processor 601 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0145] The memory 602 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 602 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 602 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 602 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 602 is a non-volatile solid-state memory.
[0146] In certain embodiments, the memory 602 may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, in general, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.
[0147] The processor 601 implements any one of the data synchronization methods in the above embodiments by reading and executing computer program instructions stored in the memory 602 .
[0148] In one example, the terminal device may further include a communication interface 603 and a bus 610. Figure 6 As shown, the processor 601, the memory 602, and the communication interface 603 are connected via a bus 610 and communicate with each other.
[0149] The communication interface 603 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0150] Bus 610 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 610 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.
[0151] In addition, in combination with the data synchronization method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the data synchronization methods in the above embodiment is implemented.
[0152] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0153] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0154] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0155] Aspects of the present disclosure are described above with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data synchronization device to produce a machine so that these instructions executed by the processor of the computer or other programmable data synchronization device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0156] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A data synchronization method, characterized in that: Applied to a data synchronization system, the data synchronization system is connected to a destination server, and the method comprises: By means of the data synchronization system, a synchronization rule of the destination server is set, and the destination server obtains first data to be synchronized from at least one source server according to the synchronization rule; When the current time point reaches the synchronization time point, obtaining first data to be synchronized of the at least one source server by using the synchronization rule, wherein the first data to be synchronized is data that differs between the source server and the destination server from the last synchronization to the current time point; The first data to be synchronized is synchronized to the destination server.
2. The data synchronization method according to claim 1, characterized in that: The synchronization rules include synchronization frequency, synchronization address source and synchronization content; The step of setting the synchronization rule of the destination server through the data synchronization system includes: Receiving an interface input operation to the data synchronization system; In response to the interface input operation, the synchronization frequency, synchronization address source and synchronization content of the destination server are set.
3. The data synchronization method according to claim 1, characterized in that: The obtaining the first data to be synchronized of the at least one source server by using the synchronization rule includes: Acquire a first sub-item of data change that occurs in each source server of the at least one source server from the last synchronization to the current time point, wherein the first sub-item is used to store data; Comparing the changed data in the first sub-project with the original data in the destination server to see if there are any differences; When there is a difference between the changed data in the first sub-project and the original data in the destination server, the changed data is determined as the first data to be synchronized using the synchronization rule, and the changed data is the data changed in the first sub-project.
4. The data synchronization method according to claim 3, characterized in that: Before comparing whether there are differences between the changed data in the first sub-item and the original data in the destination server, the method further includes: Using the synchronization rule, selecting a second sub-item to be synchronized from the first sub-item; The comparing whether there are differences between the changed data in the first sub-item and the original data in the destination server includes: Compare the changed data in the second sub-item with the original data in the destination server to see if there are any differences.
5. The data synchronization method according to claim 4, characterized in that: The using the synchronization rule to select the second sub-item to be synchronized from the first sub-item includes: When the first sub-item includes a newly added sub-item and / or a deleted sub-item, and the newly added sub-item and / or the deleted sub-item are synchronization objects specified in the synchronization rule, the newly added sub-item and / or the deleted sub-item are determined as the second sub-item to be synchronized.
6. The data synchronization method according to claim 4, characterized in that: After the synchronization rule is used to select the second sub-item to be synchronized from the first sub-item, the method further includes: The second sub-project is synchronized to the destination server.
7. The data synchronization method according to claim 1, characterized in that: After synchronizing the first data to be synchronized to the destination server, the method further includes: Acquire synchronization information during the process of synchronizing the first data to be synchronized to the destination server; The synchronization information is stored in the destination server.
8. The data synchronization method according to claim 1, characterized in that: The synchronization rule includes a service address of the at least one source server; After setting the synchronization rule of the destination server by the data synchronization system, and before obtaining the first data to be synchronized of the at least one source server when the current time point is determined to reach the synchronization time point by using the synchronization rule, the method further includes: determining an operating status of the at least one source server using the service address; When the operating state is normal, the step is performed: when the current time point reaches the synchronization time point, the first data to be synchronized of the at least one source server is obtained by using the synchronization rule.
9. The data synchronization method according to claim 4, characterized in that: The synchronization rules include synchronization frequency; After synchronizing the first data to be synchronized to the destination server, the method further includes: The synchronization frequency and the current time point are used for calculation to determine the next synchronization time point of the destination server, so that when the destination server reaches the next synchronization time point, it executes the step of obtaining the first data to be synchronized of the at least one source server.
10. The data synchronization method according to claim 1, characterized in that: After synchronizing the first data to be synchronized to the destination server, the method further includes: In response to a data synchronization request sent by the source server, second data to be synchronized is synchronized to the source server, where the second data to be synchronized is data in the destination server that is different from the source server from the last synchronization to the current time point.
Citation Information
Patent Citations
System and method for synchronizing data
CN102137132A
Data synchronism ETL (Extract Transform Load) system
CN104317843A
Heterogeneous data synchronization scheme, based on incremental updating, on mobile device
CN105072153A
A data synchronization method and a data synchronization device
CN109241185A
Table data synchronization method and device, storage medium and apparatus
CN109634970A
Cited By
Multi-environment application management system
CN119921956A
A multi-environment application management system
CN119921956B
