Data synchronization method and device, equipment and storage medium

By using encryption technology to synchronize cloud database data in cross-cloud scenarios, cross-cloud data synchronization and security issues are solved, and data consistency and efficient service quality are achieved.

CN119166713AActive Publication Date: 2024-12-20ZHEJIANG DAHUA TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411111672.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2024-12-20
Estimated Expiration
2044-08-13

AI Technical Summary

Technical Problem

In cross-cloud scenarios, the traditional master-slave synchronization method cannot effectively solve the data synchronization problem between different cloud databases. Due to differences in security mechanisms and protocols, the data synchronization process is vulnerable to attacks or leaks, and it is difficult to reduce the business of cloud vendors. Coupling of services.

Method used

By interacting between the central service component of the source database and the synchronization service component of the target database, encrypting data using the task public key and decrypting it through the private key, data synchronization across cloud databases is achieved to ensure data consistency and security while reducing data simultaneously Reliance on cloud vendor functions reduces coupling.

Benefits of technology

The cloud database data synchronization in cross-cloud scenarios is realized, data consistency and security are ensured, service quality and response speed are improved worldwide, and dependence on cloud vendor services is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166713A_ABST
    Figure CN119166713A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data synchronization method and device, equipment and a storage medium, and relates to the technical field of computers, in particular to an implementation mode applied to direct data synchronization of databases of different cloud manufacturers. In the application, a center service component of a source database receives a synchronization request sent by a synchronization service component of a target database for a data synchronization task, and the synchronization request carries a synchronization field used for indicating an initial query position and the number of query data used for determining a terminal query position; acquiring synchronous data matched with the query data from the source data table based on the synchronous field; and performing encryption processing on the synchronization data through the task public key, and returning the obtained encrypted data to the synchronization service component. In a cross-cloud scene, data synchronization of the source database and the target database is realized, so that resources and advantages of different cloud databases are fully utilized, and the global service quality and response speed are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] With the rapid development of cloud computing technology, more and more cloud databases have emerged to provide more flexible data storage and backup solutions. Currently, more and more companies choose to store data in cloud databases to better meet business needs. Therefore, in order to make full use of resources and advantages in various places and improve service quality and response speed worldwide, it is particularly important to use different cloud databases as different node data centers around the world.

[0003] However, using multiple cloud databases for data storage also brings some problems, the most important of which is the difficulty of data synchronization. First, due to the differences in network environment, architecture, and security mechanisms between cloud vendors associated with different cloud databases, the traditional master-slave synchronization method is no longer competent for the data synchronization task of cloud databases in cross-cloud scenarios. Secondly, due to the different security mechanisms and protocols of cloud vendors associated with different cloud databases, the data synchronization process is vulnerable to attacks or leaks. In addition, we should not overly rely on the functions provided by the cloud vendors associated with the cloud database, and we should reduce the coupling with the cloud vendor services in terms of business.

[0004] Therefore, how to achieve data synchronization of cloud databases in cross-cloud scenarios, make full use of the resources and advantages of different cloud databases, and improve service quality and response speed worldwide. Summary of the invention

[0005] The embodiments of the present application provide a data synchronization method, apparatus, device and storage medium for realizing data synchronization of cloud databases in a cross-cloud scenario, so as to make full use of the resources and advantages of different cloud databases and improve the service quality and response speed on a global scale.

[0006] In a first aspect, an embodiment of the present application provides a data synchronization method, which is applied to a central service component of a source database, and the method includes:

[0007] Receive a synchronization request sent by a synchronization service component of a target database for a data synchronization task; wherein the synchronization request carries a synchronization field for indicating a starting query position and a number of query data items for determining an ending query position;

[0008] Based on the synchronization field, obtain the synchronization data that matches the number of query data from the source data table;

[0009] The synchronization data is encrypted using the task public key, and the encrypted data is returned to the synchronization service component.

[0010] In a second aspect, an embodiment of the present application provides a data synchronization method, which is applied to a synchronization service component of a target database, and the method includes:

[0011] For the data synchronization task, a synchronization request is sent to the central service component of the source database; wherein the synchronization request carries a synchronization field for indicating the starting query position and the number of query data for determining the ending query position;

[0012] Receive the encrypted data returned by the central service component; wherein the encrypted data is obtained by the central service component after encrypting the synchronization data matching the number of query data obtained from the source data table based on the synchronization field using the task public key;

[0013] The encrypted data is decrypted using the task private key, and the obtained synchronization data is stored in the target database.

[0014] In a third aspect, an embodiment of the present application provides a data synchronization device, which is applied to a central service component of a source database, and the device includes:

[0015] A first receiving module is used to receive a synchronization request sent by a synchronization service component of a target database for a data synchronization task; wherein the synchronization request carries a synchronization field for indicating a starting query position and a number of query data for determining an ending query position;

[0016] The acquisition module is used to obtain the synchronization data matching the query data from the source data table based on the synchronization field;

[0017] The return module is used to encrypt the synchronization data using the task public key and return the obtained encrypted data to the synchronization service component.

[0018] In a fourth aspect, an embodiment of the present application provides a data synchronization device, which is applied to a synchronization service component of a target database, and the device includes:

[0019] A sending module, used for sending a synchronization request to a central service component of a source database for a data synchronization task; wherein the synchronization request carries a synchronization field for indicating a starting query position and a number of query data for determining a termination query position;

[0020] The second receiving module is used to receive the encrypted data returned by the central service component; wherein the encrypted data is obtained by the central service component after encrypting the synchronization data matching the number of query data obtained from the source data table based on the synchronization field through the task public key;

[0021] The data storage module is used to decrypt the encrypted data using the task private key and store the obtained synchronized data into the target database.

[0022] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the computer program to implement the steps of the data synchronization method provided in the embodiment of the present application.

[0023] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the data synchronization method provided in the embodiment of the present application are implemented.

[0024] In the seventh aspect, an embodiment of the present application provides a computer program product, which includes a computer program, and the computer program is stored in a computer-readable storage medium; when the processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device performs the steps of the data synchronization method provided in the embodiment of the present application.

[0025] The beneficial effects of this application are as follows:

[0026] The embodiments of the present application provide a data synchronization method, apparatus, device and storage medium. In the embodiments of the present application, the central service component of the source database interacts with the synchronization service component of the target database to achieve data synchronization of cloud databases in a cross-cloud scenario, ensure data consistency, make full use of the resources and advantages of different cloud databases, and improve service quality and response speed worldwide. Specifically, the central service component receives a synchronization request sent by the synchronization service component for a data synchronization task. The synchronization request carries a synchronization field for indicating the starting query position and the number of query data items for determining the ending query position. Based on the synchronization field, the central service component obtains synchronization data that matches the number of query data items from the source data table to ensure the accuracy of the query synchronization data. Furthermore, the central service component encrypts the synchronization data through the task public key and returns the obtained encrypted data to the synchronization service component. During the data synchronization process, the synchronization data is encrypted to ensure data security, prevent data loss and leakage, and ensure business data security. At the same time, in a cross-cloud scenario, it is not necessary to open the database port to the public network. Only the database components (such as the central service component of the source database and the synchronization service component of the target database) need to be opened to avoid over-reliance on the functions provided by the cloud vendors associated with the cloud database, and reduce the coupling with the cloud vendor services in terms of business. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0028] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present application;

[0029] Figure 2 A structural diagram of a data synchronization system provided in an embodiment of the present application;

[0030] Figure 3 An interactive flow chart of data synchronization provided in an embodiment of the present application;

[0031] Figure 4 A time diagram of starting a data synchronization task provided in an embodiment of the present application;

[0032] Figure 5 A timing diagram of another data synchronization task startup provided in an embodiment of the present application;

[0033] Figure 6 A specific flow chart of data interaction provided in an embodiment of the present application;

[0034] Figure 7 A specific flow chart of another data interaction provided in an embodiment of the present application;

[0035] Figure 8 A structural diagram of a source data table provided in an embodiment of the present application;

[0036] Fig. 9 A schematic diagram of generating a public and private key pair for a data synchronization task provided in an embodiment of the present application;

[0037] Fig.10 A schematic diagram of security verification of a central service component and a synchronization service component provided in an embodiment of the present application;

[0038] Fig.11 A flow chart of a method for performing data synchronization by a central service component provided in an embodiment of the present application;

[0039] Fig.12 A flowchart of a method for performing data synchronization by a synchronization service component provided in an embodiment of the present application;

[0040] Fig.13 A structural diagram of a data synchronization device provided in an embodiment of the present application;

[0041] Fig.14 A structural diagram of another data synchronization device provided in an embodiment of the present application;

[0042] Fig.15 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and beneficial effects of this application clearer, the technical solution in the embodiment of this application will be clearly and completely described below in conjunction with the drawings in the embodiment of this application. Obviously, the described embodiment is only a part of the embodiment of this application, not all the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0044] The word “exemplary” is used hereinafter to mean “serving as an example, example, or illustration.” Any embodiment described as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0045] The terms "first" and "second" in this document are used for descriptive purposes only and should not be understood as explicitly or implicitly indicating relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of this application, unless otherwise specified, the meaning of "multiple" is two or more.

[0046] The following is a brief introduction to the design concept of the embodiment of the present application:

[0047] With the rapid development of cloud computing technology, more and more cloud databases have emerged to provide more flexible data storage and backup solutions. Currently, more and more companies choose to store data in cloud databases to better meet business needs. Therefore, in order to make full use of resources and advantages in various places and improve service quality and response speed worldwide, it is particularly important to use different cloud databases as different node data centers around the world.

[0048] However, using multiple cloud databases for data storage also brings some problems, the most important of which is the difficulty of data synchronization. First, due to the differences in network environment, architecture, and security mechanisms between cloud vendors associated with different cloud databases, the traditional master-slave synchronization method is no longer competent for the data synchronization task of cloud databases in cross-cloud scenarios. Secondly, due to the different security mechanisms and protocols of cloud vendors associated with different cloud databases, the data synchronization process is vulnerable to attacks or leaks. In addition, we should not overly rely on the functions provided by the cloud vendors associated with the cloud database, and we should reduce the coupling with the cloud vendor services in terms of business.

[0049] In view of this, the embodiments of the present application provide a data synchronization method, device, equipment and storage medium, which are used to realize data synchronization of cloud databases in cross-cloud scenarios, ensure data consistency, make full use of the resources and advantages of different cloud databases, and improve service quality and response speed worldwide. At the same time, during the data synchronization process, the synchronized data is encrypted, and heartbeat detection is maintained between the central service component of the source database and the synchronization service component of the target database, which prevents the forged synchronization service component from obtaining data from the central service component, ensures data security, prevents data loss and leakage, and ensures business data security; and in cross-cloud scenarios, there is no need to open the database port to the public network, only the database components (such as the central service component of the source database, the synchronization service component of the target database) need to be opened, so as to avoid over-reliance on the functions provided by the cloud vendor associated with the cloud database, and reduce the coupling with the cloud vendor service in terms of business.

[0050] The following is a brief description of the application scenarios set in this application. It should be noted that the following scenarios are only used to illustrate the embodiments of this application and are not limiting. In specific implementation, the technical solutions provided in the embodiments of this application can be flexibly applied according to actual needs.

[0051] See also Figure 1 , Figure 1 A schematic diagram of an application scenario provided in an embodiment of the present application, the application scenario includes: a source database 110 and a target database 120;

[0052] In a possible implementation, the source database 110 and the target database 120 may be connected to each other through a communication network. The communication network may be a wired network or a wireless network. Therefore, the source database 110 and the target database 120 may be directly or indirectly connected through a wired or wireless communication mode. For example, the source database 110 may be indirectly connected to the target database 120 through a wireless access point, or the source database 110 may be directly connected to the target database 120 through the Internet, and this application does not limit this.

[0053] Among them, the source database 110 and the target database 120 can be physical servers, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), as well as big data and artificial intelligence platforms.

[0054] To further illustrate the data synchronization technical solution provided by the embodiment of the present application, the implementation method of data synchronization provided by the exemplary implementation method of the present application is described below with reference to the accompanying drawings.

[0055] See also Figure 2 , Figure 2 A data synchronization system structure diagram is provided for an embodiment of the present application, and the data synchronization system includes: a source database 110 and a target database 120; wherein, a central service component 1101 is constructed and deployed on the source database 110, and the central service component 1101 is responsible for data transmission and security assurance; a synchronization service component 1201 is constructed and deployed on the target database 120, and the synchronization service component 1201 is responsible for data synchronization requests and storing the requested synchronization data in the target database. Moreover, in the embodiment of the present application, in order to reduce the dependence on the cloud vendor functions of the cloud database and reduce the coupling with the cloud vendor services, in a cross-cloud scenario, it is not necessary to open the database port to the public network, and only the service components of the database need to be opened, that is, the central service component of the source database and the synchronization service component of the target database are opened.

[0056] based on Figure 2 The data synchronization system shown in the embodiment of the present application provides a data synchronization method, see Figure 3 , Figure 3 An interactive flow chart of data synchronization provided in an embodiment of the present application includes the following steps:

[0057] Step S300, the synchronization service component sends a synchronization request to the central service component of the source database for the data synchronization task; wherein the synchronization request carries a synchronization field for indicating the starting query position and the number of query data for determining the ending query position.

[0058] In an embodiment of the present application, in order to ensure that data will not be lost, the synchronization service component starts the data synchronization task in the form of a scheduled task, and after starting the data synchronization task, recursively sends synchronization requests to the midline service component of the source database in sequence until all data of the data synchronization task in the source data table is synchronized, and then the data synchronization task is ended.

[0059] In a possible implementation, a detection time interval for the data synchronization task is set, and the start time of the data synchronization task is determined based on the set detection time interval. Taking the detection time interval as 30 minutes as an example, the data synchronization task is checked every 30 minutes to see if it is finished. If the data synchronization task is finished, a new data synchronization task is started. If the data synchronization task is not finished, the current data synchronization task is continued to be executed until the data synchronization task is finished, and a new data synchronization task is started.

[0060] For example, see Figure 4 , Figure 4 A time diagram for starting a data synchronization task provided in an embodiment of the present application; assuming that data synchronization task 1 is started at time T1 for data synchronization, if data synchronization task 1 ends before time T2, data synchronization task 2 is started at time T2; similarly, if data synchronization task 2 ends before time T3, data synchronization task 3 is started at time T3; wherein, time T1 to time T2 is a detection time interval, and time T2 to time T3 is a detection time interval.

[0061] For another example, see Figure 5 , Figure 5 A time diagram of another data synchronization task startup provided in an embodiment of the present application; assuming that data synchronization task 1 is started at time T1 for data synchronization, if data synchronization task 1 is not completed at time T2, data synchronization task 1 is continued to be executed at time T2, and data synchronization task 1 is continued to be detected at time T3 to see whether it is completed. If data synchronization task 1 is completed, data synchronization task 2 is started at time T3, otherwise data synchronization task 1 is continued to be executed; wherein, Figure 4 The data synchronization task 1 is completed at time T3 as an example for illustration.

[0062] As another example, assuming that data synchronization task 1 is started at time T1 for data synchronization, but data synchronization task 1 fails before time T2, data synchronization task 1 is terminated immediately and restarted at time T2.

[0063] In an embodiment of the present application, in order to ensure that complete synchronization data can be obtained for the data synchronization task and to ensure the consistency of data synchronization, at least one synchronization request is sent within a data synchronization task, and each synchronization request carries the synchronization fields MAX_ID (latest identifier) ​​and MAX_LAST_UPD (latest time) used to indicate the starting query position, and the number of query data STEP used to determine the terminal query position; for example, the synchronization fields in the first synchronization request message can be set to MAX_ID=1, MAX_LAST_UPD=2028-01-0100:00:00, and STEP=100, which means starting from the record data table with MAX_ID=1, and starting with MAX_LAST_UPD=2028-01-0100:00:00 as the starting position to query and obtain 100 synchronization data.

[0064] In one possible implementation, the synchronization field is determined as follows:

[0065] If the synchronization request is the initial request for a data synchronization task, the synchronization fields are initially set;

[0066] If the synchronization request is a non-initial request for a data synchronization task, and the data synchronization of the previous synchronization request is successful, the synchronization field is determined based on the synchronization data queried by the previous synchronization request;

[0067] If the synchronization request is a non-initial request for a data synchronization task, and the data synchronization of the previous synchronization request fails, the synchronization field is the synchronization field carried in the previous synchronization request.

[0068] It should be noted that, in the case where the synchronization request is a non-initial request for a data synchronization task, the specific implementation method for determining the synchronization field can be found in the following content, which will not be described in detail here.

[0069] Step S301: The central service component receives a synchronization request sent by the synchronization service component for a data synchronization task, and obtains synchronization data matching the number of query data from a source data table based on a synchronization field.

[0070] In the embodiment of the present application, when the central service component receives a synchronization request and obtains synchronization data based on the synchronization field and the number of query data, the following two implementation methods can be used:

[0071] Method 1: The source data table is stored in the source database. After receiving the synchronization request, the central service component sends a request to the source database. The source database combines the synchronization field and the number of query data to obtain the synchronization data in the source data table. For example, see Figure 6 , Figure 6 A specific flow chart of data interaction provided in an embodiment of the present application includes the following steps:

[0072] Step S600: The synchronization service component sends a synchronization request to the central service component of the source database for the data synchronization task; wherein the synchronization request carries a synchronization field for indicating the starting query position and the number of query data for determining the ending query position;

[0073] Step S601: After receiving the synchronization request sent by the synchronization service component for the data synchronization task, the central service component sends a data request to the source database, where the data request carries a synchronization field for indicating the starting query position and the number of query data for determining the ending query position;

[0074] Step S602: After receiving the data request, the source database obtains the synchronization data in the source data table by combining the synchronization field and the number of query data items;

[0075] Step S603, the source database returns the acquired synchronization data to the central service component;

[0076] Step S604, the central service component encrypts the synchronization data using the task public key;

[0077] Step S605, the central service component returns the obtained encrypted data to the synchronization service component;

[0078] Step S606: The synchronization service component receives the encrypted data returned by the central service component, decrypts the encrypted data using the task private key, and obtains synchronization data.

[0079] Step S607: The synchronization service component stores the obtained synchronization data into the target database.

[0080] from Figure 6 As can be seen in FIG, after receiving the synchronization request, the central service component queries and obtains the synchronization data from the source data table of the source database. In this way, the central service component requests the source database for synchronization data each time it receives a synchronization request.

[0081] Method 2: The source data table is stored in the source database. Before obtaining the synchronization data, the central service component obtains the source data table from the source database, and then obtains the synchronization data from the source data table by combining the synchronization field and the number of query data. For example, see Figure 7 , Figure 7 Another specific flow chart of data interaction provided in an embodiment of the present application includes the following steps:

[0082] Step S700: The synchronization service component sends an initial synchronization request to the central service component of the source database for the data synchronization task; wherein the initial synchronization request carries a synchronization field for indicating the starting query position and the number of query data for determining the ending query position;

[0083] Step S701: After receiving the synchronization request sent by the synchronization service component for the data synchronization task, the central service component sends a data table acquisition request to the source database;

[0084] Step S702: After receiving the data table acquisition request, the source database returns the source data table to the central service component;

[0085] Step S703: the central service component obtains synchronization data matching the number of query data from the source data table based on the synchronization field;

[0086] Step S704, the central service component determines the synchronization field used for the next synchronization request based on the queried synchronization field;

[0087] Step S705, the central service component encrypts the synchronization data and the synchronization field used by the next synchronization request by using the task public key;

[0088] Step S706, the central service component returns the obtained encrypted data to the synchronization service component;

[0089] Step S707: The synchronization service component receives the encrypted data returned by the central service component, decrypts the encrypted data using the task private key, and obtains synchronization data.

[0090] Step S708, the synchronization service component stores the obtained synchronization data into the target database;

[0091] Step S709, the synchronization service component sends a synchronization request to the central service component, and the synchronization request carries the synchronization field obtained from the encrypted data;

[0092] Step S710, the central service component repeats steps S703-S706.

[0093] from Figure 7 It can be seen that after the central service component receives the initial synchronization request for the data synchronization task, it sends a request to the source database to obtain the source data table from the source database, and then obtains the synchronization data from the source data table in combination with the synchronization field and the number of query data. In this way, when the central service component obtains synchronization data for different synchronization requests for the same data synchronization task, it can directly query from the obtained source data table. It should be noted that Figure 7 The request for the source data table from the source database shown is only one feasible way. Specifically, the source database may also request the source data table before receiving the synchronization request, which will not be repeated here.

[0094] In the embodiment of the present application, the process of querying synchronization data from the source data table can be expressed as:

[0095] SELECT * FROM SOURCE_TABLE (Select from the source data table)

[0096] WHERE (from where)

[0097] (UPDATE_TIME=#{MAX_LAST_UPD})AND ID>#{MAX_ID})(Query time=MAX_LAST_UPD, query ID>MAX_ID)

[0098] OR UPDATE_TIME>#{MAX_LAST_UPD}(query time>MAX_LAST_UPD)

[0099] )ORDER BY ID DESC (Get data by identifier)

[0100] The structure of the source data table during data query can be found in Figure 8 shown.

[0101] In the embodiment of the present application, in order to ensure the accuracy of the next data query, after the synchronization data is queried from the source data table, the synchronization field used for the next synchronization request query is determined in the source data table based on the location of the queried synchronization data, and the synchronization field is returned to the synchronization service component together with the queried synchronization data; for example, see Figure 7 ,from Figure 7 It can be seen that after the central service component obtains the synchronization data from the source data table based on the synchronization field in the synchronization request, it determines the synchronization field used for the next synchronization request, and returns the synchronization data and the synchronization data to the synchronization service component, so that when the synchronization service component obtains the synchronization data from the central service component again, it uses the synchronization field returned by the central service component, and subsequent requests are recursively called in sequence until all the data in the source data table that matches the data synchronization task is sent, and an end identifier is returned to the synchronization service component to indicate the end of this task.

[0102] Step S302: The central service component encrypts the synchronization data using the task public key.

[0103] Step S303: The central service component returns the obtained encrypted data to the synchronization service component.

[0104] Step S304: The synchronization service component receives the encrypted data returned by the central service component, decrypts the encrypted data using the task private key, and obtains synchronization data.

[0105] Step S305: The synchronization service component stores the obtained synchronization data into the target database.

[0106] In one possible implementation, when the synchronization request successfully obtains the synchronization data, the synchronization service component will return the synchronization fields MAX_ID and MAX_LAST_UPD together with the synchronization data and store them in the synchronization task table to record the synchronization fields and mark the data synchronization task status as successful; when the end identifier is queried, the synchronization service component will record the synchronization fields returned together with the synchronization data obtained at the end, and mark the data synchronization task status as task completion.

[0107] In one possible implementation, when an abnormal situation such as network fluctuation causes the data synchronization task to fail, the synchronization fields MAX_ID and MAX_LAST_UPD carried in the failed synchronization request are recorded in the synchronization task table, and the data synchronization task status is marked as synchronization failure. When the next task starts, the synchronization field of the most recent failed execution is used to make a synchronization request.

[0108] It should be noted that when a data synchronization task fails to execute successfully for more than a set number of times (such as three times), an alarm message is sent via email to notify the responsible person.

[0109] In an embodiment of the present application, in order to ensure that the synchronization service component can smoothly obtain synchronization data from the central service component, and in order to ensure the security of data synchronization during the data synchronization task, the synchronization service component needs to be registered in the central service component, and before making a synchronization data request, the central service component needs to verify the synchronization service component and determine the task public and private key pair used in the data synchronization process, that is, use the task public key to encrypt the synchronization data, and use the task private key to decrypt and obtain the synchronization data accordingly.

[0110] For details, see Fig. 9 , Fig. 9 A schematic diagram of generating a task public-private key pair for a data synchronization task provided by an embodiment of the present application, including a process of registering a synchronization service component in a central service component; Fig. 9 The steps include:

[0111] Step S900: The synchronization service component sends a registration request to the central service component, and the registration request carries registration information.

[0112] Among them, the registration request is sent to the central service component after the synchronization service component goes online;

[0113] The registration information includes: the registration name N1 of the synchronization service component and the registered hardware fingerprint M1, wherein the registered hardware fingerprint M1 includes information such as the CPU unique identification code, memory, and hard disk serial number, that is, the registered hardware fingerprint M1 is obtained by splicing the CPU unique identification code, memory, hard disk serial number, and other information; or,

[0114] The registration information includes: a registration name N1 and a registered hardware fingerprint M1 based on the synchronization service component, combined with a registration identifier RegisterID determined by a hash algorithm; specifically, RegisterID=SHA256(M1+N1).

[0115] Step S901: After the central service component successfully registers the synchronization service component based on the registration information, a service public key S1 and a service private key P1 are generated.

[0116] It should be noted that the central service component registers the synchronization service component, that is, the registration information of the synchronization service component is recorded in the central service component; and the implementation method of generating the service public and private key pair can be generated by using RSA encryption algorithm, elliptic curve encryption algorithm, etc.

[0117] Step S902: The central service component returns the service private key P1 to the synchronization service component.

[0118] Step S903: The synchronization service component sends a verification request to the central service component. The verification request includes at least a service identifier ServerID. The service identifier is determined according to the service name N1' and the service hardware fingerprint M1' of the synchronization service component.

[0119] The service hardware fingerprint M1' includes information such as the CPU unique identification code, memory, and hard disk serial number, that is, the service hardware fingerprint M1' is obtained by splicing the CPU unique identification code, memory, and hard disk serial number; wherein ServerID = SHA256 (M1'+N1').

[0120] Step S904: the central service component verifies the service identifier based on the registration information sent in advance by the synchronization service component.

[0121] In a possible implementation, when verifying the service identifier based on the registration information:

[0122] If the registration information includes the registration name and the registration hardware fingerprint of the synchronization service component, a registration identifier is first generated based on the registration name and the registration hardware fingerprint in combination with a hash algorithm, and then the registration identifier is matched with the service identifier. If the match is successful, it is determined that the verification is passed, otherwise it is determined that the verification fails;

[0123] If the registration information includes a registration identifier determined based on the registration name and the registration hardware fingerprint in combination with a hash algorithm, the registration identifier is directly matched with the service identifier. If the match is successful, the verification is determined to be successful, otherwise the verification is determined to be failed.

[0124] In the embodiment of the present application, subsequent steps can be performed only after the service identifier is verified, otherwise the subsequent steps cannot be performed.

[0125] Step S905: After the central service component determines that the service identifier has been verified, it generates a task public key S2 and a task private key P2.

[0126] It should be noted that the public and private key pairs of the generated tasks can be generated by using RSA encryption algorithm, elliptic curve encryption algorithm, etc.

[0127] Step S906: the central service component encrypts the task private key P2 using the service public key S1 to generate an encrypted task private key P2'.

[0128] Step S907: the central service component returns the encrypted task private key P2' to the synchronization service component.

[0129] Step S908: The synchronization service component decrypts the encrypted task private key P2' using the service private key P1 to obtain the task private key P2.

[0130] The task private key P2 is used to decrypt the encrypted data obtained by encrypting the synchronization data with the task public key S2 to obtain the synchronization data.

[0131] In the embodiment of the present application, each data synchronization task needs to separately obtain the task public-private key pair associated with the data synchronization task to ensure the accuracy of the synchronization data obtained for the data synchronization task. Therefore, in order to avoid conflicting use of task public-private key pairs between data synchronization tasks, when it is determined that the data synchronization task has ended, the task public-private key pair corresponding to the data synchronization task is invalidated. Specifically, after the central service component determines that all data of the data synchronization task has been synchronized, it determines that the data synchronization task has ended, and invalidates the task public-private key pair corresponding to the data synchronization task; at the same time, after the central service component determines that the data synchronization task has ended, it returns a task end identifier to the synchronization service component, and the task end identifier is used to indicate that the task public-private key has expired.

[0132] In a possible implementation, the expiration of the task public and private keys may be represented by deleting the stored task public and private key pair.

[0133] In the embodiment of the present application, in order to prevent the forged synchronization service component from requesting synchronization data from the central service component and ensure the security selection of data, during the process of the synchronization service component interacting with the central service component to obtain synchronization data, the synchronization service component also needs to maintain a heartbeat with the central service component, that is, perform security verification between the central service component and the synchronization service component. For details, see Fig.10 , Fig.10 A schematic diagram of security verification of a central service component and a synchronization service component provided in an embodiment of the present application includes the following steps:

[0134] Step S1000: The synchronization service component sends a heartbeat request to the central service component.

[0135] Step S1001, after receiving the heartbeat request, the central service component generates verification information for security verification;

[0136] The verification information used for security verification may be a random number R1 generated by the central service component.

[0137] Step S1002: In response to the heartbeat request, the central service component returns a heartbeat response message carrying verification information for security verification to the synchronization service component.

[0138] Step S1003: After receiving the heartbeat response message, the synchronization service component generates target information based on the verification information in the heartbeat response message.

[0139] Specifically, when the verification information is a random number R1, the random number R1 and the service identifier of the synchronization service component are combined with a hash algorithm to generate target information; wherein the service identifier ServerID=SHA256(M1'+N1'), and the target information T=SHA256(R1+ServerID).

[0140] Step S1004: The synchronization service component sends a security verification request carrying target information to the central service component.

[0141] Step S1005: After receiving the security verification request, the central service component performs security verification based on the target information in the security verification request.

[0142] In one possible implementation, security verification is performed based on the target information in the security verification request. First, the registration identifier determined when the synchronization service component is registered online is determined. The method for determining the registration identifier can be found in the above content and will not be repeated here. Then, based on the registration identifier and the verification information for security verification generated after receiving the heartbeat request, security information is generated in combination with a hash algorithm. The security information T'=SHA256(R1+RegisterID); finally, the target information is matched with the security information. If the match is successful, it is determined that the security verification has passed, otherwise it is determined to have failed.

[0143] Step S1006: The central service component sends a verification response message carrying the verification result to the synchronization service component.

[0144] It should be noted that the synchronization service component can only obtain synchronization data from the central service component when the verification result indicates that the security verification has passed. Therefore, the synchronization service component can send a heartbeat request to the central service component before each synchronization request is sent, or the synchronization service component can send a heartbeat request to the central service component on a regular and periodic basis.

[0145] In order to prevent forged synchronization service components from requesting data synchronization from the central service component and ensure the security selection of data, when the verification results represent different security verifications, that is, when the heartbeat of the synchronization service component and the central service component is interrupted, the public and private key pairs of the data synchronization task request will be invalidated, making it impossible for the forged synchronization service component to decrypt and obtain the synchronized data.

[0146] Specifically, after the central service component determines that the heartbeat of the synchronization service component is interrupted, the public and private key pair corresponding to the data synchronization task is invalidated; at the same time, after the central service component determines that the heartbeat of the synchronization service component is interrupted, the verification response information carrying the verification result representing the failure of the security verification is returned to the synchronization service component to indicate that the public and private keys of the task are invalid.

[0147] In another possible implementation, after the central service component determines that the heartbeat with the synchronization service component is interrupted, the public and private key pair corresponding to the data synchronization task is invalidated, and no verification response information is returned to the synchronization service component; at this time, the synchronization service component determines that the heartbeat with the central service component is interrupted and invalidates the task public and private keys if it does not receive the verification response information.

[0148] It should be noted that the method of invalidating the task public and private keys can be expressed as deleting the stored task public and private keys.

[0149] See also Fig.11 , Fig.11 A data synchronization method provided in an embodiment of the present application is applied to a central service component of a source database, comprising the following steps:

[0150] Step S1100, receiving a synchronization request sent by a synchronization service component of a target database for a data synchronization task; wherein the synchronization request carries a synchronization field for indicating a starting query position and a number of query data items for determining an ending query position;

[0151] Step S1101, based on the synchronization field, obtaining synchronization data matching the number of query data from the source data table;

[0152] Step S1102: encrypt the synchronization data using the task public key, and return the obtained encrypted data to the synchronization service component.

[0153] In one possible implementation, the synchronization field is determined as follows:

[0154] If the synchronization request is the initial request for a data synchronization task, the synchronization fields are initially set;

[0155] If the synchronization request is a non-initial request for a data synchronization task, and the data synchronization of the previous synchronization request is successful, the synchronization field is determined based on the synchronization data queried by the previous synchronization request;

[0156] If the synchronization request is a non-initial request for a data synchronization task, and the data synchronization of the previous synchronization request fails, the synchronization field is the synchronization field carried in the previous synchronization request.

[0157] In a possible implementation, before encrypting the synchronization data using the task public key, the following steps are also included:

[0158] Receive a verification request sent by the synchronization service component; the verification request includes at least a service identifier, which is determined based on a service name and a service hardware fingerprint of the synchronization service component;

[0159] Based on the registration information sent in advance by the synchronization service component, after the service identifier is verified, a task public key and a corresponding task private key are generated; wherein the registration information includes the registration name of the synchronization service component and the registered hardware fingerprint, or the registration information includes the registration identifier determined based on the registration name and the registered hardware fingerprint in combination with a hash algorithm;

[0160] After encrypting the task private key with the service public key, the encrypted task private key is sent to the synchronization service component, so that the synchronization service component decrypts the encrypted data based on the task private key; wherein the service public key is generated for the synchronization service component after the central service component determines that the synchronization service component is online and registered.

[0161] In a possible implementation, a heartbeat response message is returned in response to a heartbeat request sent by a synchronization service component; wherein the heartbeat response message carries verification information for security verification;

[0162] Receiving a security verification request sent by a synchronization service component, the security verification request carrying target information determined based on the verification information;

[0163] Perform security verification based on the target information, obtain the corresponding verification result, and return the verification response information carrying the verification result to the synchronization service component.

[0164] In a possible implementation, if the verification result indicates that the verification has failed, the verification response message is further used to indicate that the task public key and the associated task private key are invalid.

[0165] In a possible implementation, when it is determined that the data synchronization task is completed, a task completion identifier is returned to the synchronization service component; wherein the task completion identifier is used to indicate that the task public key and the associated task private key are invalid.

[0166] See also Fig.12 , Fig.12 Another data synchronization method provided in an embodiment of the present application is applied to a synchronization service component of a target database, and the method includes:

[0167] Step S1200: Send a synchronization request to the central service component of the source database for the data synchronization task; wherein the synchronization request carries a synchronization field for indicating the starting query position and the number of query data for determining the ending query position;

[0168] Step S1201, receiving encrypted data returned by the central service component; wherein the encrypted data is obtained by the central service component after encrypting the synchronization data matching the number of query data obtained from the source data table based on the synchronization field using the task public key;

[0169] Step S1202: decrypt the encrypted data using the task private key, and store the obtained synchronization data into the target database.

[0170] In one possible implementation, the synchronization field is determined as follows:

[0171] If the synchronization request is the initial request for a data synchronization task, the synchronization fields are initially set;

[0172] If the synchronization request is a non-initial request for a data synchronization task, and the data synchronization of the previous synchronization request is successful, the synchronization field is determined based on the synchronization data queried by the previous synchronization request;

[0173] If the synchronization request is a non-initial request for a data synchronization task, and the data synchronization of the previous synchronization request fails, the synchronization field is the synchronization field carried in the previous synchronization request.

[0174] In a possible implementation, before decrypting the encrypted data using the task private key, the following steps are also included:

[0175] A verification request sent to the central service component; the verification request includes at least a service identifier, which is determined based on the service name and service hardware fingerprint of the synchronization service component;

[0176] Receive the task private key encrypted by the service public key returned by the central service component; wherein the task private key is generated by the central service component after verifying the service identifier based on the registration information sent in advance by the synchronization service component; the registration information includes the registration name of the synchronization service component and the registered hardware fingerprint, or the registration information includes the registration identifier determined based on the registration name and the registered hardware fingerprint in combination with a hash algorithm; the service public key is generated for the synchronization service component after the central service component determines that the synchronization service component is online and registered.

[0177] In a possible implementation, a heartbeat request is sent to a central service component, and a corresponding heartbeat response message is received; wherein the heartbeat response message carries verification information for security verification;

[0178] A security verification request is sent to the central service component, and a corresponding verification response message carrying a verification result is received; wherein the security verification request carries target information determined based on the verification information, and the verification result is obtained by performing security verification based on the target information.

[0179] In a possible implementation, if the verification result indicates that the verification has failed, the verification response message is further used to indicate that the task public key and the associated task private key are invalid.

[0180] In a possible implementation, when it is determined that the data synchronization task is completed, a task completion identifier is returned to the synchronization service component; wherein the task completion identifier is used to indicate that the task public key and the associated task private key are invalid.

[0181] In this application, the central service component of the source database interacts with the synchronization service component of the target database to achieve data synchronization of cloud databases in cross-cloud scenarios, ensure data consistency, make full use of the resources and advantages of different cloud databases, and improve service quality and response speed worldwide. Specifically, the central service component receives a synchronization request sent by the synchronization service component for a data synchronization task. The synchronization request carries a synchronization field for indicating the starting query position and the number of query data items for determining the ending query position. Based on the synchronization field, the central service component obtains synchronization data that matches the number of query data items from the source data table to ensure the accuracy of the query synchronization data. Furthermore, the central service component encrypts the synchronization data through the task public key and returns the obtained encrypted data to the synchronization service component. During the data synchronization process, the synchronization data is encrypted to ensure data security, prevent data loss and leakage, and ensure business data security. At the same time, in a cross-cloud scenario, it is not necessary to open the database port to the public network. Only the database components (such as the central service component of the source database and the synchronization service component of the target database) need to be opened to avoid over-reliance on the functions provided by the cloud vendors associated with the cloud database, and reduce the coupling with the cloud vendor services in terms of business.

[0182] Based on the same inventive concept, the embodiment of the present application provides a data synchronization device, which is applied to the central service component of the source database. Fig.13 , the data synchronization device 1300 includes:

[0183] The first receiving module 1301 is used to receive a synchronization request sent by a synchronization service component of a target database for a data synchronization task; wherein the synchronization request carries a synchronization field for indicating a starting query position and a number of query data for determining a termination query position;

[0184] The acquisition module 1302 is used to acquire the synchronization data matching the number of query data from the source data table based on the synchronization field;

[0185] The return module 1303 is used to encrypt the synchronization data using the task public key and return the obtained encrypted data to the synchronization service component.

[0186] In one possible implementation, the synchronization field is determined as follows:

[0187] If the synchronization request is the initial request for a data synchronization task, the synchronization fields are initially set;

[0188] If the synchronization request is a non-initial request for a data synchronization task, and the data synchronization of the previous synchronization request is successful, the synchronization field is determined based on the synchronization data queried by the previous synchronization request;

[0189] If the synchronization request is a non-initial request for a data synchronization task, and the data synchronization of the previous synchronization request fails, the synchronization field is the synchronization field carried in the previous synchronization request.

[0190] In a possible implementation, the returning module 1303 is further configured to:

[0191] Before encrypting the synchronization data using the task public key, receiving a verification request sent by the synchronization service component; the verification request includes at least a service identifier, which is determined based on the service name and service hardware fingerprint of the synchronization service component;

[0192] Based on the registration information sent in advance by the synchronization service component, after the service identifier is verified, a task public key and a corresponding task private key are generated; wherein the registration information includes the registration name of the synchronization service component and the registered hardware fingerprint, or the registration information includes the registration identifier determined based on the registration name and the registered hardware fingerprint in combination with a hash algorithm;

[0193] After encrypting the task private key with the service public key, the encrypted task private key is sent to the synchronization service component, so that the synchronization service component decrypts the encrypted data based on the task private key; wherein the service public key is generated for the synchronization service component after the central service component determines that the synchronization service component is online and registered.

[0194] In a possible implementation, the returning module 1303 is further configured to:

[0195] In response to the heartbeat request sent by the synchronization service component, a heartbeat response message is returned; wherein the heartbeat response message carries verification information for security verification;

[0196] Receiving a security verification request sent by a synchronization service component, the security verification request carrying target information determined based on the verification information;

[0197] Perform security verification based on the target information, obtain the corresponding verification result, and return the verification response information carrying the verification result to the synchronization service component.

[0198] In a possible implementation, if the verification result indicates that the verification has failed, the verification response message is further used to indicate that the task public key and the associated task private key are invalid.

[0199] In a possible implementation, when it is determined that the data synchronization task is completed, a task completion identifier is returned to the synchronization service component; wherein the task completion identifier is used to indicate that the task public key and the associated task private key are invalid.

[0200] Based on the same inventive concept, the embodiment of the present application provides a data synchronization device, which is applied to the synchronization service component of the target database, see Fig.14 , the data synchronization device 1400 includes:

[0201] The sending module 1401 is used to send a synchronization request to the central service component of the source database for the data synchronization task; wherein the synchronization request carries a synchronization field for indicating the starting query position and the number of query data for determining the ending query position;

[0202] The second receiving module 1402 is used to receive the encrypted data returned by the central service component; wherein the encrypted data is obtained by the central service component after encrypting the synchronization data matching the number of query data obtained from the source data table based on the synchronization field through the task public key;

[0203] The data storage module 1403 is used to decrypt the encrypted data using the task private key and store the obtained synchronization data into the target database.

[0204] In one possible implementation, the synchronization field is determined as follows:

[0205] If the synchronization request is the initial request for a data synchronization task, the synchronization fields are initially set;

[0206] If the synchronization request is a non-initial request for a data synchronization task, and the data synchronization of the previous synchronization request is successful, the synchronization field is determined based on the synchronization data queried by the previous synchronization request;

[0207] If the synchronization request is a non-initial request for a data synchronization task, and the data synchronization of the previous synchronization request fails, the synchronization field is the synchronization field carried in the previous synchronization request.

[0208] In a possible implementation, the data storage module 1403 is further used to:

[0209] A verification request sent to the central service component before decrypting the encrypted data using the task private key; the verification request includes at least a service identifier, which is determined based on the service name and service hardware fingerprint of the synchronization service component;

[0210] Receive the task private key encrypted by the service public key returned by the central service component; wherein the task private key is generated by the central service component after verifying the service identifier based on the registration information sent in advance by the synchronization service component; the registration information includes the registration name of the synchronization service component and the registered hardware fingerprint, or the registration information includes the registration identifier determined based on the registration name and the registered hardware fingerprint in combination with a hash algorithm; the service public key is generated for the synchronization service component after the central service component determines that the synchronization service component is online and registered.

[0211] In a possible implementation, the sending module 1401 is further configured to:

[0212] Send a heartbeat request to the central service component and receive a corresponding heartbeat response message; wherein the heartbeat response message carries verification information for security verification;

[0213] A security verification request is sent to the central service component, and a corresponding verification response message carrying a verification result is received; wherein the security verification request carries target information determined based on the verification information, and the verification result is obtained by performing security verification based on the target information.

[0214] In a possible implementation, if the verification result indicates that the verification has failed, the verification response message is further used to indicate that the task public key and the associated task private key are invalid.

[0215] In a possible implementation, when it is determined that the data synchronization task is completed, a task completion identifier is returned to the synchronization service component; wherein the task completion identifier is used to indicate that the task public key and the associated task private key are invalid.

[0216] It should be noted that although several units (or modules) of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units (or modules) described above can be concretized in one unit (or module). Conversely, the features and functions of one unit (or module) described above can be further divided into multiple units (or modules) for concretization. Of course, when implementing the present application, the functions of each unit (or module) can also be implemented in the same one or more software or hardware.

[0217] In the embodiments of the present application, the term unit (or module) refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit that includes the function of the module or unit.

[0218] After introducing the data synchronization method and device according to an exemplary embodiment of the present application, another exemplary embodiment of the present application, an electronic device, is introduced next.

[0219] Those skilled in the art will appreciate that various aspects of the present application may be implemented as a system, method or program product. Therefore, various aspects of the present application may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to as "circuit", "module" or "system" herein.

[0220] In a possible implementation, the electronic device provided in the embodiment of the present application may include at least a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes any step of the data synchronization method in various exemplary implementations of the present application.

[0221] In this embodiment, the structure of the electronic device can be as follows Fig.15 As shown, it includes a memory 1501 , a communication module 1503 and one or more processors 1502 .

[0222] The memory 1501 is used to store computer programs executed by the processor 1502. The memory 1501 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and programs required for running the instant messaging function, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.

[0223] The memory 1501 may be a volatile memory, such as a random-access memory (RAM); the memory 1501 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or the memory 1501 may be any other medium that can be used to carry or store a desired computer program in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1501 may be a combination of the above memories.

[0224] The processor 1502 may include one or more central processing units (CPU) or a digital processing unit, etc. The processor 1502 is used to implement the above data synchronization method when calling the computer program stored in the memory 1501 .

[0225] The communication module 1503 is used to communicate with the target device and other servers.

[0226] The specific connection medium between the memory 1501, the communication module 1503 and the processor 1502 is not limited in the embodiment of the present application. Fig.15 In the embodiment, the memory 1501 and the processor 1502 are connected via a bus 1504. The bus 1504 is connected to the processor 1502 via a bus 1504. Fig.15 The connections between the other components are described with bold lines, which are only for illustration and are not intended to be limiting. The bus 1504 can be divided into an address bus, a data bus, a control bus, etc. For ease of description, Fig.15 The diagram shows that only one thick line is used, but this does not mean that there is only one bus or only one type of bus.

[0227] The memory 1501 stores a computer storage medium, and the computer storage medium stores computer executable instructions, and the computer executable instructions are used to implement the data synchronization method of the embodiment of the present application. The processor 1502 is used to execute the above data synchronization method.

[0228] In some possible implementations, various aspects of the data synchronization method provided by the present application may also be implemented in the form of a program product, which includes a computer program. When the program product is run on an electronic device, the computer program is used to enable the electronic device to execute the steps of the data synchronization method according to various exemplary implementations of the present application described above in this specification.

[0229] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0230] The program product of the embodiment of the present application can adopt a portable compact disk read-only memory (CD-ROM) and include a computer program, and can be run on a computing device. However, the program product of the present application is not limited to this. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with a command execution system, device or device.

[0231] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein a readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with a command execution system, apparatus, or device.

[0232] The computer program embodied on the 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.

[0233] Computer programs for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The computer program may be executed entirely on the user's computing device, partially on a terminal device, as a separate software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user's computing device via any type of network including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0234] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain a computer-usable computer program.

[0235] The present application is described 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 application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program commands. These computer program commands can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the commands executed by the processor of the computer or other programmable device generate commands for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that specifies functions in one or more boxes.

[0236] These computer program commands may also be stored in a computer-readable memory capable of directing a computer or other programmable device to operate in a specific manner, so that the commands stored in the computer-readable memory produce an article of manufacture comprising a command device, the command device implementing the process Figure 1 A process or multiple processes and / or boxes Figure 1 Specify the function in one or more boxes.

[0237] These computer program commands can also be loaded onto a computer or other programmable device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the commands executed on the computer or other programmable device provide the instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0238] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0239] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A data synchronization method, characterized in that: A central service component applied to a source database, the method comprising: Receive a synchronization request sent by a synchronization service component of a target database for a data synchronization task; wherein the synchronization request carries a synchronization field for indicating a starting query position and a number of query data items for determining a termination query position; Based on the synchronization field, obtaining synchronization data matching the number of query data from the source data table; The synchronization data is encrypted using the task public key, and the obtained encrypted data is returned to the synchronization service component.

2. The method according to claim 1, characterized in that The synchronization field is determined as follows: If the synchronization request is an initial request for the data synchronization task, the synchronization field is initially set; If the synchronization request is a non-initial request for the data synchronization task, and the data synchronization of the previous synchronization request is successful, then the synchronization field is determined based on the synchronization data queried by the previous synchronization request; If the synchronization request is a non-initial request for the data synchronization task, and data synchronization of a synchronization request preceding the synchronization request fails, then the synchronization field is a synchronization field carried in the preceding synchronization request.

3. The method according to claim 1, characterized in that Before encrypting the synchronization data by the task public key, the method further includes: receiving a verification request sent by the synchronization service component; the verification request at least includes a service identifier, and the service identifier is determined according to a service name and a service hardware fingerprint of the synchronization service component; Based on the registration information sent in advance by the synchronization service component, after the service identifier is verified, the task public key and the corresponding task private key are generated; wherein the registration information includes the registration name of the synchronization service component and the registered hardware fingerprint, or the registration information includes the registration identifier determined based on the registration name and the registered hardware fingerprint in combination with a hash algorithm; After encrypting the task private key by the service public key, the encrypted task private key is sent to the synchronization service component, so that the synchronization service component decrypts the encrypted data based on the task private key; wherein, the service public key is generated for the synchronization service component after the central service component determines that the synchronization service component is online and registered.

4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Returning a heartbeat response message in response to the heartbeat request sent by the synchronization service component; wherein the heartbeat response message carries verification information for security verification; Receiving a security verification request sent by the synchronization service component, wherein the security verification request carries target information determined based on the verification information; A security verification is performed based on the target information, a corresponding verification result is obtained, and a verification response message carrying the verification result is returned to the synchronization service component.

5. The method according to claim 4, characterized in that If the verification result indicates a verification failure, the verification response message is also used to indicate that the task public key and the associated task private key are invalid.

6. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: When it is determined that the data synchronization task is completed, a task completion identifier is returned to the synchronization service component; wherein the task completion identifier is used to indicate that the task public key and the associated task private key are invalid.

7. A data synchronization method, characterized in that: A synchronization service component applied to a target database, the method comprising: For the data synchronization task, a synchronization request is sent to the central service component of the source database; wherein the synchronization request carries a synchronization field for indicating the starting query position and the number of query data for determining the ending query position; Receive the encrypted data returned by the central service component; wherein the encrypted data is obtained by the central service component after encrypting the synchronization data matching the number of query data obtained from the source data table based on the synchronization field through the task public key; The encrypted data is decrypted using the task private key, and the obtained synchronization data is stored in the target database.

8. The method according to claim 7, characterized in that The synchronization field is determined as follows: If the synchronization request is an initial request for the data synchronization task, the synchronization field is initially set; If the synchronization request is a non-initial request for the data synchronization task, and the data synchronization of the previous synchronization request is successful, then the synchronization field is determined based on the synchronization data queried by the previous synchronization request; If the synchronization request is a non-initial request for the data synchronization task, and data synchronization of a synchronization request preceding the synchronization request fails, then the synchronization field is a synchronization field carried in the preceding synchronization request.

9. The method according to claim 7, characterized in that Before decrypting the encrypted data using the task private key, the method further includes: A verification request sent to the central service component; the verification request includes at least a service identifier, and the service identifier is determined according to the service name and service hardware fingerprint of the synchronization service component; Receive the task private key encrypted by the service public key returned by the central service component; wherein the task private key is generated by the central service component after verifying the service identifier based on the registration information sent in advance by the synchronization service component; the registration information includes the registration name and the registered hardware fingerprint of the synchronization service component, or the registration information includes the registration identifier determined based on the registration name and the registered hardware fingerprint in combination with a hash algorithm; the service public key is generated for the synchronization service component after the central service component determines that the synchronization service component is online and registered.

10. The method according to any one of claims 7 to 9, characterized in that: The method further comprises: Sending a heartbeat request to the central service component and receiving a corresponding heartbeat response message; wherein the heartbeat response message carries verification information for security verification; Send a security verification request to the central service component, and receive corresponding verification response information carrying a verification result; wherein the security verification request carries target information determined based on the verification information, and the verification result is obtained by performing security verification based on the target information.

11. The method according to claim 10, characterized in that If the verification result indicates a verification failure, the verification response message is also used to indicate that the task public key and the associated task private key are invalid.

12. The method according to any one of claims 7 to 9, characterized in that: The method further comprises: When it is determined that the data synchronization task is completed, a task completion identifier is returned to the synchronization service component; wherein the task completion identifier is used to indicate that the task public key and the associated task private key are invalid.

13. A data synchronization device, characterized in that: A central service component applied to a source database, the device comprising: A first receiving module is used to receive a synchronization request sent by a synchronization service component of a target database for a data synchronization task; wherein the synchronization request carries a synchronization field for indicating a starting query position and a number of query data for determining an ending query position; An acquisition module, configured to acquire, based on the synchronization field, synchronization data matching the number of query data from a source data table; The return module is used to encrypt the synchronization data using the task public key and return the obtained encrypted data to the synchronization service component.

14. A data synchronization device, characterized in that: A synchronization service component applied to a target database, the device comprising: A sending module, used for sending a synchronization request to a central service component of a source database for a data synchronization task; wherein the synchronization request carries a synchronization field for indicating a starting query position and a number of query data for determining a termination query position; A second receiving module is used to receive the encrypted data returned by the central service component; wherein the encrypted data is obtained by the central service component using the task public key to encrypt the synchronization data matched with the number of query data obtained from the source data table based on the synchronization field; The data storage module is used to decrypt the encrypted data using the task private key and store the obtained synchronization data into the target database.

15. A computing device, characterized in that: The computing device comprises: a processor and a memory, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to implement the method described in any one of claims 1 to 6, or to implement the method described in any one of claims 7 to 12.

16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of claims 1 to 6 is implemented, or the method described in any one of claims 7 to 12 is implemented.

17. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 6, or implements the method according to any one of claims 7 to 12.

Citation Information

Patent Citations

  • Data synchronization method and device

    CN107343049A

  • Data synchronization method and device, data synchronization platform and readable medium

    CN112347192A

  • Data synchronization method and device for cross-machine-room Redis database

    CN115687511A

  • Validating keys derived from an oblivious pseudorandom function

    US20200067699A1