Distributed resource synchronization method, system and device
By obtaining the meta-model of heterogeneous database systems and using data change capture technology, the problem of low data synchronization efficiency in distributed database systems is solved, fast and real-time data synchronization between heterogeneous database systems is achieved, and the reliability of the system is improved. performance and usability.
Patent Information
- Application Number
- CN202410853355.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2044-06-28
AI Technical Summary
Data synchronization between different nodes in a distributed database system has problems such as high communication overhead and difficulty in incremental data synchronization, which results in low system efficiency when synchronizing multi-source heterogeneous data.
By obtaining the meta-model of heterogeneous database systems, using the WebSocket interface to establish connections, using data change capture technology for full and incremental data synchronization, and using task middleware to control synchronization tasks, data resource synchronization between heterogeneous database systems is achieved.
The synchronization of metamodel and multi-source heterogeneous data is quickly completed, which solves the problem of difficulty in parsing distributed multi-source heterogeneous data after serialization and difficulty in synchronizing data increments, and improves the efficiency and consistency of data synchronization.
Smart Images

Figure CN118445364B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of resource synchronization, and relates to a distributed resource synchronization method, system and equipment. Background Art
[0002] Resources are often distributed in different locations and even stored in different databases. These data may be relational data, non-relational data, or even time series data. Distributed databases have emerged with the development of network technology. They disperse data across different physical nodes, but logically belong to an integrated database system.
[0003] The main features of distributed resources are as follows: Physically, the storage is decentralized. Data is not stored in a single node, but in multiple nodes. Logically, it is a unified whole. Although the data is distributed in storage, they are often closely connected through synchronization, and reliability is guaranteed by redundancy, forming a logical whole. The nodes are highly autonomous. Since each node is installed with an independent database management system (DBMS), it can independently complete the task of operation and management. The data is redundant. By increasing redundancy, a mode such as read-write separation can be implemented to improve performance. When some machines fail, other nodes can still provide services to the outside world, thereby ensuring the reliability and availability of the system.
[0004] In order to ensure the correctness and consistency of data in each system, these distributed resources often need to communicate with each other, that is, data needs to be synchronized from one or more databases to another. At this time, a new problem arises: distributed databases need to coordinate various nodes, use different synchronization methods, and the communication overhead of the system is different. Therefore, it is necessary to study how to quickly and securely establish connections between databases, and whether data can be synchronized in real time after the connection is established, so as to achieve fast and real-time synchronization of multi-source heterogeneous data. Summary of the invention
[0005] In view of the problems existing in the above-mentioned traditional methods, the present invention proposes a distributed resource synchronization method, a distributed resource synchronization system and a computer device, which can quickly complete the synchronization of resources such as meta-models and multi-source heterogeneous data.
[0006] In order to achieve the above objectives, the embodiments of the present invention adopt the following technical solutions:
[0007] On the one hand, a distributed resource synchronization method is provided, comprising the steps of:
[0008] Obtain the metamodels that need to be synchronized to each distributed heterogeneous database system; the metamodels include the cleansing fusion metamodel and the cataloging metamodel;
[0009] After establishing connections with each heterogeneous database system through the WebSocket interface, the metamodel is sent to each heterogeneous database system through initialization to complete the metamodel synchronization of each heterogeneous database system;
[0010] The task middleware is used to control the start or stop of data synchronization tasks between heterogeneous database systems, and data change capture technology is used to perform data resource synchronization between heterogeneous database systems; data resource synchronization includes full data synchronization and incremental data synchronization.
[0011] On the other hand, a distributed resource synchronization system is also provided, including a resource configuration management subsystem and distributed heterogeneous database systems;
[0012] After the resource configuration management subsystem obtains the metamodels that need to be synchronized to each distributed heterogeneous database system, it establishes connections with each heterogeneous database system through the WebSocket interface. The resource configuration management subsystem sends the metamodels to each heterogeneous database system through initialization to complete the metamodel synchronization of each heterogeneous database system. The metamodels include the cleaning and fusion metamodel and the cataloging metamodel.
[0013] The resource configuration management subsystem controls the start or stop of data synchronization tasks between heterogeneous database systems through task middleware, and uses data change capture technology to perform data resource synchronization between heterogeneous database systems; data resource synchronization includes full data synchronization and incremental data synchronization.
[0014] On the other hand, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned distributed resource synchronization method when executing the computer program.
[0015] One of the above technical solutions has the following advantages and beneficial effects:
[0016] The above-mentioned distributed resource synchronization method, system and device, based on in-depth research and analysis of distributed multi-source heterogeneous resources, divides resources into two types of resources that need to be synchronized, namely metamodels and data. Based on this, after obtaining the metamodels that need to be synchronized to each heterogeneous database system, the resource configuration management subsystem is connected to the other downstream heterogeneous database systems through the WebSocket communication protocol. After the connection is successful, the metamodel is synchronized between the heterogeneous database systems through initialization. Finally, for the data that needs to be synchronized directly from library to library, the task middleware is used to control the start or stop of the data synchronization task between the heterogeneous database systems, and the data change capture technology is used to perform data resource synchronization between the heterogeneous database systems. By monitoring the database change log and capturing the changes in the database, the captured data is synchronized to each heterogeneous database system in the manner of full data synchronization and incremental data synchronization, so as to realize the full and incremental synchronization of resources between heterogeneous database systems. The practical problems that distributed multi-source heterogeneous data is difficult to parse after serialization and data increment is difficult to synchronize are solved, and the synchronization of resources such as metamodels and multi-source heterogeneous data is quickly completed. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the conventional technology, the drawings required for use in the embodiments or the conventional technology descriptions are 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 creative work.
[0018] Figure 1 A schematic diagram of a process of a distributed resource synchronization method in one embodiment;
[0019] Figure 2 A schematic diagram of a process of metamodel synchronization in an embodiment;
[0020] Figure 3 A schematic diagram of a handshake process of the web Socket protocol in an embodiment;
[0021] Figure 4 A schematic diagram of an implementation process of a data change capture technology in an embodiment;
[0022] Figure 5 This is a schematic diagram of the process of Binlog log monitoring in an embodiment;
[0023] Figure 6 A schematic diagram of a data synchronization process in one embodiment;
[0024] Figure 7 A schematic diagram of a process flow of system consumption data in an embodiment;
[0025] Figure 8 A schematic diagram of the overall process of distributed resource synchronization in one embodiment;
[0026] Fig. 9 FIG. 1 is a schematic diagram of the architecture of a distributed resource synchronization system in one embodiment. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and Examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Unless otherwise defined, all technical and scientific terms used in the present application have the same meaning as those commonly understood by those skilled in the art of the present application. The terms used in the specification of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application.
[0028] It should be noted that the reference to "embodiment" in this application means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present invention. The presentation of this phrase at various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It will be appreciated by those skilled in the art that the embodiments described in this application may be combined with other embodiments. The term "and / or" used in the specification of the present invention and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0029] In distributed resources, data is mainly divided into full data and incremental data. Full data refers to the data that already exists in the database, which can also be understood as the data that has been synchronized; incremental data refers to the data that is added, modified, or deleted in the database. When synchronizing data, you cannot only synchronize full data, but also incremental data. How to synchronize incremental data quickly and in real time is also a problem that needs to be solved at present.
[0030] The following will describe the implementation of the present invention in detail with reference to the accompanying drawings in the embodiment diagram of the present invention.
[0031] In one embodiment, Figure 1 As shown, a distributed resource synchronization method is provided, comprising the following steps S12 to S16:
[0032] S12, obtaining metamodels that need to be synchronized to each distributed heterogeneous database system; the metamodels include a cleaning and fusion metamodel and a cataloging metamodel;
[0033] S14, after establishing connections with each heterogeneous database system through the WebSocket interface, the metamodel is sent to each heterogeneous database system through initialization to complete the metamodel synchronization of each heterogeneous database system;
[0034] S16, control the start or stop of data synchronization tasks between heterogeneous database systems through task middleware, and use data change capture technology to perform data resource synchronization between heterogeneous database systems; data resource synchronization includes full data synchronization and incremental data synchronization.
[0035] It can be understood that in the existing resource configuration management subsystem, there are two main types of distributed resources that can be synchronized: one is metamodel and the other is data. Metadata is data that describes objects such as information resources or data, and the standardized information model that defines the attributes and relationships of metadata and manages them is called metamodel. Each type of metadata belongs to a metamodel. Metamodel is a tool for data collection, data fusion processing, data storage, data display and data permission control. Among them, the cleaning and fusion metamodel is responsible for collecting data from heterogeneous databases, specifying cleaning and fusion rules and transmitting data to the real-time data service platform tapdata (i.e., task middleware) to perform heterogeneous data cleaning and fusion tasks, and storing the cleaned and fused standardized data in the standardized database. The cataloging metamodel is responsible for collecting standardized data in the standardized database, establishing relationships between models, specifying the mapping relationship between data in the database table, and generating data instances in the form of graph nodes through tasks. For the two resources of metamodel and data, the synchronization methods are different.
[0036] The handshake process of the web Socket protocol can be as follows Figure 2 As shown in the figure, when the resource configuration management subsystem synchronizes the metamodel with other heterogeneous database systems, it is implemented through the WebSocket communication protocol. Among them, the resource configuration management subsystem acts as the server and other heterogeneous database systems act as the client.
[0037] The specific synchronization process of the metamodel can be as follows Figure 3As shown in the figure, taking other heterogeneous database systems as clients to create connections with the server of the resource configuration management subsystem through WebSocket objects as an example, the URL (Uniform Resource Locator) of the connection starts with ws: / / or wss: / / ; during the handshake process, when other systems send WebSocket connection requests, it is necessary to add some specific fields to the HTTP message header, such as the existing Upgrade field, Connection field, and Sec-WebSocket-Key field. The server performs the following three steps to obtain the value Accept of this part: first, the Sec-WebSocket-Key field value and the globally unique identifier (GUID) value in the HTTP request header are concatenated to obtain the R value, and then the R value is hashed by SHA-1 (Secure Hash Algorithm 1) to obtain the SR value. Finally, the SR value is Base64 encoded again to obtain the final value Accept. The specific processing of the Sec-WebSocket-Accept field value can be expressed by the following formula:
[0038] Accept=Base64(SHA-1(Key+GUID)) (1)
[0039] After receiving the HTTP request, the resource configuration management subsystem verifies the client's HTTP request header and then returns the HTTP response header, which includes the HTTP status code 101 field and the Sec-WebSocket-Accept field. The previous Sec-WebSocket-Key field value is calculated in the same way as formula (1), and the calculation result is compared with the Sec-WebSocket-Accept field value in the HTTP response header. If a match is successful, it means that the handshake is successful and the client's connection protocol is upgraded to Web Socket. Otherwise, the connection fails. After the data transmission handshake is successful, the connection between other heterogeneous database systems and the resource configuration management subsystem has been upgraded to a WebSocket interface connection, which can transmit data in both directions. In the resource configuration management subsystem, select the metamodel that needs to be synchronized to other heterogeneous database systems, and start issuing the metamodel through initialization; serialize the metamodel information and convert it into a Json format file. The WebSocket interface of the resource configuration management subsystem sends the Json format file through the send() method, and the WebSocket interface of other heterogeneous database systems receives the Json format file through the Onmessage (message listening) event; after receiving the Json format file, other heterogeneous database systems convert it back into the attribute information of the metamodel through the corresponding deserialization, and then call the corresponding existing metamodel construction algorithm to establish the metamodel on the other heterogeneous database systems and fill in the attribute information of the synchronized metamodel, and finally save the built metamodel in the database of other heterogeneous database systems.
[0040] In some implementations, the disconnection of the WebSocket interface connection can be actively triggered by the client or the server. The client can close the WebSocket interface connection by close(), and the server can also send a CloseFrame message to close the WebSocket interface connection. In addition, since the WebSocket interface connection uses the TCP protocol, the connection will be automatically disconnected in the event of a network failure, etc., thereby achieving flexible WebSocket interface connection control.
[0041] Data synchronization uses data replication technology, but when data changes occur in the source database, such as data addition, data modification, and data deletion, how to capture these changes in real time is a problem that needs to be solved. CDC (Change Data Capture) technology is a database-to-database data replication technology. Since the database log file contains all historical change details, it can ensure data consistency; and since the database log file can be consumed in a streaming manner, it can ensure data real-time performance.
[0042] The above-mentioned distributed resource synchronization method, based on in-depth research and analysis of distributed multi-source heterogeneous resources, divides resources into two types of resources that need to be synchronized, namely metamodels and data. Based on this, after obtaining the metamodels that need to be synchronized to each heterogeneous database system, the resource configuration management subsystem is connected to the other downstream heterogeneous database systems through the WebSocket communication protocol. After the connection is successful, the metamodel is synchronized between the heterogeneous database systems through initialization. Finally, for the data that needs to be synchronized directly from library to library, the task middleware is used to control the start or stop of the data synchronization task between the heterogeneous database systems, and the CDC technology is used to perform data resource synchronization between the heterogeneous database systems. By monitoring the database change log and capturing the changes in the database, the captured data is synchronized to each heterogeneous database system in the manner of full data synchronization and incremental data synchronization, so as to realize the full and incremental synchronization of resources between heterogeneous database systems. The practical problems that distributed multi-source heterogeneous data is difficult to parse after serialization and data increment is difficult to synchronize are solved, and the synchronization of resources such as metamodels and multi-source heterogeneous data is quickly completed.
[0043] In one embodiment, the task middleware uses data change capture technology to monitor database change logs of heterogeneous database systems and stores the captured data in a data warehouse, a data lake, or a message queue.
[0044] It can be understood that the resource configuration management subsystem monitors the database log files through the task middleware and captures the changes in the database, such as data addition, data modification, and data deletion. These changes are captured in the order in which they occur, and the captured data is stored in the data warehouse or data lake, or written to the message queue for consumption by other services. The specific process can be as follows: Figure 4 shown.
[0045] In the system, data synchronization is achieved by copying one database to another, or merging multiple databases and copying them to one database. For different heterogeneous databases, such as MySQL, DM and MongoDB, for full data synchronization, the table structure and data can be directly copied; for incremental data synchronization, the data information of addition, deletion and modification of the table in the database can be obtained by monitoring or subscribing to its change log.
[0046] Take one type of heterogeneous database system (such as MySQL database) as an example. The database will record every operation on the data and archive it to form a corresponding log file to facilitate data maintenance and rollback, and provide reliable proof of data modification. For each operation, MySQL database will record the specific information of the operation, and add the operation time (Op_ts), the position in the log (Position) and the transaction unique identifier (Gtid) before and after the operation, and compress it into binary log files according to the set mode (such as one of the three modes of existing statement level, row level and mixed) - that is, Binlog files. Using different modes, although the compressed binary files are not exactly the same, they all contain detailed information of each operation and strictly guarantee the order of operations. According to the operations and order in the log, these operations are repeated in sequence in another database. As long as the initial states of the two databases are the same, the final results after the operation are completed are also the same, thus achieving data synchronization.
[0047] When the MySQL database is replicated from the master to the slave, it uses log files. The master database will push the recorded log files to the slave database according to a certain protocol, and the slave database will operate according to the pushed log files. Because the log files are generated by the master database, after the slave database operates completely according to the pushed log files, the final result must be consistent with the master database, completing the master-slave replication. The unit of the log file record is the actual SQL (Structured Query Language) statement that has been operated. Each time an SQL statement is executed, the log records an operation. In the row mode, the unit of the log file record is the affected record. If an SQL statement is executed and affects 100,000 records, the row mode log file will record 100,000 data, while the statement mode log will only record one data. It can be seen that using the row mode, you can know the modification of each record in detail, but the price you pay is that the log file is larger and the read and write pressure of the machine disk is greater. The hybrid mode combines the advantages of the row mode and the statement mode. For the SQL statements executed by the database, the database itself determines whether to use the row mode or the statement mode. Since this system is a streaming data processing system, the row mode is adopted, which can not only monitor the changes of each record and accurately count the statistical data, but also make the data processing more continuous, average the synchronization delay to each record, and reduce the average delay.
[0048] The log file using row mode consists of transactions. The BEGIN string exists at the start position of each transaction and the COMMIT string exists at the end position. Before each specific operation statement recorded, there is a ### mark. By making reasonable use of these marks, it is easy to parse each operation action of the log file. When the statement is an insert statement (insert), the log records the values of all fields after the insertion; when the statement is an update statement (update), the log records the values of all fields before and after the update; when the statement is a delete statement (delete), the log records the values of all fields before the deletion. When performing insert, update and delete operations, the log will contain the values of all fields related to this operation. The difference is that the insert operation records the field values after the operation, the update operation records the field values before and after the operation, and the delete operation records the field values before the operation. In order to unify the three operations of insert, update and delete, so that there is no need for diversified processing in subsequent processing, a unified representation format for each operation needs to be designed.
[0049] When the MySQL database is used as the data source for the synchronization task, the changes in its data table can be obtained by monitoring its Binlog log. At this time, the task middleware (tapdata) needs to be used as the client and the MySQL database server (hereinafter referred to as the MySQL server) as the server to establish a connection. After the connection is successfully established, the addition, deletion and modification information of the database can be obtained. The process is as follows: Figure 5 shown.
[0050] The task middleware establishes a connection with the MySQL server. The MySQL server sends a handshake initialization package to the task middleware. The task middleware sends the MySQL user name, password and other information to the MySQL server for login authentication. If the authentication is successful, the handshake phase ends and the command execution phase begins. The show master status command is sent to obtain the current Binlog filename and Binlog position of the MySQL server as the synchronization point of the task, and then the checksum type of the Binlog log is obtained for subsequent BinlogEvent analysis. The heartbeat interval is set to determine the time interval for traversing the log information, which can be accurate to milliseconds. After sending the COM_BINLOG_DUMP command to start Binlog Dump, the MySQL server will send a Binlog Event to the task middleware when the database sends a change. After the task middleware obtains the change information, it saves the change information in the message queue for use by the resource configuration management subsystem and other heterogeneous database systems. The specific process is as follows: Figure 6As shown in the figure, the resource configuration management subsystem can be used to control the start or stop of synchronization tasks. After the task middleware monitors the Binlog log change information of the MySQL database, it writes this information to the database to be synchronized to complete the data synchronization between databases.
[0051] In one embodiment, the database change log is a row-mode log file, and the message queue is a distributed queue Kafka.
[0052] It is understandable that the performance of heterogeneous databases is often different, and the performance of different machines is also different. The speed of log parsing and the speed of writing to the target database will not completely match. Therefore, data synchronization requires the setting of a cache area to be compatible with the speed of extracting data from the source database and the speed of writing data to the target database. Not only that, with the data cache area, when data synchronization errors occur and there are differences in the data, as long as the operations parsed from the logs enter the cache area, you only need to roll back the storage program, re-consume the data in the cache area, and enter the database again. In the absence of a cache area, when a data synchronization error occurs and the data is incorrect, the parsing program and the storage program must be rolled back at the same time to resynchronize the data, which has a greater impact on the entire process.
[0053] The selection of the cache area must meet certain requirements. The operations of the source database have a certain order. Only by strictly following the execution order of the source database to reproduce the data can we ensure that the final state of the target database remains the same as that of the source database. Otherwise, it will lead to the appearance of differential data. Therefore, it is necessary to select the message queue data structure as the cache area. In addition, the massive data generated by the source database requires the message queue to have a large throughput in order to process it in time. The queue throughput of the stand-alone version is small, and it is obviously not suitable for processing massive data. The distributed queue Kafka is needed.
[0054] Distributed queue Kafka divides different queues by topic, and different queues have different topic names, which is the first level of division of distributed queues. When sending messages and consuming messages, you need to specify the topic name. In order to increase concurrency and throughput, each queue can be set with multiple partitions, that is, divided into multiple sub-queues, which is the second level of division of distributed queues. The number of partitions determines the upper limit of concurrency. A piece of data will be divided into one of the partitions according to the given key value (such as the table name), but a piece of data will only be divided into one partition and will not appear in multiple partitions at the same time. Each piece of data in a partition has a different offset, marking the position of the data in the partition.
[0055] When consuming distributed queue data, different programs can read data from different locations of the distributed queue (the location refers to the offset set of each partition), so there is the concept of consumer group. Programs belonging to the same consumer group share the location of consumption data. When a consumer in a group is replaced by a new consumer, the new consumer continues from the position of the old consumer. Since the queue is divided into partitions, consumers in the same group actually correspond to different partitions, thereby improving the concurrent consumption capacity of the entire consumer group. In order to prevent data duplication of the same group of consumers, a partition can only be consumed by one consumer in the same group in a certain time period, and there will be no situation where two consumers in the same consumer group consume a partition at the same time. When the number of consumers in a consumer group is greater than the number of partitions in the queue, each consumer can correspond to a partition, and the extra consumers will be idle and wait to take over the work. The change information captured from the source database is stored in the queue, and the consumer group composed of the target database consumes it. The flow chart is as follows Figure 7 As shown:
[0056] The resource configuration management subsystem monitors the change logs of each source database through the task middleware. The source databases include relational databases such as Mysql, non-relational databases such as mongoDB, and time-series databases such as TDengine. When changes occur in the data tables in the source database, such as adding data, modifying data, and deleting data, the task middleware tapdata will capture these change information in real time and publish these change information as a data survivor. In order to be compatible with the speed of extracting data from the source database and the speed of writing data to the target database, and to avoid the simultaneous rollback of the program when a synchronization error occurs, the change information is stored in the high-throughput distributed message queue Kafka. The change information of the data in each data table of each source database is stored in the same partition to facilitate consumption by the consumer group. Each target database forms a consumer group as a consumer to obtain the change information in the required partition in the message queue Kafka. Different consumers in the consumer group cannot consume the same data in the partition at the same time. When a consumer exits the consumer group, Kafka will save the consumer's consumption progress. When a new consumer enters the consumer group, it can continue to consume from the consumption progress.
[0057] like Figure 8 As shown in the figure, in general: to synchronize metamodels between systems or synchronize data between databases, you need to create a data source in the resource configuration management subsystem. The data source is a heterogeneous database of this system or other systems, which is used for distributed storage resources. Configure data source parameters, such as data source type, data source name, address, interface, account password, etc. After configuring the data source information, the resource configuration management subsystem uses the task middleware to handshake with the data source. After the connection test is successful, it can be used for synchronization.
[0058] Specifically, for synchronization between systems, first create a metamodel in the resource configuration management subsystem and configure the metamodel parameters. After the creation is completed, add a relationship to the metamodel. Through the initialization function, the metamodel can be synchronized to other systems connected to the resource configuration management subsystem through the WebSocket communication protocol for use.
[0059] In addition to synchronizing metamodels, resource synchronization can also directly synchronize data, such as the standard data obtained by the cleaning and fusion task, the catalog data obtained by the catalog task, or directly multi-source heterogeneous data. For synchronization between databases, you first need to configure the synchronization task information in the resource configuration management subsystem, determine the source database table and target database table for synchronization, and ensure that both databases have successfully completed the connection test. After creation, you can start the data synchronization task by clicking the Start Task button. The task middleware first completes the synchronization of the full amount of data. After completing the full synchronization, it will complete the incremental synchronization by real-time monitoring of the database change log information.
[0060] When the task middleware detects the change information of the source database, it will store it in the message queue. The target database will obtain the change information in the source database by subscribing to the queue node.
[0061] It should be understood that although the above process Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but the steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in the application, there is no strict order restriction for the execution of the steps, and the steps can be executed in other orders. Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequentially, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0062] In one embodiment, a distributed resource synchronization system 100 is provided, including a resource configuration management subsystem 101 and distributed heterogeneous database systems 102. Fig. 9As shown, N represents the total number of heterogeneous database systems 102. After the resource configuration management subsystem 101 obtains the metamodel that needs to be synchronized to each distributed heterogeneous database system 102, it establishes a connection with each heterogeneous database system 102 through the WebSocket interface. The resource configuration management subsystem 101 sends the metamodel to each heterogeneous database system 102 through initialization to complete the metamodel synchronization of each heterogeneous database system 102; the metamodel includes a cleaning fusion metamodel and a cataloging metamodel. The resource configuration management subsystem 101 controls the start or stop of the data synchronization task between each heterogeneous database system 102 through the task middleware, and uses the data change capture technology to perform data resource synchronization between each heterogeneous database system 102; data resource synchronization includes full data synchronization and incremental data synchronization.
[0063] The distributed resource synchronization system 100, based on in-depth research and analysis of distributed multi-source heterogeneous resources, divides resources into two types of resources that need to be synchronized, namely metamodels and data. Based on this, after obtaining the metamodels that need to be synchronized to each heterogeneous database system 102, the resource configuration management subsystem and other downstream heterogeneous database systems 102 are connected by handshake through the WebSocket communication protocol. After the connection is successful, the synchronization of the metamodel between the heterogeneous database systems 102 is realized through initialization. Finally, for the data that needs to be synchronized directly from library to library, the task middleware is used to control the start or stop of the data synchronization task between the heterogeneous database systems 102, and the data change capture technology is used to perform the data resource synchronization between the heterogeneous database systems 102. By monitoring the database change log and capturing the changes in the database, the captured data is synchronized to each heterogeneous database system 102 in the manner of full data synchronization and incremental data synchronization, so as to realize the full and incremental synchronization of resources between the heterogeneous database systems 102. The practical problems that distributed multi-source heterogeneous data is difficult to parse after serialization and data increment is difficult to synchronize are solved, and the synchronization of resources such as metamodels and multi-source heterogeneous data is quickly completed.
[0064] In one embodiment, the task middleware uses data change capture technology to monitor database change logs of heterogeneous database systems and stores the captured data in a data warehouse, a data lake, or a message queue.
[0065] In one embodiment, the database change log is a row-mode log file, and the message queue is a distributed queue Kafka.
[0066] It can be understood that the explanation of each feature in each embodiment of the above-mentioned distributed resource synchronization system 100 can be understood in the same way as the explanation of the corresponding features of each embodiment of the above-mentioned distributed resource synchronization method, and will not be repeated here. Each module in the above-mentioned resource configuration management subsystem 101 can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of a device with data processing functions in the form of hardware, or can be stored in the memory of the aforementioned device in the form of software, so that the processor can call and execute the operations corresponding to the above modules. The aforementioned device can be, but is not limited to, various types of data computing and processing devices already available in the art.
[0067] In one embodiment, a computer device is also provided, including a memory and a processor, the memory storing a computer program, and the processor implementing the following processing steps when executing the computer program: obtaining metamodels that need to be synchronized to each distributed heterogeneous database system; the metamodels include a cleaning and fusion metamodel and a cataloging metamodel; after establishing connections with each heterogeneous database system through a WebSocket interface, the metamodels are sent to each heterogeneous database system through initialization to complete the metamodel synchronization of each heterogeneous database system; the data synchronization task between each heterogeneous database system is controlled by a task middleware, and data change capture technology is used to perform data resource synchronization between each heterogeneous database system; data resource synchronization includes full data synchronization and incremental data synchronization.
[0068] It can be understood that in addition to the memory and processor mentioned above, the above-mentioned computer device may also include other software and hardware components not listed in this specification. The specific details can be determined according to the model of the specific data processing device in different application scenarios, and this specification will not list them one by one in detail.
[0069] In one embodiment, when the processor executes the computer program, the processor may also implement the steps or sub-steps added in the above-mentioned distributed resource synchronization method embodiments.
[0070] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus dynamic random access memory (RambusDRAM, referred to as RDRAM) and interface dynamic random access memory (DRDRAM).
[0071] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification. The above embodiments only express several implementation methods of the present application, and their descriptions are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, without departing from the concept of the present application, several variations and improvements can be made, all of which belong to the protection scope of the present application. Therefore, the protection scope of the patent of this application shall be based on the attached claims.
Claims
1. A distributed resource synchronization method, characterized in that: Includes steps: Obtain the metamodel that needs to be synchronized to each distributed heterogeneous database system; the metamodel includes a cleaning and fusion metamodel and a cataloging metamodel. The cleaning and fusion metamodel is responsible for collecting data from heterogeneous databases, specifying cleaning and fusion rules and passing the data to the task middleware to perform heterogeneous data cleaning and fusion tasks, and storing the cleaned and fused standard data in the standard database. The cataloging metamodel is responsible for collecting standard data in the standard database, establishing relationships between models, specifying mapping relationships between data in database tables, and generating data instances in the form of graph nodes through tasks; After establishing connections with each of the heterogeneous database systems through the WebSocket interface, the metamodel is sent to each of the heterogeneous database systems through initialization to complete the metamodel synchronization of each of the heterogeneous database systems; The task middleware is used to control the start or stop of the data synchronization task between the heterogeneous database systems, and the data change capture technology is used to perform data resource synchronization between the heterogeneous database systems; the data resource synchronization includes full data synchronization and incremental data synchronization.
2. The distributed resource synchronization method according to claim 1, characterized in that: The task middleware uses data change capture technology to monitor the database change log of the heterogeneous database system and stores the captured data in a data warehouse, a data lake or a message queue.
3. The distributed resource synchronization method according to claim 2, characterized in that: The database change log is a row-mode log file, and the message queue is a distributed queue Kafka.
4. A distributed resource synchronization system, characterized in that: Including resource configuration management subsystem and distributed heterogeneous database systems; After the resource configuration management subsystem obtains the metamodel that needs to be synchronized to each distributed heterogeneous database system, it establishes a connection with each heterogeneous database system through the WebSocket interface. The resource configuration management subsystem sends the metamodel to each heterogeneous database system through initialization to complete the metamodel synchronization of each heterogeneous database system; the metamodel includes a cleaning and fusion metamodel and a cataloging metamodel. The cleaning and fusion metamodel is responsible for collecting data from heterogeneous databases, specifying cleaning and fusion rules and passing the data to the task middleware to perform heterogeneous data cleaning and fusion tasks, and storing the cleaned and fused standard data in the standard database. The cataloging metamodel is responsible for collecting standard data in the standard database, establishing relationships between models, specifying mapping relationships between data in database tables, and generating data instances in the form of graph nodes through tasks; The resource configuration management subsystem controls the start or stop of the data synchronization task between the heterogeneous database systems through the task middleware, and uses the data change capture technology to perform data resource synchronization between the heterogeneous database systems; the data resource synchronization includes full data synchronization and incremental data synchronization.
5. The distributed resource synchronization system according to claim 4, characterized in that: The task middleware uses data change capture technology to monitor the database change log of the heterogeneous database system and stores the captured data in a data warehouse, a data lake or a message queue.
6. The distributed resource synchronization system according to claim 5, characterized in that: The database change log is a row-mode log file, and the message queue is a distributed queue Kafka.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the distributed resource synchronization method according to any one of claims 1 to 3 are implemented.
