A distributed intelligent real-time data stream distribution method and system
Through the distributed intelligent real-time data flow distribution method and the use of sharding processing and compression technology, the real-time and consistency problems of the data distribution system under the microservice architecture are solved, the data processing speed and reliability are improved, and the massive data processing needs are met. , reducing system resource usage costs.
Patent Information
- Application Number
- CN202210588993.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-26
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-05-26
AI Technical Summary
Under the microservice architecture, the existing data distribution system has problems such as numerous data classifications, inability to distribute in real time, insufficient processing capabilities, and inconsistent data, resulting in high business coupling, low development efficiency, non-real-time data interaction, poor concurrency, and weak reliability. .
Adopting a distributed intelligent real-time data flow distribution method, the information of the source database is synchronously distributed to the target database through the data distribution system, using sharding processing and compression packaging technology, monitoring log information for incremental data distribution, and using distributed file system storage Displacement information ensures data consistency and high reliability, and automatically restores data synchronization in abnormal situations.
It improves the speed of data processing and the timeliness of distribution, reduces delays, ensures the real-time and consistency of data, improves the performance and reliability of data interaction, meets the needs of massive data processing, and reduces the cost of using system resources. .
Smart Images

Figure CN114996353B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data distribution, and in particular to a distributed intelligent real-time data stream distribution method and system. Background Art
[0002] With the rapid development of the Internet, the amount of data generated is growing exponentially. Under the microservice architecture, different microservices use different data sources in view of the principle of data isolation. Therefore, businesses can only obtain the required data remotely through interface calls, which increases the impact between businesses, has high coupling, is more complicated to call, data interaction is not real-time, and concurrency cannot be met.
[0003] The problems existing in the existing data distribution system are as follows:
[0004] 1. The data required by the business side is diverse and cannot be distributed dynamically through attribute configuration.
[0005] How to distribute business data of different types, attributes and structures to the target system in a unified and real-time manner. The traditional implementation method is to customize programs for each data structure. This development efficiency is relatively low, and a dynamic configuration strategy is urgently needed to distribute data. Guided by business goals, the relevant data sources and data destinations of the data link are selected through basic configuration, and the data object mapping relationship is established. Through restriction configuration and policy configuration, structure change strategy, consistency guarantee strategy, and early warning, log, automatic restart and other task execution strategies, various business scenarios in actual projects can be met.
[0006] 2. Data cannot reach the business system in real time and there is high latency.
[0007] In microservice systems, many currently use interfaces for data interaction. However, due to problems such as long interface call links, too much data in the data table, insufficient network bandwidth, and disk io, this interaction sometimes causes interface timeouts, data cannot be obtained, or it takes a long time to obtain data.
[0008] 3. It is difficult to process massive amounts of data, and the data processing capabilities cannot meet business needs and achieve high concurrency and high performance.
[0009] Since computer system resources such as CPU, memory, network, and IO are limited, it is necessary to use as few system resources as possible to support as many requests as possible. However, in actual use, there are often peak business usage periods. Due to frequent business calls, large data volumes, and a sharp increase in concurrency, the system data cannot be processed, causing the system to crash, unable to process massive amounts of data, and lacking high-performance data interaction capabilities.
[0010] 4. Data is inconsistent, there are duplications and omissions, and data reliability cannot be guaranteed
[0011] There are often problems between business systems due to data mismatch, data unrecognition, data inconsistency, redundancy, lack of timeliness, missing data, and insufficient precision. Data quality reflects the applicability of data, that is, the degree to which data meets the use scenario. By comprehensively examining data in multiple dimensions such as accuracy, completeness, consistency, reliability, and timeliness, the value of data can be brought into play. Summary of the invention
[0012] In view of the problems existing in the prior art, the purpose of the present invention is to provide a distributed intelligent real-time data stream distribution method and system, which can effectively improve the data processing speed, thereby improving the timeliness of data distribution.
[0013] To achieve the above object, the technical solution adopted by the present invention is:
[0014] A distributed intelligent real-time data stream distribution method, the method synchronously distributes the information of a source database to a target database through a data distribution system, specifically as follows:
[0015] Load data distribution system configuration and read data distribution event status information;
[0016] Call the data reading connector to read the full amount of data to be distributed from the source database; if the reading fails, continue reading; if the reading succeeds, shard the read data;
[0017] Compress and package the sharded data, and then distribute it to different instances for data processing;
[0018] Call the data writing connector to write the processed data into the target database;
[0019] Automatically switch to incremental data distribution;
[0020] Monitor the log information of the source database. When the log information changes, pull the log information of the incremental data, and then perform log parsing to obtain the incremental data.
[0021] The incremental data is sharded, then the sharded data is compressed and packaged, and distributed to different instances for data processing;
[0022] Call the data writing connector to write the processed data to the target database.
[0023] When the data is written into the target database, the time status of data distribution and the processed source data displacement information are written into the distributed file system.
[0024] When an exception occurs in the source database, restart the source database, continue to generate data change log information, read the information in the distributed file system, obtain the displacement information stored at the time of the most recent failure, and continue data synchronization;
[0025] and / or
[0026] When an exception occurs in the data distribution system, the data distribution system is restarted, the information in the distributed file system is read, the displacement information stored at the time of the most recent failure is obtained, and data synchronization is continued;
[0027] and / or
[0028] When an exception occurs in the target database, the target database is restarted, the information in the distributed file system is read, the displacement information stored at the time of the most recent failure is obtained, and data synchronization continues.
[0029] The sharding process is as follows:
[0030] Specify the number of shard intervals C, specifically C1+C2+...+Cn;
[0031] Specify the length of each shard interval. The specific intervals are divided into [0,L1), [L1,2L1), ..., [(C1-1)L1,C1L1), [C1L1,C1L1+L2), [C1L1+L2,C1L1+2L2), ..., where each interval corresponds to a data node;
[0032] Perform a dot multiplication operation on the two arrays above to obtain the modulus, as shown in formula (1):
[0033] M=C*L=C1L1+C2L2+....+C n L n ;
[0034] Then, the above two arrays are cross-multiplied to obtain the number of virtual slices, as shown in formula (2):
[0035]
[0036] The actual virtual shard is assigned based on the value of the where condition;
[0037] For each data, the result of calculation according to formula (1) is M, then the data number is modulo M, and the obtained value falls into the virtual slice calculated by formula (2);
[0038] Map the divided virtual shard intervals to the computer nodes of the actual shards.
[0039] The source database, data distribution system and target data use SSD disks.
[0040] A distributed intelligent real-time data stream distribution system, comprising a source database, a data distribution system, a target database, and a registration center;
[0041] The data distribution system is used to synchronize the data of the source database to the target database, and the data distribution system includes a data distribution center and a data processing center; the data processing center includes multiple data processing instances, each of which is registered in the registration center;
[0042] The registration center is used to transmit the instance configuration information of the data processing center to the data distribution center, and is also used to monitor the survival of the instances of the data processing center in real time. If the instance is monitored to be hung up, the script of the self-starting instance is automatically executed immediately to start the instance;
[0043] The data distribution center is used for full data distribution and incremental data distribution; when used for full data distribution, the data distribution center obtains the full data to be distributed from the source database, and then performs sharding processing on the obtained data according to the instance configuration information, compresses and packages the sharded data, and distributes it to different instances of the data processing center; when used for incremental data distribution, the data distribution center monitors the log information of the source database, and when the log information changes, pulls the log information of the incremental data, and then performs log parsing to obtain the incremental data; then, the incremental data is sharded according to the instance configuration information, and the sharded data is compressed and packaged, and distributed to different instances of the data processing center;
[0044] The data processing center is used to receive the data distributed by the data distribution center and process the data; the processed data is written into the target database.
[0045] The real-time data stream distribution system also includes a distributed file system. When the data processing center writes data into the target database, it stores the event status of data distribution and the processed source data displacement information in the distributed file system.
[0046] When an exception occurs in the source database, restart the source database, continue to generate data change log information, read the information in the distributed file system, obtain the displacement information stored at the time of the most recent failure, and continue data synchronization;
[0047] and / or
[0048] When an exception occurs in the data distribution system, the data distribution system is restarted, the information in the distributed file system is read, the displacement information stored at the time of the most recent failure is obtained, and data synchronization is continued;
[0049] and / or
[0050] When an exception occurs in the target database, the target database is restarted, the information in the distributed file system is read, the displacement information stored at the time of the most recent failure is obtained, and data synchronization continues.
[0051] The data distribution center processes the data fragmentation as follows:
[0052] Specify the number of shard intervals C, specifically C1+C2+...+Cn;
[0053] Specify the length of each shard interval. The specific intervals are divided into [0,L1), [L1,2L1), ..., [(C1-1)L1,C1L1), [C1L1,C1L1+L2), [C1L1+L2,C1L1+2L2), ..., where each interval corresponds to a data node;
[0054] Perform a dot multiplication operation on the two arrays above to obtain the modulus, as shown in formula (1):
[0055] M=C*L=C1L1+C2L2+....+C n L n ;
[0056] Then, the above two arrays are cross-multiplied to obtain the number of virtual slices, as shown in formula (2):
[0057]
[0058] The actual virtual shard is assigned based on the value of the where condition;
[0059] For each data, the result of calculation according to formula (1) is M, then the data number is modulo M, and the obtained value falls into the virtual slice calculated by formula (2);
[0060] Map the divided virtual shard intervals to the computer nodes of the actual shards.
[0061] The source database, data distribution system and target data use SSD disks.
[0062] After adopting the above scheme, the present invention uses the log file of the source database to obtain incremental data when performing incremental data distribution, which reduces the query pressure on the source database, ensures the stability of the system, and improves the real-time performance of incremental data distribution. In addition, whether it is performing full data distribution or incremental data distribution, the present invention performs sharding processing on the acquired data. The sharding processing process fully considers the configuration information of different instances, and then performs adaptive adjustments, thereby improving the speed of data processing, thereby improving the timeliness of data distribution, and realizing real-time data distribution. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 This is a flow chart of Embodiment 1;
[0064] Figure 2 This is a schematic diagram of the data sharding result of Example 1;
[0065] Figure 3 It is a schematic diagram of system abnormality;
[0066] Figure 4 This is a system block diagram of Example 2. DETAILED DESCRIPTION
[0067] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.
[0068] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. The embodiments described are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0069] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0070] The terms "first", "second", "third", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any variation thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.
[0071] Embodiment 1
[0072] like Figure 1 As shown, this embodiment discloses a distributed intelligent real-time data stream distribution method, which synchronously distributes the information of the source database to the target database through a data distribution system, and specifically includes the following steps:
[0073] Step 1: Load the data distribution system configuration and read the data distribution event status information.
[0074] The configuration information of the data distribution system will be registered and saved when it is deployed, and will be updated in real time when it is used.
[0075] Step 2: Call the data reading connector to read the full amount of data to be distributed from the source database; if the reading fails, continue reading; if the reading succeeds, shard the read data.
[0076] Sharding processing refers to distributing the data to be processed according to the number of computer servers. Suppose there are 3 computers and 90 pieces of data. If the data is evenly distributed to the 3 computers for processing, each computer will get 30 pieces of data. This is the even distribution sharding algorithm. Most of the data processing systems in the industry will use the hash sharding algorithm, but in actual scenarios, due to the different processing performance of each computer's resources, IO, memory, and CPU, even distribution may lead to data processing efficiency. Therefore, this embodiment optimizes and improves the hash sharding algorithm, and the specific method flow is as follows:
[0077] First define the following two variables:
[0078] partitionCount refers to the number of shards, and partitionLength refers to the length of the shard. The specific explanations are as follows:
[0079] partitionCount: specifies the number of partition intervals C, specifically C1+C2+...+Cn;
[0080] partitionLength: specifies the length of each partition interval. The specific intervals are divided into [0,L1), [L1,2L1), ..., [(C1-1)L1,C1L1), [C1L1,C1L1+L2), [C1L1+L2,C1L1+2L2), ..., where each interval corresponds to a data node.
[0081] Sharding method steps:
[0082] 1) Perform a dot multiplication operation on the above two arrays to obtain the modulus, as shown in formula (1).
[0083] M=C*L=C1L1+C2L2+....+C n L n
[0084] 2) Then perform cross product on the above two arrays to obtain the number of virtual slices, as shown in formula (2).
[0085]
[0086] 3) The actual virtual shard is assigned based on the value of the where condition
[0087] select * from shareding_key = 999 (shared_key is generally the name of the data column of the shard, and in most cases the primary key of the table, i.e., ID) first extract 999 (data number, 999 is an example) according to the shard key, and the result calculated according to formula (1) is M, 999 modulo M, i.e., 999%M, and then the obtained value falls into the virtual shard calculated by formula (2).
[0088] 4) Map the divided virtual sharding intervals to the computer nodes of the actual sharding.
[0089] For example, the array of slice quantity and slice length are configured as follows:
[0090]
[0091] According to the formula M=C*L, we can get the following
[0092] M=C*L=2*100+3*50=350
[0093] That is, the value passed in needs to be modulo 350.
[0094] According to formula (2), the physical partition is
[0095]
[0096] For example, the data number is 999, 999 modulo 350 is exactly 299, which falls within the range of 250-300, which is the fourth interval.
[0097] Then configure the interval to a specific computer, for example, [0, 100][100, 200] is mapped to server 1 (server1), [200, 250][250, 300] is mapped to server 2 (server2), and [300, 350] is mapped to server 3 (server3). Figure 2 shown.
[0098] Step 3: Compress and package the sharded data, and then distribute it to different instances to process the data.
[0099] In this embodiment, a compression algorithm (QuickLZ compression algorithm) is used to achieve efficient compression and packaging of data.
[0100] Step 4: Call the data writing connector to write the processed data into the target database.
[0101] Step 5: Automatically switch to incremental data distribution.
[0102] After the full data distribution is completed, the data distribution system will automatically switch to incremental data distribution. When the source database generates incremental data, the incremental data will be synchronously distributed to the target database. See steps 6-8 for details.
[0103] Step 6: Monitor the log information of the source database. When the log information changes, pull the log information of the incremental data, and then perform log parsing to obtain the incremental data.
[0104] Step 7: Shard the incremental data, compress and package the sharded data, and distribute it to different instances for data processing.
[0105] When processing incremental data, the sharding method used is the same as the sharding method used when processing total data, and will not be repeated here.
[0106] Step 8: Call the data writing connector to write the processed data into the target database.
[0107] In this embodiment, the source database, the data distribution system and the target database all use SSD disks.
[0108] In this embodiment, while the data is written into the target database, the time status of data distribution and the processed source data displacement information are written into the distributed file system, thereby ensuring the accuracy of data synchronization.
[0109] Specifically, Figure 3 As shown, general data distribution exceptions mainly come from three major aspects: exceptions when obtaining data from the source database, exceptions when the data distribution system distributes data, and exceptions when writing data to the target database.
[0110] First, the system starts to distribute data. If an exception occurs, there are mainly three situations to ensure data consistency.
[0111] 1. How to ensure consistency when the source database is abnormal:
[0112] The data distribution system finds that it cannot connect to the source database, exits abnormally, restarts the source database, and the data distribution system (or retry) reads the information in the distributed file system and recovers from the data of the most recent checkpoint (the data offset stored at the time of the most recent failure). Since the displacement information of the database binary log information (binlog) can be read, synchronization can be continued without data loss, and consistency can be maintained in the end.
[0113] 2. How to ensure consistency when the data distribution system is abnormal:
[0114] After restarting the data distribution system (or retrying), the abnormal scenario of the same source database is consistent, and the database binary log displacement information (binlog) is continued to be read to achieve continued synchronization and maintain consistency.
[0115] 3. How to ensure consistency when an exception occurs in the target database:
[0116] When an exception occurs in the target database, the target database is restarted, the information in the distributed file system is read, the displacement information stored at the time of the most recent failure is obtained, and data synchronization continues.
[0117] When the write connector of the data distribution system cannot write data to the target database, the log offset information (binlog) of the source database read by the write connector will no longer be updated. Since the two operations of writing data to the target database and updating the binary log offset information (binlog) of the source database are designed as an atomic operation, after the target database is restored, it is restored from the most recent checkpoint (Checkpoint, the data offset stored at the time of the most recent failure) to ultimately maintain consistency.
[0118] Since the above three possible problems of data loss and data inconsistency have been solved, the consistency of data distribution can be ensured in the end.
[0119] Embodiment 2
[0120] like Figure 4 As shown, this embodiment discloses a distributed intelligent real-time data stream distribution system, which includes a source database, a data distribution system, a target database, and a registration center.
[0121] The data distribution system is used to synchronize the data of the source database to the target database. The data distribution system includes a data distribution center and a data processing center. The data processing center includes multiple data processing instances, and each data processing instance is registered in a registration center.
[0122] The registration center is used to transmit the instance configuration information of the data processing center to the data distribution center, and is also used to monitor the survival status of the instances of the data processing center in real time. If the instance is monitored to be hung up, the script of the self-starting instance is automatically executed immediately to start the instance.
[0123] The data distribution center is used for full data distribution and incremental data distribution.
[0124] When used for full data distribution, the data distribution center obtains the full data to be distributed from the source database, and then shards the obtained data according to the instance configuration information. The sharded data is compressed and packaged and distributed to different instances of the data processing center.
[0125] When used for incremental data distribution, the data distribution center monitors the log information of the source database. When the log information changes, it pulls the log information of the incremental data, and then performs log parsing to obtain the incremental data. Then, the incremental data is sharded according to the instance configuration information, and the sharded data is compressed and packaged and distributed to different instances of the data processing center.
[0126] This embodiment optimizes and improves the hash sharding algorithm. The specific sharding method process is as follows:
[0127] First define the following two variables:
[0128] partitionCount refers to the number of shards, and partitionLength refers to the length of the shard. The specific explanations are as follows:
[0129] partitionCount: specifies the number of partition intervals C, specifically C1+C2+...+Cn;
[0130] partitionLength: specifies the length of each partition interval. The specific intervals are divided into [0,L1), [L1,2L1), ..., [(C1-1)L1,C1L1), [C1L1,C1L1+L2), [C1L1+L2,C1L1+2L2), ..., where each interval corresponds to a data node.
[0131] Sharding method steps:
[0132] 5) Perform a dot multiplication operation on the above two arrays to obtain the modulus, as shown in the following formula (1).
[0133] M=C*L=C1L1+C2L2+....+C n L n
[0134] 6) Then perform cross product of the above two arrays to obtain the number of virtual slices, as shown in formula (2).
[0135]
[0136] 7) The actual virtual shard is assigned based on the value of the where condition
[0137] select * from shareding_key = 999 (shared_key is generally the name of the data column of the shard, and in most cases the primary key of the table, i.e., ID) first extracts 999 (the data number, 999 is used as an example here) according to the shard key, and the result of calculation according to formula (1) is M. 999 modulo M is 999% M, and then the obtained value falls into the virtual shard calculated by formula (2).
[0138] Map the divided virtual shard intervals to the computer nodes of the actual shards.
[0139] The data processing center is used to receive the data distributed by the data distribution center and process the data; the processed data is written into the target database.
[0140] The real-time data stream distribution system also includes a distributed file system. When the data processing center writes data into the target database, it stores the event status of data distribution and the processed source data displacement information in the distributed file system so as to perform compensatory writing when data writing fails to ensure consistency.
[0141] When an exception occurs in the source database, the source database is restarted, and the data distribution system reads the log information of the source database, obtains the displacement information stored during the most recent failure, and continues data synchronization.
[0142] When an exception occurs in the data distribution system, the data distribution system is restarted, the log information of the source database is read, the displacement information stored at the time of the most recent failure is obtained, and data synchronization is continued.
[0143] In summary, the first and second embodiments of the present invention have the following effects:
[0144] 1. Improve the real-time performance of data distribution and reduce delays.
[0145] (1) Physically reduce the number of network transfer links as much as possible to increase network speed. Reduce hops; increase bandwidth, use Gigabit or 10 Gigabit network cards, etc. (For example, after sharding data is compressed, the file becomes smaller, which means that the data transfer on the network is reduced. Improving network speed also speeds up data transmission. Using high-bandwidth network cards will increase the speed of data transmission).
[0146] (2) Obtain data changes based on the binary log files of the source database to reduce the query pressure on the source system database;
[0147] (3) Improve data processing speed, improve processor performance, and use high-performance processing technologies such as in-memory computing and distributed parallel computing;
[0148] (4) Use efficient compression algorithms to compress and package data.
[0149] (5) Reduce disk IO operations and data processing synchronization waiting operations as much as possible, and adopt multi-threading and IO multiplexing technology (for example, compress data and reduce file size, which means reducing disk IO operations; for example, sharding improves the distribution speed of data files and reduces the waiting time for data processing. For example, when data is transferred from one computer to another, it is generally necessary to establish multiple connections to transfer data. During the transmission process, we can reduce the creation of IO connections and adopt connection multiplexing technology, which is IO multiplexing technology).
[0150] (6) Use superior sharding algorithms to shard data, avoid data skew, balance the amount of data processed by each computer, process data in a distributed manner, and horizontally expand data distribution computing resources through a heartbeat mechanism.
[0151] 2. Ensure the reliability and consistency of data;
[0152] (1) How to ensure consistency when the source database is abnormal:
[0153] The data distribution system finds that it cannot connect to the source database, exits abnormally, restarts the source database, and the data distribution system (or retry) reads the information in the distributed file system and recovers from the data of the most recent checkpoint (the data offset stored at the time of the most recent failure). Since the displacement information of the database binary log information (binlog) can be read, synchronization can be continued without data loss, and consistency can be maintained in the end.
[0154] (2) How to ensure consistency when data distribution system is abnormal:
[0155] After restarting the data distribution system (or retrying), the abnormal scenario of the same source database is consistent, and the database binary log displacement information (binlog) is continued to be read to achieve continued synchronization and maintain consistency.
[0156] (3) How to ensure consistency when an exception occurs in the target database:
[0157] When the write connector of the data distribution system cannot write data to the target database, the log offset information (binlog) of the source database read by the write connector will no longer be updated. Since the two operations of writing data to the target database and updating the binary log offset information (binlog) of the source database are designed as an atomic operation, after the target database is restored, it is restored from the most recent checkpoint (Checkpoint, the data offset stored at the time of the most recent failure) to ultimately maintain consistency.
[0158] Since the above three possible problems of data loss and data inconsistency have been solved, the consistency of data distribution can be ensured in the end.
[0159] 3. Improving the throughput of data distribution
[0160] To improve the throughput of data distribution, it is actually necessary to improve the data processing capability. This system uses monitoring and parsing of data change logs and distributed data processing capabilities to speed up data processing, while taking into account the horizontal expansion of data processing capabilities to improve the throughput of data distribution. The improvement is mainly carried out in the following four aspects:
[0161] (1) Improving the performance of data distribution on a single server
[0162] Multi-process data distribution reduces process switching and unnecessary lock operations. Reduce memory allocation and release operations, use long connections for persistence, improve IO operations, use asynchronous threads, and multiplexing technology.
[0163] (2) Horizontally increase server resources for distributed data processing
[0164] The data to be processed is divided into micro-batches (traditional data is in batches, that is, a group of data. The so-called micro-batches are smaller and more detailed groups of data), and then distributed to different server instances for data processing and target database writing. The server can be horizontally expanded according to the throughput required in the actual project. This greatly improves resource utilization and effectively guarantees the throughput and performance requirements required in the actual project.
[0165] (3) Shard the data and use an efficient data sharding algorithm to prevent data skew.
[0166] (4) Improve hardware resources, increase disk writing speed, use SSD disks, and increase network bandwidth data transmission speed.
[0167] 4. Ensure the high reliability of the data distribution system and the stability of the distribution system.
[0168] The data distribution system is deployed through a cluster. After each instance is deployed, it will be registered with the registration center. Each deployed instance reports its own keep-alive status and other source data information to the registration center. The heartbeat mechanism is used to monitor the survival of the instance. If the instance is monitored to be hung up, the script of the self-starting instance will be automatically executed immediately to start the instance to achieve high availability.
[0169] In summary, the problem of slow data connection development between business systems has been solved. Problems such as non-real-time data interaction, non-uniform data formats, inconsistent and inaccurate data in various business systems, and poor data reliability have been effectively solved. At the same time, it has also greatly improved the real-time processing capabilities of massive data, improved the quality of the company's products, increased the stability of the company's business systems, and improved customer satisfaction. It has greatly saved the company's R&D costs and created greater profits. On this basis, it provides a strong guarantee for the later construction of a big data platform, and lays a solid foundation in other aspects such as data governance, big data analysis, intelligent operation decision-making, and intelligent operation and maintenance.
[0170] It is obvious to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential features of the present invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present invention is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other units or, and the singular does not exclude the plural. Multiple units or devices stated in the system claim may also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0171] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A distributed intelligent real-time data stream distribution method, characterized in that: The method synchronously distributes the information of the source database to the target database through the data distribution system, as follows: Load data distribution system configuration and read data distribution event status information; Call the data reading connector to read the full amount of data to be distributed from the source database; if the reading fails, continue reading; if the reading succeeds, shard the read data; Compress and package the sharded data, and then distribute it to different instances for data processing; Call the data writing connector to write the processed data into the target database; Automatically switch to incremental data distribution; Monitor the log information of the source database. When the log information changes, pull the log information of the incremental data, and then perform log parsing to obtain the incremental data. The incremental data is sharded, then the sharded data is compressed and packaged, and distributed to different instances for data processing; Call the data writing connector to write the processed data to the target database.
2. A distributed intelligent real-time data stream distribution method according to claim 1, characterized in that: When the data is written into the target database, the time status of data distribution and the processed source data displacement information are written into the distributed file system.
3. A distributed intelligent real-time data stream distribution method according to claim 2, characterized in that: When an exception occurs in the source database, restart the source database, continue to generate data change log information, read the information in the distributed file system, obtain the displacement information stored at the time of the most recent failure, and continue data synchronization; and / or When an exception occurs in the data distribution system, the data distribution system is restarted, the information in the distributed file system is read, the displacement information stored at the time of the most recent failure is obtained, and data synchronization is continued; and / or When an exception occurs in the target database, the target database is restarted, the information in the distributed file system is read, the displacement information stored at the time of the most recent failure is obtained, and data synchronization continues.
4. A distributed intelligent real-time data stream distribution method according to claim 1 or 2, characterized in that: The sharding process is as follows: Specify the number of shard intervals C, specifically C1+C2+...+Cn; Specify the length of each shard interval. The specific intervals are divided into [0,L1), [L1,2L1), ..., [(C1-1)L1,C1L1), [C1L1,C1L1+L2), [C1L1+L2,C1L1+2L2), ..., where each interval corresponds to a data node; Perform a dot multiplication operation on the two arrays above to obtain the modulus, as shown in formula (1): M=C*L=C1L1+C2L2+....+C n L n ; Then, the above two arrays are cross-multiplied to obtain the number of virtual slices, as shown in formula (2): The actual virtual shard is assigned based on the value of the where condition; For each data, the result of calculation according to formula (1) is M, then the data number is modulo M, and the obtained value falls into the virtual slice calculated by formula (2); Map the divided virtual shard intervals to the computer nodes of the actual shards.
5. A distributed intelligent real-time data stream distribution method according to claim 1 or 2, characterized in that: The source database, data distribution system and target data use SSD disks.
6. A distributed intelligent real-time data stream distribution system, characterized in that: Including source database, data distribution system, target database, and registration center; The data distribution system is used to synchronize the data of the source database to the target database, and the data distribution system includes a data distribution center and a data processing center; the data processing center includes multiple data processing instances, each of which is registered in the registration center; The registration center is used to transmit the instance configuration information of the data processing center to the data distribution center, and is also used to monitor the survival of the instances of the data processing center in real time. If the instance is monitored to be hung up, the script of the self-starting instance is automatically executed immediately to start the instance; The data distribution center is used for full data distribution and incremental data distribution; when used for full data distribution, the data distribution center obtains the full data to be distributed from the source database, and then performs sharding processing on the obtained data according to the instance configuration information, compresses and packages the sharded data, and distributes it to different instances of the data processing center; when used for incremental data distribution, the data distribution center monitors the log information of the source database, and when the log information changes, pulls the log information of the incremental data, and then performs log parsing to obtain the incremental data; then, the incremental data is sharded according to the instance configuration information, and the sharded data is compressed and packaged, and distributed to different instances of the data processing center; The data processing center is used to receive the data distributed by the data distribution center and process the data; the processed data is written into the target database.
7. A distributed intelligent real-time data stream distribution system according to claim 6, characterized in that: The real-time data stream distribution system also includes a distributed file system. When the data processing center writes data into the target database, it stores the event status of data distribution and the processed source data displacement information in the distributed file system.
8. A distributed intelligent real-time data stream distribution system according to claim 7, characterized in that: When an exception occurs in the source database, restart the source database, continue to generate data change log information, read the information in the distributed file system, obtain the displacement information stored at the time of the most recent failure, and continue data synchronization; and / or When an exception occurs in the data distribution system, the data distribution system is restarted, the information in the distributed file system is read, the displacement information stored at the time of the most recent failure is obtained, and data synchronization is continued; and / or When an exception occurs in the target database, the target database is restarted, the information in the distributed file system is read, the displacement information stored at the time of the most recent failure is obtained, and data synchronization continues.
9. A distributed intelligent real-time data stream distribution system according to claim 6, characterized in that: The data distribution center processes the data fragmentation as follows: Specify the number of shard intervals C, specifically C1+C2+...+Cn; Specify the length of each shard interval. The specific intervals are divided into [0,L1), [L1,2L1), ..., [(C1-1)L1,C1L1), [C1L1,C1L1+L2), [C1L1+L2,C1L1+2L2), ..., where each interval corresponds to a data node; Perform a dot multiplication operation on the two arrays above to obtain the modulus, as shown in formula (1): M=C*L=C1L1+C2L2+....+C n L n ; Then, the above two arrays are cross-multiplied to obtain the number of virtual slices, as shown in formula (2): The actual virtual shard is assigned based on the value of the where condition; For each data, the result of calculation according to formula (1) is M, then the data number is modulo M, and the obtained value falls into the virtual slice calculated by formula (2); Map the divided virtual shard intervals to the computer nodes of the actual shards.
10. A distributed intelligent real-time data stream distribution system according to claim 6, characterized in that: The source database, data distribution system and target data use SSD disks.
