WO2020151054A1 - 一种数据同步方法及装置 - Google Patents

一种数据同步方法及装置 Download PDF

Info

Publication number
WO2020151054A1
WO2020151054A1 PCT/CN2019/077238 CN2019077238W WO2020151054A1 WO 2020151054 A1 WO2020151054 A1 WO 2020151054A1 CN 2019077238 W CN2019077238 W CN 2019077238W WO 2020151054 A1 WO2020151054 A1 WO 2020151054A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
source
management device
record
data set
Prior art date
Application number
PCT/CN2019/077238
Other languages
English (en)
French (fr)
Inventor
汪建福
Original Assignee
网宿科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 网宿科技股份有限公司 filed Critical 网宿科技股份有限公司
Priority to EP19772639.1A priority Critical patent/EP3716094A4/en
Priority to US16/588,798 priority patent/US20200242131A1/en
Publication of WO2020151054A1 publication Critical patent/WO2020151054A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/254Extract, transform and load [ETL] procedures, e.g. ETL data flows in data warehouses

Definitions

  • This application relates to the field of data processing technology, and in particular to a data synchronization method and device.
  • Data synchronization has always been an inevitable problem in the interaction between computer systems.
  • the timeliness and accuracy of data synchronization will directly affect the interaction between computer systems.
  • the existing data synchronization technology usually first synchronizes each source data in each source database to a data sink, and then the data sink performs calculations to obtain the required data.
  • this method requires such a calculation process for each data sink, which is more complicated and wastes time; based on this, there is an urgent need for a data synchronization method. It is used to solve the problem that the data synchronization process in the prior art is relatively complicated and takes a long time.
  • the purpose of some of the embodiments of the present application is to provide a data synchronization method and device to solve the technical problem that the data synchronization process in the prior art is complicated and takes a long time.
  • the embodiment of the application provides a data synchronization method, the method is applied to a data synchronization system, and the system includes a management device, multiple source databases, and at least one data sink; the method includes:
  • the management device receives each source data sent by each source database in the current period; each source data is the full amount of data corresponding to each source database in the current period;
  • the management device performs calculations according to the association relationship between the source databases and the multiple data records included in each source data to obtain the target data set;
  • the management device sends the target data set to each data sink, and the data sink is used to receive data.
  • the embodiment of the present application sets a management device, and calculates each source data of each source database through the management device, thereby determining a target data set at the management device level, and then sending the target incremental data set to each data sink.
  • each data sink needs to calculate the target data set separately
  • only the management device needs to perform this calculation process, and the target data set is calculated during the synchronization process.
  • the management device performs calculations according to the association relationship between the source databases and multiple data records included in each source data to obtain the target data set, including:
  • the management device determines the first data set in the current period according to the association relationship between the source databases and the multiple data records included in each source data;
  • the management device determines that there is a second data set corresponding to the previous period of the current period, it determines the incremental data set of the first data set compared to the second data set, and adds The quantity data set is used as the target data set; the second data set is obtained according to the source data sent by the source databases in the previous week.
  • each data record includes an index value
  • the association relationship between the source databases is determined in the following manner:
  • the management device determines that the index value in the second source data is consistent with the index value corresponding to the first data record according to the index value corresponding to the first data record According to the position of the first data record in the first data source and the position of the second data record in the second data source, it is determined that the first data record and The association relationship of the second data record;
  • the first source data is any one of the source data, and the first data record is any one of the multiple data records included in the first source data data record;
  • the association relationship between the multiple data records included in each source data is determined.
  • the source databases are heterogeneous databases, and the heterogeneous databases are databases with different structures between the databases;
  • the association relationship of each source data is an association relationship based on the structured query language SQL.
  • the use of a general-purpose SQL language can reduce the difficulty of computing heterogeneous source data, facilitate the logical calculation of heterogeneous source data, and facilitate data maintenance.
  • the management device sending the target data set to each data sink includes:
  • the management device determines, from the target data set, each target data that meets the data requirements of each data sink according to the data requirements of each data sink;
  • the management device correspondingly sends the respective target data to the respective data sinks.
  • it also includes:
  • the management device determines that the second data set does not exist, it uses the first data set as the target data set.
  • the method further includes:
  • the management device obtains data synchronization information of each data sink;
  • the data synchronization information includes at least one of a data addition record, a data deletion record, and a data modification record;
  • the management device monitors the synchronization status of each data sink according to the data synchronization information of each data sink.
  • the method further includes:
  • the management device Acquiring, by the management device, the data sending status of each source database, the data sending status being determined according to the data sending time and/or data sending volume of each source data;
  • the management device monitors the synchronization status of each source database according to the data transmission status of each source database.
  • the method further includes:
  • the management device determines that the transmission of the target data set fails, and the number of transmission failures is greater than a preset threshold, the management device sends an alarm message to the administrator, and the alarm message is used to notify the administrator that the transmission of the target data set fails .
  • the management device can send an alarm message to the administrator in time, so that the administrator can handle it in time.
  • An embodiment of the application provides a data synchronization device, the device is applied to a data synchronization system, the system includes a management device, multiple source databases, and at least one data sink; the device is a management device, and the device includes:
  • a receiving unit configured to receive each source data sent by each source database in the current period; each source data is the full amount of data corresponding to each source database in the current period;
  • the processing unit is configured to perform calculations according to the association relationship between the source databases and the multiple data records included in each source data to obtain the target data set;
  • the sending unit is configured to send the target data set to each data sink, and the data sink is used to receive data.
  • the processing unit is specifically configured to:
  • Second data set Determine the first data set in the current cycle according to the association relationship between the source databases and the multiple data records included in each source data; and if it is determined that there is a first data set corresponding to the previous cycle of the current cycle Second data set, determine the incremental data set of the first data set compared to the second data set, and use the incremental data set as the target data set; the second data set is based on The source database is obtained from the source data sent in the previous week.
  • each data record includes an index value
  • the association relationship between the source databases is determined in the following manner:
  • the management device determines that the index value in the second source data is consistent with the index value corresponding to the first data record according to the index value corresponding to the first data record According to the position of the first data record in the first data source and the position of the second data record in the second data source, it is determined that the first data record and The association relationship of the second data record;
  • the first source data is any one of the source data, and the first data record is any one of the multiple data records included in the first source data data record;
  • the association relationship between the multiple data records included in each source data is determined.
  • the source databases are heterogeneous databases, and the heterogeneous databases are databases with different structures between the databases;
  • the association relationship of each source data is an association relationship based on the structured query language SQL.
  • the sending unit is specifically configured to:
  • each target data meeting the data requirements of the data sinks is determined from the target data set; and each target data is correspondingly sent to the data sinks.
  • the processing unit is further configured to:
  • the first data set is used as the target data set.
  • the processing unit is further configured to:
  • the data synchronization information includes at least one of a data addition record, a data deletion record, and a data modification record; and according to the data synchronization information of each data sink, The synchronization of the data sink is monitored.
  • the processing unit is further configured to:
  • the data sending status is determined according to the data sending time and/or data sending volume of each source data; and according to the data sending status of each source database, The synchronization status of each source database is monitored.
  • the processing unit is further configured to:
  • an alarm message is sent to the administrator, and the alarm message is used to notify the administrator that the transmission of the target data set fails.
  • the embodiments of the present application also provide a device that has the function of implementing the data synchronization method described above.
  • This function can be implemented by hardware executing corresponding software.
  • the device includes: a processor, a transceiver, and a memory; the memory is used to store computer execution instructions, and the transceiver is used to implement communication between the device and other devices.
  • the entity communicates, the processor and the memory are connected through the bus, and when the device is running, the processor executes the computer execution instructions stored in the memory, so that the device executes the data synchronization method described above.
  • the embodiments of the present application also provide a computer storage medium, in which a software program is stored, and the software program, when read and executed by one or more processors, realizes the data described in the various possible implementation manners above Synchronization method.
  • the embodiment of the present application also provides a computer program product containing instructions, which when running on a computer, enables the computer to execute the data synchronization method described in the various possible implementation manners.
  • Figure 1 is a system architecture diagram according to an embodiment of the present application.
  • FIG. 2 is a schematic flowchart of a data synchronization method according to an embodiment of the present application
  • FIG. 3 is a schematic diagram of an overall flow according to an embodiment of the present application.
  • Fig. 4 is a schematic structural diagram of a data synchronization device according to an embodiment of the present application.
  • Fig. 1 exemplarily shows a system architecture diagram to which an embodiment of the present application is applicable.
  • the system 100 includes a management device 101, multiple source databases (such as the source database 1021, the source database 1022, and the source database 1023 shown in Figure 1), and at least one data sink (such as the one shown in Figure 1). Out data sink 1031, data sink 1032, and data sink 1033).
  • the management device 101 can be connected to any source database via a network.
  • the management device 101 can be connected to any one of the source database 1021, the source database 1022, and the source database 1023 via the network; the management device 101 can be connected to any data sink. It may be connected through a network.
  • the management device 101 may be connected to any one of the data sink 1031, the data sink 1032, and the data sink 1033 through the network.
  • FIG. 2 exemplarily shows a schematic flow diagram corresponding to a data synchronization method provided by an embodiment of the present application, which specifically includes the following steps:
  • Step 201 The management device receives each source data sent by each source database in the current period.
  • Step 202 The management device performs calculations according to the association relationship between the source databases and the multiple data records included in each source data to obtain the target data set.
  • Step 203 The management device sends the target data set to each data sink, and the data sink is used to receive data.
  • the embodiment of the present application sets a management device, and calculates each source data of each source database through the management device, thereby determining a target data set at the management device level, and then sending the target data set to each data sink.
  • each data sink needs to calculate the target data set separately
  • only the management device needs to perform this calculation process, and the target data set is calculated during the synchronization process.
  • each source data may be the full amount of data corresponding to each source database in the current period.
  • Table 1 it is an example of each source data.
  • the source data corresponding to source database A is the full amount of data A corresponding to source database A in the current period
  • the source data corresponding to source database B is the full amount of data B corresponding to source database B in the current period
  • the source corresponding to source database C The data is the full amount of data C corresponding to the source database C in the current cycle.
  • Table 1 An example of each source data
  • Source database source data Source database A Full data A Source database B Full data B Source database C Full data C
  • each source data may include multiple data records. As shown in Table 2, it is an example of source data. Among them, the full amount of data A corresponding to source database A in the current cycle includes data record A1, data record A2, and data record A3; the full amount of data B corresponding to source database B in the current cycle includes data record B1, data record B2, and data record B3: The full data C corresponding to the source database C in the current cycle includes data record C1, data record C2, and data record C3.
  • the source data sent by source database A in the current period includes: data record A1, Zhang Sanyu score 80 Points; data record A2, Li Si's math score is 90 points; data record A3, Zhao Wu's foreign language score is 100 points.
  • the source data sent by source database B in the current cycle includes: data record B1, Zhang Sanyu's instructor is Mr. Wang; data record B2, Li Si's math instructor For Teacher Qian; Data record B3, Zhao Wu's foreign language instructor is Teacher Sun.
  • Table 3a An example of source data sent by source database A in the current period
  • Table 3b An example of source data sent by source database B in the current cycle
  • each data record may include an index value.
  • the content corresponding to the name can be the index value of each data record, that is, the index value of data record A1 is "Zhang San", and the index value of data record A2 is “Li Si”.
  • the index value of data record A3 is "Zhao Wu”.
  • the index value of data record B1 is also "Zhang San”
  • the index value of data record B2 is also “Li Si”
  • the index value of data record B3 is also "Zhao Wu”.
  • the management device can also obtain the data transmission status of each source database, and can monitor the synchronization status of each source database according to the data transmission status of each source database.
  • the data transmission situation may be determined according to the data transmission time and/or data transmission volume of each source data. In this way, the synchronization status of each source database can be monitored in real time, which is convenient for management equipment statistical analysis.
  • the association relationship between the source databases can be determined according to the source data sent by the source databases in the current period. Specifically, for the first data record in the first source data, the management device may according to the index value corresponding to a data record, if it is determined that there is a second source data whose index value is consistent with the index value corresponding to the first data record. Data record, according to the position of the first data record in the first data source and the position of the second data record in the second data source, determine the association relationship between the first data record and the second data record; wherein, the first source The data is any source data in each source data, and the first data record is any data record in a plurality of data records included in the first source data. Furthermore, the management device may determine the association relationship between the source databases according to the association relationship between the multiple data records included in each source data.
  • the index value of the data record A1 is "Zhang San"
  • the index value of the data record B1 is also "Zhang San”.
  • association relationship there is an association relationship between the data record A1 and the data record B1, and this association relationship can be based on the data record A1 in the source
  • the position in the source data sent by database A (that is, the first row) and the position of data record B1 in the source data sent by source database B (that is, the first row) are determined, that is, the first row in the source data sent by source database A
  • the data record A1 of a row is associated with the data record B1 of the first row in the source data sent by the source database B.
  • the data record A2 in the second row of the source data sent by the source database A has an association relationship with the data record B2 in the second row of the source data sent by the source database B, and the third in the source data sent by the source database A
  • the data record A3 of the row is associated with the data record B3 of the third row in the source data sent by the source database B.
  • the association relationship between source database A and source database B can be determined, that is, the relationship between source database A
  • the first row is associated with the first row of source database B
  • the second row of source database A is associated with the second row of source database B
  • the third year row of source database A is associated with the third row of source database B.
  • the management device may perform calculations based on the association relationship between the source databases and the multiple data records included in each source data to obtain the target data set.
  • the management device may determine the first data set in the current period according to the association relationship between the source databases and the multiple data records included in each source data.
  • the first data set may refer to a set of source data sent by each source database. Taking the content shown in Table 3a and Table 3b as an example, according to the above-described association relationship between the source database A and the source database B and the data records included in Table 3a and Table 3b, the results shown in Table 4 An example of the first data set.
  • Table 4 An example of the first data set
  • the source databases can be homogeneous databases.
  • the source databases may also be heterogeneous databases, and the heterogeneous databases are databases with different structures between the databases.
  • the association relationship of each source data is an association relationship based on the structured query language SQL. Specifically, each heterogeneous source database can be analyzed, mapped into corresponding data tables, and the relationship between each heterogeneous source data can be analyzed to output SQL statements that meet the requirements. In this way, the use of a general SQL language can reduce the difficulty of calculating heterogeneous source data, facilitate the logical calculation of heterogeneous source data, and facilitate data maintenance.
  • the management device can first determine whether there is a second data set corresponding to the previous period of the current period, and if so, it can determine the incremental data set of the first data set compared to the second data set, and change the increment
  • the data set is used as the target data set; if it does not exist, the first data set can be used as the target data set.
  • the second data set may be obtained based on each source data sent by each source database in the previous week. The specific obtaining method and the obtaining method type of the first data set are not described in detail here.
  • the management device is required to calculate the incremental data set during the synchronization process, so that the data sink can directly obtain the incremental data set, which greatly reduces the calculation amount of the entire system and improves the timeliness of data synchronization; Further, by using a management device to send an incremental data set to each data sink, a copy of the incremental data set can be sent to multiple data sinks at the same time, thereby improving the efficiency of data synchronization.
  • the first data record in the second data set is that Zhang San's language score is 80 points, and the instructor is Teacher Wang; Li Si's math score is 90 points, and the instructor is Qian teacher.
  • Table 5 An example of the second data set
  • an example of the incremental data set shown in Table 6 can be obtained to determine that the incremental data set is: Zhao Wu Foreign Language 100 points, and the instructor is Teacher Sun .
  • the management device may directly send the target data set to each data sink, where the data sink may be used to receive data.
  • the management device may also determine each target data meeting the data requirements of each data sink from the target data set according to the data requirements of each data sink, and then may correspondingly send each target data to each data sink. For example, taking the incremental data set shown in Table 6 as an example, if the data requirements of data sink A are required subjects and scores, the target data corresponding to data sink A can be determined as: Zhao Wu's foreign language score is 100 points; If the data requirements of Data Sink B require subjects and instructors, the target data corresponding to Data Sink B can be determined as: Zhao Wu's foreign language instructor is Teacher Sun.
  • the management device can obtain the data synchronization information of each data sink, and then can monitor the synchronization status of each data sink according to the data synchronization information of each data sink.
  • the data synchronization information may include at least one of data addition records, data deletion records, and data modification records.
  • the process of writing the target data set to each data sink can be monitored in real time, and the synchronization of each data sink, such as monitoring data addition records, data deletion records, and data modification records, can be monitored, which is convenient for management equipment statistical analysis; further, this application
  • the data synchronization process is monitored by the management device, so that the entire data synchronization process is transparent to the administrator, so that the administrator can control the data ton publication situation in real time.
  • step 203 if the management device determines that the target data set has failed to be sent, and the number of failed sending times is greater than a preset threshold, it sends an alarm message to the administrator, where the alarm message is used to notify the administrator to send the target data set. failure. In this way, once the target data set fails to be sent repeatedly, the management device can send an alarm message to the administrator in time, so that the administrator can handle it in time.
  • Step 301 Each source database sends each source data to the management device in the current period.
  • step 302 the management device judges whether all source data is sent completely, if not all the source data is sent, then step 303 is executed; otherwise, step 305 is executed.
  • step 303 the management device judges whether the data sending time of each source data is greater than a preset threshold, and if it is greater than, step 304 is executed; otherwise, step 302 is returned.
  • Step 304 The management device attempts to re-receive the source data whose data sending time is greater than a preset threshold.
  • Step 305 The management device determines the first data set in the current period according to the association relationship between the source databases and the multiple data records included in each source data.
  • step 306 the management device determines whether there is a second data set corresponding to the previous period of the current period, and if so, execute step 307; otherwise, execute step 310.
  • Step 307 The management device determines the incremental data set of the first data set compared to the second data set, and uses the incremental data set as the target data set.
  • Step 308 The management device determines each target data meeting the data requirements of each data sink from the target data set according to the data requirements of each data sink.
  • Step 309 The management device sends each target data to each data sink correspondingly.
  • Step 310 The management device uses the first data set as the target data set, and according to the data requirements of each data sink, determines each target data that meets the data requirements of each data sink from the target data set.
  • Step 311 The management device sends each target data to each data sink.
  • the management device can analyze each heterogeneous source database, map it into the corresponding source data table, analyze the relationship between each heterogeneous source data, and output SQL statements that meet the requirements; then, the management device can choose a stable memory
  • the database solution (for example, h2) creates an in-memory database according to the source data table corresponding to the heterogeneous source data; then, the management device can perform timing tasks to synchronize each heterogeneous source data to the in-memory database; further, the management device can Check whether all heterogeneous source data has been synchronized to the corresponding table of the in-memory database.
  • the calculation starts. Specifically, according to the SQL statement output above, the query is executed in the in-memory database to generate the full data of the current cycle. Then judge whether there is the full data corresponding to the previous cycle. If it does not exist, you can directly push the full data of the current cycle to each data sink; if it exists, you can combine the full data of the current cycle with the full data of the previous cycle. Compare, generate incremental data set, and push the incremental data set to each data sink. Further, the management device can also check whether the data updated by each data sink and the data generated in the memory database are consistent in quantity and content. If they are consistent, the synchronization is successful.
  • FIG. 4 exemplarily shows a schematic structural diagram of a data synchronization device provided by an embodiment of the present application.
  • the device can be applied to a data synchronization system.
  • the system includes a management device, multiple source databases, and at least one Data sink; the device may be a management device, as shown in Figure 4, the device includes a receiving unit 401, a processing unit 402, and a sending unit 403; among them,
  • the receiving unit 401 is configured to receive each source data sent by each source database in the current period; each source data is the full amount of data corresponding to each source database in the current period;
  • the processing unit 402 is configured to determine the first data set in the current period according to the association relationship between the source databases and the multiple data records included in each source data; if it is determined that there is an upper data set in the current period For a second data set corresponding to a period, compare the second data set with the first data set to obtain an incremental data set; the second data set is based on each source database in the previous period All source data sent within;
  • the sending unit 403 is configured to send the incremental data set to each data sink.
  • each data record includes an index value
  • the association relationship between the source databases is determined in the following manner:
  • the management device determines that the index value in the second source data is consistent with the index value corresponding to the first data record according to the index value corresponding to the first data record According to the position of the first data record in the first data source and the position of the second data record in the second data source, it is determined that the first data record and The association relationship of the second data record;
  • the first source data is any one of the source data, and the first data record is any one of the multiple data records included in the first source data data record;
  • the association relationship between the multiple data records included in each source data is determined.
  • the source databases are heterogeneous databases
  • the association relationship of each source data is an association relationship based on the structured query language SQL.
  • the sending unit 403 is specifically configured to:
  • each data sink determine each target incremental data meeting the data requirements of each data sink from the incremental data set; and send the target incremental data to the respective Data sink.
  • processing unit 402 is further configured to:
  • the first data set is sent to each data sink.
  • the processing unit 402 is further configured to:
  • the data synchronization information includes at least one of a data addition record, a data deletion record, and a data modification record; and according to the data synchronization information of each data sink, The synchronization of the data sink is monitored.
  • the processing unit 402 is further configured to:
  • the data sending status is determined according to the data sending time and/or data sending volume of each source data; and according to the data sending status of each source database, The synchronization status of each source database is monitored.
  • the embodiments of the present application also provide a device that has the function of implementing the data synchronization method described above.
  • This function can be implemented by hardware executing corresponding software.
  • the device includes: a processor, a transceiver, and a memory; the memory is used to store computer execution instructions, and the transceiver is used to implement communication between the device and other devices.
  • the entity communicates, the processor and the memory are connected through the bus, and when the device is running, the processor executes the computer execution instructions stored in the memory, so that the device executes the data synchronization method described above.
  • the embodiments of the present application also provide a computer storage medium, and the storage medium stores a software program, which, when read and executed by one or more processors, realizes the data described in the various possible implementations above Synchronization method.
  • the embodiment of the present application also provides a computer program product containing instructions, which when running on a computer, enables the computer to execute the data synchronization method described in the various possible implementation manners.
  • this application can be provided as methods, systems, or computer program products. Therefore, this application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this 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.) containing computer-usable program codes.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operating steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请部分实施例提供了一种数据同步方法及装置。所述方法包括:管理设备接收各源数据库在当前周期内发送的各源数据后,根据各源数据库之间的关联关系以及每个源数据包括的多条数据记录,进行计算,得到目标数据集合并将目标数据集合发送至各数据宿。本申请实施例中,只需要管理设备执行这一计算过程,在同步的过程进行目标数据集合的计算,使得数据宿能够直接获取目标数据集合,大大降低了整个系统的计算量,提升了数据同步的时效性。

Description

一种数据同步方法及装置 技术领域
本申请涉及数据处理技术领域,特别涉及一种数据同步方法及装置。
背景技术
数据同步一直是计算机系统之间进行交互的不可避免的问题,数据同步的时效性和准确性将直接影响计算机系统之间的交互。现有的数据同步技术,通常是先将各源数据库中的各源数据分别同步到数据宿,然后由数据宿进行计算,从而获取所需的数据。
发明人发现现有技术至少存在以下问题:这种方法对于每个数据宿而言,都需要进行这样的计算过程,过程比较复杂,比较浪费时间;基于此,目前亟需一种数据同步方法,用于解决现有技术中的数据同步过程比较复杂,耗时较长的问题。
发明内容
本申请部分实施例的目的在于提供一种数据同步方法及装置,以解决现有技术中数据同步过程比较复杂,耗时较长的技术问题。
本申请实施例提供了一种数据同步方法,所述方法应用于数据同步系统,所述系统包括管理设备、多个源数据库和至少一个数据宿;所述方法包括:
所述管理设备接收各源数据库在当前周期内发送的各源数据;所述各源 数据为所述各源数据库在所述当前周期内对应的全量数据;
所述管理设备根据所述各源数据库之间的关联关系以及每个源数据包括的多条数据记录,进行计算,得到目标数据集合;
所述管理设备将所述目标数据集合发送至各数据宿,所述数据宿用于接收数据。
如此,本申请实施例设置管理设备,通过管理设备对各源数据库的各源数据进行计算,从而在管理设备层面确定目标数据集合,进而可以将目标增量数据集合发送给各数据宿。相比于现有技术中每个数据宿都需要分别计算目标数据集合的方式而言,本申请实施例中,只需要管理设备执行这一计算过程,在同步的过程进行目标数据集合的计算,使得数据宿能够直接获取目标数据集合,大大降低了整个系统的计算量,提升了数据同步的时效性;进一步地,采用管理设备向个数据宿发送目标数据集合,能够将一份目标数据集合同时发送到多个数据宿,从而能够提升数据同步的效率。
在一种可能的实现方式中,所述管理设备根据所述各源数据库之间的关联关系以及每个源数据包括的多条数据记录,进行计算,得到目标数据集合,包括:
所述管理设备根据所述各源数据库之间的关联关系以及每个源数据包括的多条数据记录,确定所述当前周期内的第一数据集合;
所述管理设备若确定存在所述当前周期的上一周期对应的第二数据集合,则确定所述第一数据集合相较于所述第二数据集合的增量数据集合,并将所述增量数据集合作为所述目标数据集合;所述第二数据集合是根据所述各源数据库在所述上一周期内发送的各源数据得到的。
在一种可能的实现方式中,每条数据记录包括索引值;
所述各源数据库之间的关联关系通过以下方式确定:
针对第一源数据中的第一数据记录,所述管理设备根据所述第一数据记录对应的索引值,若确定第二源数据中存在索引值与所述第一数据记录对应的索引值一致的第二数据记录,则根据所述第一数据记录在所述第一数据源中的位置和所述第二数据记录在所述第二数据源中的位置,确定所述第一数据记录与所述第二数据记录的关联关系;所述第一源数据为所述各源数据中任一源数据,所述第一数据记录为所述第一源数据包括的多条数据记录中任一数据记录;
根据所述每个源数据包括的多条数据记录之间的关联关系,确定所述各源数据库之间的关联关系。
在一种可能的实现方式中,所述各源数据库之间为异构数据库,所述异构数据库为数据库之间的结构不同的数据库;
所述各源数据的关联关系为基于结构化查询语言SQL的关联关系。
如此,采用通用的SQL语言,能够降低各异构源数据计算的难度,方便各异构源数据的逻辑计算,也便于数据的维护。
在一种可能的实现方式中,所述管理设备将所述目标数据集合发送至各数据宿,包括:
所述管理设备根据所述各数据宿的数据需求,从所述目标数据集合中确定符合所述各数据宿的数据需求的各目标数据;
所述管理设备将所述各目标数据对应发送至所述各数据宿。
在一种可能的实现方式中,还包括:
所述管理设备若确定不存在所述第二数据集合,则将所述第一数据集合 作为所述目标数据集合。
在一种可能的实现方式中,所述管理设备将所述目标数据集合发送至各数据宿之后,还包括:
所述管理设备获取所述各数据宿的数据同步信息;所述数据同步信息包括数据增加记录、数据删除记录和数据修改记录中的至少一项;
所述管理设备根据所述各数据宿的数据同步信息,对所述各数据宿的同步情况进行监控。
如此,可以实时监测各数据宿的同步情况,便于管理设备统计分析。
在一种可能的实现方式中,所述管理设备接收各源数据库在当前周期内发送的源数据之后,还包括:
所述管理设备获取所述各源数据库的数据发送情况,所述数据发送情况是根据所述各源数据的数据发送耗时和/或数据发送量确定的;
所述管理设备根据所述各源数据库的数据发送情况,对所述各源数据库的同步情况进行监控。
如此,可以实时监测各源数据库的同步情况,便于管理设备统计分析。
在一种可能的实现方式中,所述管理设备将所述目标数据集合发送至各数据宿之后,还包括:
所述管理设备若确定所述目标数据集合发送失败,且发送失败的次数大于预设阈值,则向管理员发送告警消息,所述告警消息用于通知所述管理员所述目标数据集合发送失败。
如此,一旦目标数据集合多次出现发送失败的情况管理设备可以及时向管理员发送告警消息,以便管理员及时进行处理。
本申请实施例提供一种数据同步装置,所述装置应用于数据同步系统,所述系统包括管理设备、多个源数据库和至少一个数据宿;所述装置为管理设备,所述装置包括:
接收单元,用于接收各源数据库在当前周期内发送的各源数据;所述各源数据为所述各源数据库在所述当前周期内对应的全量数据;
处理单元,用于根据所述各源数据库之间的关联关系以及每个源数据包括的多条数据记录,进行计算,得到目标数据集合;
发送单元,用于将所述目标数据集合发送至各数据宿,所述数据宿用于接收数据。
在一种可能的实现方式中,所述处理单元具体用于:
根据所述各源数据库之间的关联关系以及每个源数据包括的多条数据记录,确定所述当前周期内的第一数据集合;以及若确定存在所述当前周期的上一周期对应的第二数据集合,则确定所述第一数据集合相较于所述第二数据集合的增量数据集合,并将所述增量数据集合作为所述目标数据集合;所述第二数据集合是根据所述各源数据库在所述上一周期内发送的各源数据得到的。
在一种可能的实现方式中,每条数据记录包括索引值;
所述各源数据库之间的关联关系通过以下方式确定:
针对第一源数据中的第一数据记录,所述管理设备根据所述第一数据记录对应的索引值,若确定第二源数据中存在索引值与所述第一数据记录对应的索引值一致的第二数据记录,则根据所述第一数据记录在所述第一数据源中的位置和所述第二数据记录在所述第二数据源中的位置,确定所述第一数据记录与所述第二数据记录的关联关系;所述第一源数据为所述各源数据中任一源数 据,所述第一数据记录为所述第一源数据包括的多条数据记录中任一数据记录;
根据所述每个源数据包括的多条数据记录之间的关联关系,确定所述各源数据库之间的关联关系。
在一种可能的实现方式中,所述各源数据库之间为异构数据库,所述异构数据库为数据库之间的结构不同的数据库;
所述各源数据的关联关系为基于结构化查询语言SQL的关联关系。
在一种可能的实现方式中,所述发送单元具体用于:
根据所述各数据宿的数据需求,从所述目标数据集合中确定符合所述各数据宿的数据需求的各目标数据;以及将所述各目标数据对应发送至所述各数据宿。
在一种可能的实现方式中,所述处理单元还用于:
若确定不存在所述第二数据集合,则将所述第一数据集合作为所述目标数据集合。
在一种可能的实现方式中,所述发送单元将所述增量数据集合发送至各数据宿之后,所述处理单元还用于:
获取所述各数据宿的数据同步信息;所述数据同步信息包括数据增加记录、数据删除记录和数据修改记录中的至少一项;以及根据所述各数据宿的数据同步信息,对所述各数据宿的同步情况进行监控。
在一种可能的实现方式中,所述接收单元接收各源数据库在当前周期内发送的源数据之后,所述处理单元还用于:
获取所述各源数据库的数据发送情况,所述数据发送情况是根据所述各源数据的数据发送耗时和/或数据发送量确定的;以及根据所述各源数据库的数 据发送情况,对所述各源数据库的同步情况进行监控。
在一种可能的实现方式中,所述发送单元将所述目标数据集合发送至各数据宿之后,所述处理单元还用于:
若确定所述目标数据集合发送失败,且发送失败的次数大于预设阈值,则向管理员发送告警消息,所述告警消息用于通知所述管理员所述目标数据集合发送失败。
本申请实施例的还提供一种装置,该装置具有实现上文所描述的数据同步方法的功能。该功能可以通过硬件执行相应的软件实现,在一种可能的设计中,该装置包括:处理器、收发器、存储器;该存储器用于存储计算机执行指令,该收发器用于实现该装置与其他通信实体进行通信,该处理器与该存储器通过该总线连接,当该装置运行时,该处理器执行该存储器存储的该计算机执行指令,以使该装置执行上文所描述的数据同步方法。
本申请实施例还提供一种计算机存储介质,所述存储介质中存储软件程序,该软件程序在被一个或多个处理器读取并执行时实现上述各种可能的实现方式中所描述的数据同步方法。
本申请实施例还提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述各种可能的实现方式中所描述的数据同步方法。
附图说明
一个或多个实施例通过与之对应的附图中的图片进行示例性说明,这些示例性说明并不构成对实施例的限定。
图1是根据本申请实施例中的系统架构图;
图2是根据本申请实施例中的一种数据同步方法所对应的流程示意图;
图3是根据本申请实施例中的整体性的流程示意图;
图4是根据本申请实施例中的一种数据同步装置的结构示意图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请部分实施例进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
图1示例性示出了本申请实施例适用的系统架构图。如图1所示,所述系统100包括管理设备101、多个源数据库(例如图1中示出的源数据库1021、源数据库1022和源数据库1023)以及至少一个数据宿(例如图1中示出的数据宿1031、数据宿1032和数据宿1033)。其中,管理设备101与任一源数据库可以通过网络连接,例如,管理设备101可以通过网络与源数据库1021、源数据库1022和源数据库1023中任一源数据库连接;管理设备101与任一数据宿可以通过网络连接,例如,管理设备101可以通过网络与数据宿1031、数据宿1032和数据宿1033中任一数据宿连接。
基于图1所示的系统架构,图2示例性示出了本申请实施例提供的一种数据同步方法所对应的流程示意图,具体包括如下步骤:
步骤201,管理设备接收各源数据库在当前周期内发送的各源数据。
步骤202,管理设备根据各源数据库之间的关联关系以及每个源数据包括的多条数据记录,进行计算,得到目标数据集合。
步骤203,管理设备将目标数据集合发送至各数据宿,所述数据宿用于 接收数据。
如此,本申请实施例设置管理设备,通过管理设备对各源数据库的各源数据进行计算,从而在管理设备层面确定目标数据集合,进而可以将目标数据集合发送给各数据宿。相比于现有技术中每个数据宿都需要分别计算目标数据集合的方式而言,本申请实施例中,只需要管理设备执行这一计算过程,在同步的过程进行目标数据集合的计算,使得数据宿能够直接获取目标数据集合,大大降低了整个系统的计算量,提升了数据同步的时效性;进一步地,采用管理设备向个数据宿发送目标数据集合,能够将一份目标数据集合同时发送到多个数据宿,从而能够提升数据同步的效率。
具体来说,步骤201中,各源数据可以为各源数据库在当前周期内对应的全量数据。举个例子,如表1所示,为各源数据的一种示例。其中,源数据库A对应的源数据为源数据库A在当前周期内对应的全量数据A,源数据库B对应的源数据为源数据库B在当前周期内对应的全量数据B,源数据库C对应的源数据为源数据库C在当前周期内对应的全量数据C。
表1:各源数据的一种示例
源数据库 源数据
源数据库A 全量数据A
源数据库B 全量数据B
源数据库C 全量数据C
进一步地,每个源数据可以包括多条数据记录。如表2所示,为源数据的一种示例。其中,源数据库A在当前周期内对应的全量数据A包括数据记录A1、数据记录A2和数据记录A3;源数据库B在当前周期内对应的全量数据B 包括数据记录B1、数据记录B2和数据记录B3;源数据库C在当前周期内对应的全量数据C包括数据记录C1、数据记录C2和数据记录C3。
表2:源数据的一种示例
Figure PCTCN2019077238-appb-000001
举个例子,如表3a所示,为源数据库A在当前周期内发送的各源数据的一种示例。如表3b所示,为源数据库B在当前周期内发送的各源数据的一种示例。根据表3a和表3b示出的内容可知,源数据库A在当前周期内发送的源数据(即源数据库A在当前周期内对应的全量数据)中包括:数据记录A1,张三语文分数为80分;数据记录A2,李四数学分数90分;数据记录A3,赵五外语分数为100分。源数据库B在当前周期内发送的源数据(即源数据库B在当前周期内对应的全量数据)中包括:数据记录B1,张三语文指导老师为王老师;数据记录B2,李四数学指导老师为钱老师;数据记录B3,赵五外语指导老师为孙老师。
表3a:源数据库A在当前周期内发送的源数据的一种示例
Figure PCTCN2019077238-appb-000002
表3b:源数据库B在当前周期内发送的源数据的一种示例
Figure PCTCN2019077238-appb-000003
更进一步地,每条数据记录可以包括索引值。以表3a示出的内容为例,姓名对应的内容可以为每条数据记录的索引值,即,数据记录A1的索引值为“张三”,数据记录A2的索引值为“李四”,数据记录A3的索引值为“赵五”。类似地,表3b中,数据记录B1的索引值也为“张三”,数据记录B2的索引值也为“李四”,数据记录B3的索引值也为“赵五”。
进一步地,在执行步骤201之后,管理设备还可以获取各源数据库的数据发送情况,进而可以根据各源数据库的数据发送情况,对各源数据库的同步情况进行监控。其中,数据发送情况可以是根据述各源数据的数据发送耗时和/或数据发送量确定的。如此,可以实时监测各源数据库的同步情况,便于管理设备统计分析。
步骤202中,根据各源数据库在当前周期内发送的各源数据,可以确定各源数据库之间的关联关系。具体地,针对第一源数据中的第一数据记录,管理设备可以根据一数据记录对应的索引值,若确定第二源数据中存在索引值与第一数据记录对应的索引值一致的第二数据记录,则根据第一数据记录在第一数据源中的位置和第二数据记录在第二数据源中的位置,确定第一数据记录与第二数据记录的关联关系;其中,第一源数据为各源数据中任一源数据,第一数据记录为第一源数据包括的多条数据记录中任一数据记录。进而,管理设备可以根据每个源数据包括的多条数据记录之间的关联关系,确定各源数据库之间的关联关系。
以表3a和表3b示出的内容为例,针对源数据库A发送的源数据中的数据记录A1,该数据记录A1的索引值为“张三”,并且在源数据库B发送的源数据中可以确定存在数据记录B1,该数据记录B1的索引值也为“张三”,进而,可以确定数据记录A1和数据记录B1之间存在关联关系,且这一关联关系可以根据数据记录A1在源数据库A发送的源数据中的位置(即第一行)和数据记录B1在源数据库B发送的源数据中的位置(即第一行)来确定,即,源数据库A发送的源数据中第一行的数据记录A1与源数据库B发送的源数据中第一行的数据记录B1存在关联关系。类似地,可以确定源数据库A发送的源数据中第二行的数据记录A2与源数据库B发送的源数据中第二行的数据记录B2存在关联关系,源数据库A发送的源数据中第三行的数据记录A3与源数据库B发送的源数据中第三行的数据记录B3存在关联关系。
进而,根据数据记录A1、数据记录A2和数据记录A3与数据记录B1、数据记录B2和数据记录B3之前关联关系,可以确定源数据库A和源数据库B 之间的关联关系,即源数据库A的第一行与源数据库B第一行关联,源数据库A的第二行与源数据库B第二行关联,源数据库A的第三年行与源数据库B第三行关联。
本申请实施例中,管理设备可以根据各源数据库之间的关联关系以及每个源数据包括的多条数据记录,进行计算,可以得到目标数据集合。
具体地,管理设备可以根据所述各源数据库之间的关联关系以及每个源数据包括的多条数据记录,确定当前周期内的第一数据集合。其中,第一数据集合可以是指各源数据库发送的各源数据的集合。以表3a和表3b示出的内容为例,根据上述所描述的源数据库A和源数据库B之间的关联关系以及表3a和表3b中包括的各数据记录,可以得到如表4所示的第一数据集合的一种示例。
表4:第一数据集合的一种示例
Figure PCTCN2019077238-appb-000004
需要说明的是,上文所举的例子中,各源数据库之间可以为同构数据库。在其它可能的示例中,各源数据库之间也可以为异构数据库,异构数据库为数据库之间的结构不同的数据库。进而,各源数据的关联关系为基于结构化查询语言SQL的关联关系。具体来说,可以分析各异构源数据库,映射成对应的数据表,并对各个异构源数据的关系进行分析,输出符合要求的SQL语句。如此, 采用通用的SQL语言,能够降低各异构源数据计算的难度,方便各异构源数据的逻辑计算,也便于数据的维护。
进一步地,管理设备首先可以判断是否存在当前周期的上一周期对应的第二数据集合,若存在,则可以确定第一数据集合相较于第二数据集合的增量数据集合,并将增量数据集合作为目标数据集合;若不存在,则可以将第一数据集合作为目标数据集合。其中,第二数据集合可以是根据各源数据库在上一周期内发送的各源数据得到的,具体的获得方式与第一数据集合的获得方式类型,此处不再详细描述。
本申请实施例中,只需要管理设备在同步的过程进行增量数据集合的计算,使得数据宿能够直接获取增量数据集合,大大降低了整个系统的计算量,提升了数据同步的时效性;进一步地,采用管理设备向个数据宿发送增量数据集合,能够将一份增量数据集合同时发送到多个数据宿,从而能够提升数据同步的效率。
举个例子,如5所示,为第二数据集合的一种示例。其中,第二数据集合中的第1条数据记录为,张三语文分数为80分,指导老师为王老师;李四数学分数为90分,指导老师为钱老师。
表5:第二数据集合的一种示例
Figure PCTCN2019077238-appb-000005
进一步地,根据表4和表5示出的内容,可以得到如表6所示的增量数 据集合的一种示例即可以确定增量数据集合为:赵五外语100分,指导老师为孙老师。
表6:增量数据集合的一种示例
Figure PCTCN2019077238-appb-000006
步骤203中,管理设备可以直接将目标数据集合发送至各数据宿,其中,数据宿可以用于接收数据。
进一步地,管理设备也可以根据各数据宿的数据需求,从目标数据集合中确定符合各数据宿的数据需求的各目标数据,进而可以将各目标数据对应发送至各数据宿。举个例子,以表6示出的增量数据集合为例,若数据宿A的数据需求为需要科目和分数,则可以确定数据宿A对应的目标数据为:赵五外语分数为100分;若数据宿B的数据需求为需要科目和指导老师,则可以确定数据宿B对应的目标数据为:赵五外语指导老师为孙老师。
在执行步骤203之后,管理设备可以获取各数据宿的数据同步信息,进而可以根据各数据宿的数据同步信息,对各数据宿的同步情况进行监控。其中,数据同步信息可以包括数据增加记录、数据删除记录和数据修改记录中的至少一项。如此,可以实时监测目标数据集合写入到各数据宿的过程,监控各数据宿的同步情况,比如监控数据增加记录、数据删除记录和数据修改记录等,便于管理设备统计分析;进而,本申请实施例中,通过管理设备监测数据同步过程,使得整个数据同步过程对于管理员而言是透明化的,从而便于管理员实时掌控数据ton公布情况。
进一步地,在执行步骤203之后,管理设备若确定目标数据集合发送失败,且发送失败的次数大于预设阈值,则向管理员发送告警消息,其中,告警消息用于通知管理员目标数据集合发送失败。如此,一旦目标数据集合多次出现发送失败的情况管理设备可以及时向管理员发送告警消息,以便管理员及时进行处理。
为了更清楚地介绍上述数据同步方法,下面结合图3,对本申请实施例中所涉及到的流程进行整体性说明。如图3所示,可以包括以下步骤:
步骤301,各源数据库在当前周期内向管理设备发送各源数据。
步骤302,管理设备判断各源数据是否全部发送完成,若未全部发送完成,则执行步骤303;否则,执行步骤305。
步骤303,管理设备判断各源数据的数据发送耗时是否大于预设阈值,若大于,则执行步骤304;否则,返回步骤302。
步骤304,管理设备尝试重新接收数据发送耗时大于预设阈值的源数据。
步骤305,管理设备根据各源数据库之间的关联关系以及每个源数据包括的多条数据记录,确定当前周期内的第一数据集合。
步骤306,管理设备判断是否存在当前周期的上一周期对应的第二数据集合,若存在,执行步骤307;否则,执行步骤310。
步骤307,管理设备确定第一数据集合相较于第二数据集合的增量数据集合,并将增量数据集合作为目标数据集合。
步骤308,管理设备根据各数据宿的数据需求,从目标数据集合中确定符合所述各数据宿的数据需求的各目标数据。
步骤309,管理设备将各目标数据对应发送至各数据宿。
步骤310,管理设备将第一数据集合作为所述目标数据集合,并根据各数据宿的数据需求,从目标数据集合中确定符合所述各数据宿的数据需求的各目标数据。
步骤311,管理设备将各目标数据发送至各数据宿。
针对上述步骤301至步骤311所描述的内容,下面以异构源数据库为例,进行举例说明。首先,管理设备可以分析各异构源数据库,映射成对应的源数据表,并对各个异构源数据的关系进行分析,输出符合要求的SQL语句;然后,管理设备可以选择一种稳定的内存数据库方案(例如h2),根据异构源数据对应的源数据表,创建内存数据库;再然后,管理设备可以执行定时任务,将各个异构源数据分别同步到内存数据库中;进而,管理设备可以检查各个异构源数据是否已全部同步到内存数据库相应表中,如果全部同步,则开始计算,具体地,根据上文输出的SQL语句,在内存数据库中执行查询,生成当前周期的全量数据,然后判断是否存在上一周期对应的全量数据,如果不存在,则可以直接推送当前周期的全量数据到各数据宿中;如果存在,则可以将当前周期的全量数据与上一周期的全量数据做比较,生成增量数据集合,并将增量数据集合推送到各数据宿中。进一步地,管理设备还可以检查各数据宿更新的数据于内存数据库中生成的数据在数量和内容上是否一致,如果一致,则表明同步成功。
基于同样的发明构思,图4示例性示出了本申请实施例提供的一种数据同步装置的结构示意图,该装置可以应用于数据同步系统,该系统包括管理设备、多个源数据库和至少一个数据宿;该装置可以为管理设备,如图4所示,该装置包括接收单元401、处理单元402、发送单元403;其中,
接收单元401,用于接收各源数据库在当前周期内发送的各源数据;所述各源数据为所述各源数据库在所述当前周期内对应的全量数据;
处理单元402,用于根据所述各源数据库之间的关联关系以及每个源数据包括的多条数据记录,确定所述当前周期内的第一数据集合;若确定存在所述当前周期的上一周期对应的第二数据集合,则比较所述第二数据集合和所述第一数据集合,得到增量数据集合;所述第二数据集合是根据所述各源数据库在所述上一周期内发送的各源数据得到的;
发送单元403,用于将所述增量数据集合发送至各数据宿。
在一种可能的实现方式中,每条数据记录包括索引值;
所述各源数据库之间的关联关系通过以下方式确定:
针对第一源数据中的第一数据记录,所述管理设备根据所述第一数据记录对应的索引值,若确定第二源数据中存在索引值与所述第一数据记录对应的索引值一致的第二数据记录,则根据所述第一数据记录在所述第一数据源中的位置和所述第二数据记录在所述第二数据源中的位置,确定所述第一数据记录与所述第二数据记录的关联关系;所述第一源数据为所述各源数据中任一源数据,所述第一数据记录为所述第一源数据包括的多条数据记录中任一数据记录;
根据所述每个源数据包括的多条数据记录之间的关联关系,确定所述各源数据库之间的关联关系。
在一种可能的实现方式中,所述各源数据库之间为异构数据库;
所述各源数据的关联关系为基于结构化查询语言SQL的关联关系。
在一种可能的实现方式中,所述发送单元403具体用于:
根据所述各数据宿的数据需求,从所述增量数据集合中确定符合所述各 数据宿的数据需求的各目标增量数据;以及将所述各目标增量数据对应发送至所述各数据宿。
在一种可能的实现方式中,所述处理单元402还用于:
若确定不存在所述第二数据集合,则将所述第一数据集合发送至各数据宿。
在一种可能的实现方式中,所述发送单元403将所述增量数据集合发送至各数据宿之后,所述处理单元402还用于:
获取所述各数据宿的数据同步信息;所述数据同步信息包括数据增加记录、数据删除记录和数据修改记录中的至少一项;以及根据所述各数据宿的数据同步信息,对所述各数据宿的同步情况进行监控。
在一种可能的实现方式中,所述接收单元401接收各源数据库在当前周期内发送的源数据之后,所述处理单元402还用于:
获取所述各源数据库的数据发送情况,所述数据发送情况是根据所述各源数据的数据发送耗时和/或数据发送量确定的;以及根据所述各源数据库的数据发送情况,对所述各源数据库的同步情况进行监控。
本申请实施例的还提供一种装置,该装置具有实现上文所描述的数据同步方法的功能。该功能可以通过硬件执行相应的软件实现,在一种可能的设计中,该装置包括:处理器、收发器、存储器;该存储器用于存储计算机执行指令,该收发器用于实现该装置与其他通信实体进行通信,该处理器与该存储器通过该总线连接,当该装置运行时,该处理器执行该存储器存储的该计算机执行指令,以使该装置执行上文所描述的数据同步方法。
本申请实施例还提供一种计算机存储介质,所述存储介质中存储软件程 序,该软件程序在被一个或多个处理器读取并执行时实现上述各种可能的实现方式中所描述的数据同步方法。
本申请实施例还提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述各种可能的实现方式中所描述的数据同步方法。
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处 理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本申请的多个实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括多个实施例以及落入本申请范围的所有变更和修改。
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。

Claims (20)

  1. 一种数据同步方法,其中,所述方法应用于数据同步系统,所述系统包括管理设备、多个源数据库和至少一个数据宿;所述方法包括:
    所述管理设备接收各源数据库在当前周期内发送的各源数据;所述各源数据为所述各源数据库在所述当前周期内对应的全量数据;
    所述管理设备根据所述各源数据库之间的关联关系以及每个源数据包括的多条数据记录,进行计算,得到目标数据集合;
    所述管理设备将所述目标数据集合发送至各数据宿,所述数据宿用于接收数据。
  2. 根据权利要求1所述的方法,其中,所述管理设备根据所述各源数据库之间的关联关系以及每个源数据包括的多条数据记录,进行计算,得到目标数据集合,包括:
    所述管理设备根据所述各源数据库之间的关联关系以及每个源数据包括的多条数据记录,确定所述当前周期内的第一数据集合;
    所述管理设备若确定存在所述当前周期的上一周期对应的第二数据集合,则确定所述第一数据集合相较于所述第二数据集合的增量数据集合,并将所述增量数据集合作为所述目标数据集合;所述第二数据集合是根据所述各源数据库在所述上一周期内发送的各源数据得到的。
  3. 根据权利要求1所述的方法,其中,每条数据记录包括索引值;
    所述各源数据库之间的关联关系通过以下方式确定:
    针对第一源数据中的第一数据记录,所述管理设备根据所述第一数据记录对应的索引值,若确定第二源数据中存在索引值与所述第一数据记录对应的索 引值一致的第二数据记录,则根据所述第一数据记录在所述第一数据源中的位置和所述第二数据记录在所述第二数据源中的位置,确定所述第一数据记录与所述第二数据记录的关联关系;所述第一源数据为所述各源数据中任一源数据,所述第一数据记录为所述第一源数据包括的多条数据记录中任一数据记录;
    根据所述每个源数据包括的多条数据记录之间的关联关系,确定所述各源数据库之间的关联关系。
  4. 根据权利要求2所述的方法,其中,所述各源数据库之间为异构数据库,所述异构数据库为数据库之间的结构不同的数据库;
    所述各源数据的关联关系为基于结构化查询语言SQL的关联关系。
  5. 根据权利要求2所述的方法,其中,所述管理设备将所述目标数据集合发送至各数据宿,包括:
    所述管理设备根据所述各数据宿的数据需求,从所述目标数据集合中确定符合所述各数据宿的数据需求的各目标数据;
    所述管理设备将所述各目标数据对应发送至所述各数据宿。
  6. 根据权利要求2所述的方法,其中,还包括:
    所述管理设备若确定不存在所述第二数据集合,则将所述第一数据集合作为所述目标数据集合。
  7. 根据权利要求1至6中任一项所述的方法,其中,所述管理设备将所述目标数据集合发送至各数据宿之后,还包括:
    所述管理设备获取所述各数据宿的数据同步信息;所述数据同步信息包括数据增加记录、数据删除记录和数据修改记录中的至少一项;
    所述管理设备根据所述各数据宿的数据同步信息,对所述各数据宿的同步 情况进行监控。
  8. 根据权利要求1至6中任一项所述的方法,其中,所述管理设备接收各源数据库在当前周期内发送的源数据之后,还包括:
    所述管理设备获取所述各源数据库的数据发送情况,所述数据发送情况是根据所述各源数据的数据发送耗时和/或数据发送量确定的;
    所述管理设备根据所述各源数据库的数据发送情况,对所述各源数据库的同步情况进行监控。
  9. 根据权利要求1至6中任一项所述的方法,其中,所述管理设备将所述目标数据集合发送至各数据宿之后,还包括:
    所述管理设备若确定所述目标数据集合发送失败,且发送失败的次数大于预设阈值,则向管理员发送告警消息,所述告警消息用于通知所述管理员所述目标数据集合发送失败。
  10. 一种数据同步装置,其中,所述装置应用于数据同步系统,所述系统包括管理设备、多个源数据库和至少一个数据宿;所述装置为管理设备,所述装置包括:
    接收单元,用于接收各源数据库在当前周期内发送的各源数据;所述各源数据为所述各源数据库在所述当前周期内对应的全量数据;
    处理单元,用于根据所述各源数据库之间的关联关系以及每个源数据包括的多条数据记录,进行计算,得到目标数据集合;
    发送单元,用于将所述目标集合发送至各数据宿,所述数据宿用于接收数据。
  11. 根据权利要求10所述的装置,其中,所述处理单元具体用于:
    根据所述各源数据库之间的关联关系以及每个源数据包括的多条数据记录,确定所述当前周期内的第一数据集合;以及若确定存在所述当前周期的上一周期对应的第二数据集合,则确定所述第一数据集合相较于所述第二数据集合的增量数据集合,并将所述增量数据集合作为所述目标数据集合;所述第二数据集合是根据所述各源数据库在所述上一周期内发送的各源数据得到的。
  12. 根据权利要求10所述的装置,其中,每条数据记录包括索引值;
    所述各源数据库之间的关联关系通过以下方式确定:
    针对第一源数据中的第一数据记录,所述管理设备根据所述第一数据记录对应的索引值,若确定第二源数据中存在索引值与所述第一数据记录对应的索引值一致的第二数据记录,则根据所述第一数据记录在所述第一数据源中的位置和所述第二数据记录在所述第二数据源中的位置,确定所述第一数据记录与所述第二数据记录的关联关系;所述第一源数据为所述各源数据中任一源数据,所述第一数据记录为所述第一源数据包括的多条数据记录中任一数据记录;
    根据所述每个源数据包括的多条数据记录之间的关联关系,确定所述各源数据库之间的关联关系。
  13. 根据权利要求11所述的装置,其中,所述各源数据库之间为异构数据库,所述异构数据库为数据库之间的结构不同的数据库;
    所述各源数据的关联关系为基于结构化查询语言SQL的关联关系。
  14. 根据权利要求11所述的装置,其中,所述发送单元具体用于:
    根据所述各数据宿的数据需求,从所述目标数据集合中确定符合所述各数据宿的数据需求的各目标数据;以及将所述各目标数据对应发送至所述各数据宿。
  15. 根据权利要求11所述的装置,其中,所述处理单元还用于:
    若确定不存在所述第二数据集合,则将所述第一数据集合作为所述目标数据集合。
  16. 根据权利要求10至15中任一项所述的装置,其中,所述发送单元将所述目标数据集合发送至各数据宿之后,所述处理单元还用于:
    获取所述各数据宿的数据同步信息;所述数据同步信息包括数据增加记录、数据删除记录和数据修改记录中的至少一项;以及根据所述各数据宿的数据同步信息,对所述各数据宿的同步情况进行监控。
  17. 根据权利要求10至15中任一项所述的装置,其中,所述接收单元接收各源数据库在当前周期内发送的源数据之后,所述处理单元还用于:
    获取所述各源数据库的数据发送情况,所述数据发送情况是根据所述各源数据的数据发送耗时和/或数据发送量确定的;以及根据所述各源数据库的数据发送情况,对所述各源数据库的同步情况进行监控。
  18. 根据权利要求10至15中任一项所述的装置,其中,所述发送单元将所述目标数据集合发送至各数据宿之后,所述处理单元还用于:
    若确定所述目标数据集合发送失败,且发送失败的次数大于预设阈值,则向管理员发送告警消息,所述告警消息用于通知所述管理员所述目标数据集合发送失败。
  19. 一种计算机可读存储介质,其中,所述存储介质存储有指令,当所述指令在计算机上运行时,使得计算机实现执行权利要求1至9中任一项所述的方法。
  20. 一种计算机设备,其中,包括:
    存储器,用于存储程序指令;
    处理器,用于调用所述存储器中存储的程序指令,按照获得的程序执行如权利要求1至9中任一权利要求所述的方法。
PCT/CN2019/077238 2019-01-25 2019-03-06 一种数据同步方法及装置 WO2020151054A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP19772639.1A EP3716094A4 (en) 2019-01-25 2019-03-06 DATA SYNCHRONIZATION PROCESS AND APPARATUS
US16/588,798 US20200242131A1 (en) 2019-01-25 2019-09-30 Method and device for synchronizing data

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910071849.0A CN109829016B (zh) 2019-01-25 2019-01-25 一种数据同步方法及装置
CN201910071849.0 2019-01-25

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/588,798 Continuation US20200242131A1 (en) 2019-01-25 2019-09-30 Method and device for synchronizing data

Publications (1)

Publication Number Publication Date
WO2020151054A1 true WO2020151054A1 (zh) 2020-07-30

Family

ID=66862392

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/077238 WO2020151054A1 (zh) 2019-01-25 2019-03-06 一种数据同步方法及装置

Country Status (3)

Country Link
EP (1) EP3716094A4 (zh)
CN (1) CN109829016B (zh)
WO (1) WO2020151054A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110909075B (zh) * 2019-10-30 2022-08-09 北京达佳互联信息技术有限公司 数据的同步方法、装置、电子设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101102577A (zh) * 2006-07-07 2008-01-09 中兴通讯股份有限公司 无线通信基站系统前后台数据库表数据增量同步方法
CN104317921A (zh) * 2014-10-29 2015-01-28 北京思特奇信息技术股份有限公司 一种跨数据库数据同步系统及方法
CN104598531A (zh) * 2014-12-25 2015-05-06 广东电子工业研究院有限公司 一种基于触发器的异构关系型数据库间增量数据迁移方法
CN104778175A (zh) * 2014-01-13 2015-07-15 世纪禾光科技发展(北京)有限公司 一种实现异构数据库数据同步的方法及系统

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101369878B (zh) * 2007-08-14 2012-04-18 电信科学技术研究院 时分双工系统中同步混合自动重传请求方法和装置
CN103186624B (zh) * 2011-12-31 2017-10-20 亿阳信通股份有限公司 一种数据同步方法和数据同步装置
CN103729204B (zh) * 2012-10-16 2017-11-24 阿里巴巴集团控股有限公司 一种网络平台中应用更新的数据在线迁移方法和装置
CN102902812B (zh) * 2012-10-22 2015-05-27 飞天诚信科技股份有限公司 一种数据库远程同步的实现方法
CN105450720B (zh) * 2014-09-30 2020-12-15 阿里巴巴(中国)有限公司 一种gps数据采集及传输方法和装置
CN104573100B (zh) * 2015-01-29 2017-11-14 无锡江南计算技术研究所 一种带自增量标识的分布式数据库同步方法
CN105554114B (zh) * 2015-12-17 2018-11-02 深圳市从晶科技有限公司 一种数据同步方法及数据同步固件平台
CN106649632B (zh) * 2016-12-07 2018-03-16 北京众享比特科技有限公司 数据同步方法及系统
CN108205560B (zh) * 2016-12-19 2021-12-14 腾讯科技(深圳)有限公司 一种数据同步方法以及装置
CN107657002A (zh) * 2017-09-20 2018-02-02 北京九桥同步软件有限公司 文件同步方法及装置
CN109033391B (zh) * 2018-07-31 2019-12-31 北京嘀嘀无限科技发展有限公司 一种多数据中心之间数据同步方法、系统及计算机可读存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101102577A (zh) * 2006-07-07 2008-01-09 中兴通讯股份有限公司 无线通信基站系统前后台数据库表数据增量同步方法
CN104778175A (zh) * 2014-01-13 2015-07-15 世纪禾光科技发展(北京)有限公司 一种实现异构数据库数据同步的方法及系统
CN104317921A (zh) * 2014-10-29 2015-01-28 北京思特奇信息技术股份有限公司 一种跨数据库数据同步系统及方法
CN104598531A (zh) * 2014-12-25 2015-05-06 广东电子工业研究院有限公司 一种基于触发器的异构关系型数据库间增量数据迁移方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3716094A4 *

Also Published As

Publication number Publication date
EP3716094A1 (en) 2020-09-30
CN109829016A (zh) 2019-05-31
CN109829016B (zh) 2021-06-01
EP3716094A4 (en) 2020-09-30

Similar Documents

Publication Publication Date Title
US10644932B2 (en) Variable duration windows on continuous data streams
Morton et al. Estimating the progress of MapReduce pipelines
JP6865219B2 (ja) 連続クエリ処理におけるイベントバッチ処理、出力シーケンス化、およびログベースの状態記憶
CN103620601B (zh) 在映射缩减过程中汇合表
TWI503679B (zh) Data partitioning method and device
CN109656963B (zh) 元数据获取方法、装置、设备及计算机可读存储介质
WO2020238130A1 (zh) 一种大数据日志监控方法及装置、存储介质和计算机设备
US10002142B2 (en) Method and apparatus for generating schema of non-relational database
CN108573029B (zh) 一种获取网络访问关系数据的方法、装置及存储介质
WO2023202497A1 (zh) 用于全链路追踪事务的方法及原生分布式数据库
US11132363B2 (en) Distributed computing framework and distributed computing method
CN110704484A (zh) 一种对海量实时数据流进行处理的方法及系统
US20190006042A1 (en) A medical data management method, apparatus and medical data system
CN112364107A (zh) 系统分析可视化方法、装置、电子设备及计算机可读存储介质
US20190197162A1 (en) Cardinality estimation in databases
US20210303575A1 (en) Offloading statistics collection
WO2022237506A1 (zh) 在线问诊业务监控方法、装置、设备及存储介质
WO2015196885A1 (zh) 云计算系统的性能数据的采集与存储方法及装置
WO2020151054A1 (zh) 一种数据同步方法及装置
WO2016188283A1 (zh) 重复数据识别方法和装置
CN109947828A (zh) 一种处理报表数据的方法和装置
US11636113B2 (en) Method for performing multi-caching on data sources of same type and different types by using cluster-based processing system and device using the same
CN114398345A (zh) 数据迁移方法、装置、计算机设备及存储介质
CN111241086A (zh) 一种基于医疗大数据的数据质量改进方法及系统
CN110019518B (zh) 数据处理方法及设备

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2019772639

Country of ref document: EP

Effective date: 20190930

NENP Non-entry into the national phase

Ref country code: DE