Micro-batch data acquisition and processing method and device and readable storage medium

CN118550972APending Publication Date: 2024-08-27CHINA UNITED NETWORK COMM GRP CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410688737.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

[0003]如果采用传统微批入库的方式,数据的原子性和一致性很难得以保证;数据重复这种问题可能也会影响到用户的体验,需要使用者对表进行再次加工,不可避免的增加了工作量,以及系统资源的一部分浪费

Benefits of technology

[0034] The micro-batch data collection and processing method, device and readable storage medium provided by this application specifically collect real-time data and store the real-time data in the distributed messaging system Kafka; through the real-time processing data task framework flink, the real-time data in Kafka is processed Process the real-time data to obtain the first processing result, and return the first processing result to Kafka; perform micro-batch processing on the first processing result through the big data processing engine spark, and obtain the second processing result; The second processing result is saved to the distributed file system HDFS. First of all, this application uses the computing engine big data processing engine spark to read the data of the distributed messaging system Kafka and write it into the data lake. The streaming data lake platform hudi synchronizes it to hdfs data for real-time addition, deletion and modification calculations, effectively solving the problem of distributed data. problems of atomicity and consistency, and greatly reduces the problem of resource waste; this application quickly sorts the out-of-order data of the distributed messaging system Kafka and formats the data, thus avoiding the root cause of subsequent streaming data Lake platform hudi wrong update insertion. In addition, this application decouples data source collection and analysis (analysis uses the real-time processing data task framework flink) and data writing (writing uses the big data processing engine spark/streaming data lake platform hudi) processing, making the big data processing engine spark micro The batch processing process only needs to read the data, which shortens the batch processing time; in addition, this application uses the Xingyun database as the data query engine for users to query offline data and real-time data processing results. Through the storage of distributed data patterns, the big data processing engine spark batch processing integrated data warehouse computing architecture, and the streaming data lake platform hudi heterogeneous technology stack, all offline and real-time business statistics are completed, effectively solving batch data processing, large data volume data Dealing with efficiency issues; by using Xingyun as a data query engine, we want to achieve more efficient data query and analysis, thereby improving data query efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550972A
    Figure CN118550972A
Patent Text Reader

Abstract

The invention provides a micro-batch data acquisition and processing method and device and a readable storage medium, and the method specifically comprises the steps: collecting real-time data, and storing the real-time data to a distributed message system Kafka; processing real-time data in the Kafka through a real-time processing data task framework flink to obtain a first processing result, and returning the first processing result to the Kafka; performing micro-batch processing on the first processing result through a big data processing engine spark to obtain a second processing result; and storing the second processing result to an HDFS (Hadoop Distributed File System). According to the method, the problems of atomicity and consistency of distributed data are effectively solved, and the problem of resource waste is greatly reduced; according to the method and the device, updating and insertion of a subsequent stream data lake platform hudi error are avoided from the source, the batch processing time is shortened, and the data query efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a micro-batch data acquisition and processing method, device and readable storage medium. Background Art

[0002] With the development of big data, the amount of data that each system needs to process is getting larger and larger. For models with large data volumes, databases basically use distributed systems. At this stage, for real-time micro-batch data processing with extremely large data volumes, distributed systems have bottlenecks in terms of ensuring data accuracy and timeliness, and only support data insertion, but not distributed data updates and deletions.

[0003] If the traditional micro-batch warehousing method is adopted, the atomicity and consistency of data are difficult to guarantee; the problem of data duplication may also affect the user experience, requiring the user to reprocess the table, which inevitably increases the workload and wastes some system resources.

[0004] Therefore, how to reduce resource waste in micro-batch data processing becomes a problem that needs to be solved. Summary of the invention

[0005] The technical problem to be solved by the present application is to provide a micro-batch data acquisition and processing method, device and readable storage medium in view of the above-mentioned deficiencies in the prior art, so as to solve the problems existing in the prior art.

[0006] In a first aspect, the present application provides a micro-batch data collection and processing method, the method

[0007] The law includes:

[0008] S1. Collect real-time data and store the real-time data in the distributed messaging system Kafka;

[0009] S2. Process the real-time data in Kafka through the real-time data processing task framework flink to obtain a first processing result, and return the first processing result to Kafka;

[0010] S3, performing micro-batch processing on the first processing result through the big data processing engine Spark to obtain a second processing result;

[0011] S4. Save the second processing result to the distributed file system HDFS.

[0012] In some embodiments, in S1, collecting real-time data includes:

[0013] S11. Building a data collection component based on at least one of a synchronization tool, a distributed collection tool, and a distributed messaging system Kafka message queue;

[0014] S12. Collect real-time data from at least one data source through the data collection component.

[0015] In some embodiments, S2 includes:

[0016] Based on the real-time data processing task framework flinkSQL, the real-time data in Kafka is encoded and processed, and the encoded real-time data is imported into the distributed messaging system Kafka cluster, and the first processing result includes the encoded real-time data.

[0017] In some embodiments, before S2, the method further includes:

[0018] Kafka is used to sort out the disordered real-time data to obtain real-time data arranged in chronological order.

[0019] In some embodiments, S3 includes:

[0020] Using the big data processing engine spark Streaming component, buffering the first processing result in sub-second increments to obtain buffer data;

[0021] The buffer data is batch processed as a fixed data set of a preset size to obtain micro-batch data, and the second processing result includes the micro-batch data.

[0022] In some embodiments, the distributed file system HDFS includes a streaming data lake platform hudi;

[0023] S4, including:

[0024] The second processing result is written into the streaming data lake platform hudi by at least one of insert update UPSERT, insert INSERT and write sort BULK INSERT.

[0025] In some embodiments, it also includes:

[0026] A mapping of a distributed file system HDFS is created in a distributed database, and the mapping is used to obtain corresponding query result data from the distributed file system HDFS when the distributed database receives an external query request.

[0027] In a second aspect, the present application provides a micro-batch data acquisition and processing device, the device comprising:

[0028] A data collection module, which is configured to collect real-time data and store the real-time data in a distributed messaging system Kafka;

[0029] A first processing module is configured to process the real-time data in Kafka through the real-time data processing task framework flink, obtain a first processing result, and return the first processing result to Kafka;

[0030] A second processing module is configured to perform micro-batch processing on the first processing result through a big data processing engine Spark to obtain a second processing result;

[0031] The data saving module is configured to save the second processing result to the distributed file system HDFS.

[0032] In a third aspect, the present application provides a micro-batch data acquisition and processing device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the micro-batch data acquisition and processing method described in the first aspect above.

[0033] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the micro-batch data acquisition and processing method described in the first aspect is implemented.

[0034] The micro-batch data collection and processing method, device and readable storage medium provided by the present application specifically collect real-time data and store the real-time data in the distributed message system Kafka; process the real-time data in Kafka through the real-time data processing task framework flink to obtain a first processing result, and return the first processing result to Kafka; perform micro-batch processing on the first processing result through the big data processing engine spark to obtain a second processing result; and save the second processing result to the distributed file system HDFS. First, the present application uses the computing engine big data processing engine spark to read the data of the distributed message system Kafka and write it into the data lake streaming data lake platform hudi to synchronize to the hdfs data for real-time addition, deletion and modification calculations, which effectively solves the problems of atomicity and consistency of distributed data and greatly reduces the problem of resource waste; the present application quickly sorts the disordered data of the distributed message system Kafka and formats the data, thereby avoiding the subsequent incorrect update and insertion of the streaming data lake platform hudi from the root. In addition, this application decouples the data source collection and analysis (the analysis uses the real-time data processing task framework flink) and data writing (writing uses the big data processing engine spark / streaming data lake platform hudi), so that the big data processing engine spark micro-batch processing process only needs to read data, shortening the batch processing time; in addition, this application uses the Xingyun database as a data query engine for users to query offline data and real-time data processing results. All offline and real-time business statistics are completed through the storage of distributed data models, the big data processing engine spark batch processing integrated data warehouse computing architecture, and the streaming data lake platform hudi heterogeneous technology stack, effectively solving the problems of batch data processing and large data volume data processing efficiency; using Xingyun as a data query engine is to achieve more efficient data query and analysis, thereby improving data query efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0036] Figure 1 A schematic diagram of the scheme architecture of the micro-batch data collection and processing method provided in an embodiment of the present application;

[0037] Figure 2 A schematic diagram of a micro-batch data collection and processing method provided in an embodiment of the present application;

[0038] Figure 3 A schematic diagram of the structure of a micro-batch data acquisition and processing device provided in an embodiment of the present application;

[0039] Figure 4A schematic diagram of the structure of another micro-batch data acquisition and processing device provided in an embodiment of the present application.

[0040] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0041] In order to enable those skilled in the art to better understand the technical solution of the present application, the implementation mode of the present application will be further described in detail below with reference to the accompanying drawings.

[0042] It should be understood that the specific embodiments and drawings described herein are only used to explain the present application, rather than to limit the present application.

[0043] It can be understood that, in the absence of conflict, the various embodiments in the present application and the various features in the embodiments can be combined with each other.

[0044] It can be understood that, for the convenience of description, the drawings of the present application only show the parts related to the present application, while the parts unrelated to the present application are not shown in the drawings.

[0045] It can be understood that each unit and module involved in the embodiments of the present application may correspond to only one physical structure, or may be composed of multiple physical structures, or multiple units and modules may be integrated into one physical structure.

[0046] It can be understood that the terms "first", "second", etc. in the embodiments of the present application are used to distinguish different objects, or to distinguish different processing of the same object, rather than to describe a specific order of objects.

[0047] It is understandable that, in the absence of conflict, the functions and steps marked in the flowcharts and block diagrams of the present application may occur in an order different from that marked in the drawings.

[0048] It is understood that the flowcharts and block diagrams of the present application illustrate the possible architectures, functions, and operations of the systems, devices, equipment, and methods according to the various embodiments of the present application. Among them, each box in the flowchart or block diagram may represent a unit, module, program segment, code, which contains executable instructions for implementing the specified functions. Moreover, each box or combination of boxes in the block diagram and flowchart may be implemented by a hardware-based system that implements the specified functions, or by a combination of hardware and computer instructions.

[0049] It can be understood that the units and modules involved in the embodiments of the present application can be implemented by software or hardware, for example, the units and modules can be located in a processor.

[0050] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0051] The present application provides a micro-batch data collection and processing method, the working process of which can be implemented by electronic devices, such as computers, handheld smart terminals, etc. For ease of explanation, the present application uses the computer as the method execution subject for description in each embodiment.

[0052] Figure 1 A schematic diagram of the scheme architecture of the micro-batch data collection and processing method provided in the embodiment of the present application, Figure 2 A schematic diagram of a micro-batch data collection and processing method provided in an embodiment of the present application, such as Figure 1 as well as Figure 2 As shown, the present application provides a micro-batch data acquisition and processing method, the method includes S1-S4, which are as follows:

[0053] S1. Collect real-time data and store the real-time data in the distributed messaging system Kafka;

[0054] In some embodiments, in S1, collecting real-time data includes:

[0055] S11. Building a data collection component based on at least one of a synchronization tool, a distributed collection tool, and a distributed messaging system Kafka message queue;

[0056] S12. Collect real-time data from at least one data source through the data collection component.

[0057] Specifically, first build a data collection server, install LINUX and basic software packages (distributed messaging system Kafka / distributed coordination service zookeeper), select one or more servers as high-availability servers for data processing (install real-time data processing task framework flink / big data processing engine spark / streaming data lake platform hudi) to collect data and batch process data into the warehouse, including the following:

[0058] 1. Hardware selection and configuration

[0059] Server selection: Select at least 4 servers based on data processing requirements and ensure that they have sufficient computing power and storage space.

[0060] CPU and memory: Each server is configured with at least 16GB of memory and at least 2 CPU cores.

[0061] Hard disk space: Each server is configured with at least 1TB of hard disk space for storing data and applications.

[0062] 2. Operating system installation

[0063] Operating system selection: Install the latest version of Linux operating system, such as CentOS7, on each server.

[0064] System initialization: Initialize the system, including setting the host name, time zone, network configuration, etc.

[0065] 3. Basic software package installation

[0066] Distributed messaging system Kafka / distributed coordination service zookeeper: Install the distributed messaging system Kafka and distributed coordination service zookeeper on each server to ensure that they can communicate with each other.

[0067] Real-time data processing task framework Flink / big data processing engine Spark / streaming data lake platform Hudi: Select one or more servers as high-availability servers for data processing, and install the real-time data processing task framework Flink, big data processing engine Spark, and streaming data lake platform Hudi.

[0068] 4. Data collection and batch processing

[0069] Data collection: Configure the distributed messaging system Kafka producer to collect data from data sources.

[0070] Data processing: Use the real-time data processing task framework flink or the big data processing engine spark for real-time data processing.

[0071] Data storage: The processed data is written into the hudi table of the streaming data lake platform to achieve real-time data update.

[0072] 5. System Settings

[0073] High availability: Ensure that the distributed messaging system Kafka, the distributed coordination service Zookeeper, and the streaming data lake platform Hudi service are all highly available. You can use cluster deployment or backup servers.

[0074] Monitoring and logging: Configure monitoring and logging systems to monitor server performance and application operation.

[0075] 6. Network configuration: Make sure the network between the servers is configured correctly so that they can communicate with each other.

[0076] 7. Security configuration: Configure firewalls and security groups to ensure that only authorized clients can access the server.

[0077] 8. Backup and recovery: Back up data and applications regularly and ensure they can be restored.

[0078] S2. Process the real-time data in Kafka through the real-time data processing task framework flink to obtain a first processing result, and return the first processing result to Kafka;

[0079] In some embodiments, S2 includes: encoding and processing real-time data in Kafka based on the real-time data processing task framework flinkSQL, and importing the encoded real-time data into the distributed messaging system Kafka cluster, and the first processing result includes the encoded real-time data.

[0080] In some embodiments, before S2, it also includes: sorting the disordered real-time data through Kafka to obtain real-time data arranged in chronological order.

[0081] Specifically, by quickly sorting the disordered data in the distributed messaging system Kafka and formatting the data, the subsequent incorrect update and insertion of the streaming data lake platform Hudi is avoided from the root.

[0082] S3, performing micro-batch processing on the first processing result through the big data processing engine Spark to obtain a second processing result;

[0083] In some embodiments, S3 includes: using a big data processing engine spark Streaming component to buffer the first processing result in sub-second increments to obtain buffer data; batch processing the buffer data as a fixed data set of a preset size to obtain micro-batch data, and the second processing result includes the micro-batch data.

[0084] S4. Save the second processing result to the distributed file system HDFS.

[0085] In some embodiments, the distributed file system HDFS (Hadoop Distributed File System) includes a streaming data lake platform hudi.

[0086] This application decouples data source collection and analysis (analysis uses the real-time data processing task framework flink) and data writing (writing uses the big data processing engine spark / streaming data lake platform hudi) processing, so that the big data processing engine spark micro-batch processing process only needs to read data, shortening the batch processing time.

[0087] Optionally, S4 includes: writing the second processing result to the streaming data lake platform hudi by at least one of insert update UPSERT, insert INSERT and write sort BULK INSERT.

[0088] Among them, UPSERT: The default behavior, data is first marked by index (INSERT / UPDATE), and there are some heuristic algorithms to determine the organization of messages to optimize the file size.

[0089] INSERT: Skip the index to achieve higher writing efficiency.

[0090] BULK INSERT: write sorting, friendly to Hudi table initialization with large data volumes, and bestefort the file size limit (write HFile).

[0091] Specifically, based on the real-time data processing task framework flinkSQL, the real-time data in the message collection is encoded and processed, and the encoded real-time data is imported into the distributed message system Kafka cluster, and the data is converted into unified plaintext data. After parsing, the data streaming data lake platform hudi scahme is developed, and then the streaming data lake platform hudi format is converted back and written into the distributed message system Kafka. Specifically, the following contents are included:

[0092] 1. Configure the flinkSQL environment for real-time data processing task framework

[0093] Configuration of the flink cluster of the real-time data processing task framework: Ensure that the flink cluster of the real-time data processing task framework has been set up, including the configuration of the JobManager and TaskManager.

[0094] Real-time data processing task framework flinkSQL dependency: Add the real-time data processing task framework flinkSQL dependency in the real-time data processing task framework flink environment to ensure that the real-time data processing task framework flink can support SQL queries.

[0095] 2. Define the real-time data processing task framework flinkSQL query

[0096] Message collection processing: Write flinkSQL queries for the real-time data processing task framework to process real-time data in message collections.

[0097] Encoding conversion: Define the encoding conversion logic in the real-time data processing task framework flinkSQL query to encode the original data into plain text data in a unified format.

[0098] 3. Import data into the distributed messaging system Kafka cluster

[0099] Distributed messaging system Kafka connection configuration: Configure the distributed messaging system Kafka connection to ensure that the real-time data processing task framework flinkSQL can communicate with the distributed messaging system Kafka cluster.

[0100] Data import: Execute the flinkSQL query of the real-time data processing task framework to import the encoded data into the distributed messaging system Kafka cluster.

[0101] 4. Data streaming data lake platform hudi format development

[0102] Streaming data lake platform hudi table definition: Define the table structure in the streaming data lake platform hudi, including primary key, partition key, etc.

[0103] Data parsing: Define data parsing logic in the real-time data processing task framework flinkSQL query to parse plain text data into the hudi table structure of the streaming data lake platform.

[0104] 5. The streaming data lake platform is converted back into hudi format and written into the distributed messaging system Kafka

[0105] Streaming Data Lake Platform Hudi Operations: Define streaming data lake platform hudi operations in the real-time data processing task framework flinkSQL query, including Upsert, Insert, and Bulk_Insert.

[0106] Data writing: Execute the flinkSQL query of the real-time data processing task framework to write the formatted data into the distributed messaging system Kafka cluster.

[0107] 6. Monitoring and Optimization

[0108] Monitoring indicators: monitor key indicators in the data processing process, such as processing speed, error rate, etc.

[0109] Performance optimization: Optimize the flinkSQL query of the real-time data processing task framework based on the monitoring results to improve data processing efficiency.

[0110] Optionally, in this application, data landing is built at the data warehouse level, that is, Hadoop distributed storage is used as the base, distributed messaging system Kafka is used as data middleware, combined with the real-time data processing task framework flink streaming computing engine, big data processing engine spark micro-batch memory computing engine, streaming data lake platform hudi to perform Upsert real-time data updates, and the streaming data lake platform hudi is transformed to achieve field completion, specifically including the following:

[0111] 1. Data storage architecture design

[0112] Hadoop distributed storage: Choose Hadoop distributed storage system as the basis for data storage, such as HDFS.

[0113] Data partitioning and replication: Design data partitioning strategies and the number of replicas based on data characteristics and access requirements to improve the reliability of data storage.

[0114] 2. Distributed messaging system Kafka as data middleware

[0115] Topic design: Design the distributed messaging system Kafka topic for communication between data collection and stream processing.

[0116] Data serialization: Ensure that the data serialization format in the distributed messaging system Kafka topic is compatible with subsequent processing flows.

[0117] 3. Real-time data processing task framework flink streaming computing engine

[0118] Real-time data processing: Use the streaming processing capabilities of the real-time data processing task framework Flink to filter, transform, and aggregate real-time data.

[0119] State management: Configure the state backend of the real-time data processing task framework Flink to ensure the reliability of data processing.

[0120] 4. Big data processing engine Spark micro-batch memory computing engine

[0121] Data buffering: Use the Streaming component of the big data processing engine Spark to buffer the data in the distributed messaging system Kafka topic.

[0122] Batch processing logic: Define batch processing logic in the buffer, such as data cleaning, feature extraction, etc.

[0123] 5. Streaming data lake platform hudi updates data in real time

[0124] Data lake technology: Use the streaming data lake platform hudi as data lake technology to achieve real-time data updates.

[0125] Upsert operation: supports data Upsert operation to ensure the latest status of data.

[0126] 6. Streaming Data Lake Platform Hudi Field Completion

[0127] Data integrity: Complete the fields in the hudi table of the streaming data lake platform to ensure data integrity.

[0128] Data verification: Implement data verification mechanism to ensure data accuracy.

[0129] 7. Monitoring and Optimization

[0130] Performance monitoring: monitor key indicators in the data processing process, such as processing speed, error rate, etc.

[0131] Performance optimization: Optimize the data processing process according to the monitoring results to improve the efficiency of data processing.

[0132] Optionally, in this application, the distributed messaging system Kafka produces a message for each correct consumption of a piece of data, and parses it to the corresponding topic, and sorts the out-of-order data, so that the subsequent streaming data lake platform hudi can implement the functions of UPSERT (insert update), INSERT (insert) and BULKINSERT (write sort). The big data processing engine spark Streaming will then buffer the stream in sub-second increments, and then these buffers will be batch processed as small-scale fixed data sets, including the following:

[0133] 1. Distributed messaging system Kafka data consumption and message production

[0134] Consumer configuration: Configure consumers in the distributed messaging system Kafka to ensure that they can consume data correctly.

[0135] Message production: Every time a consumer correctly consumes a piece of data, it produces a message and parses it into the corresponding topic.

[0136] 2. Data sorting and buffering

[0137] Message sorting: Sort out-of-order data to ensure they are arranged in chronological order.

[0138] Buffer design: Use the big data processing engine spark Streaming component to buffer the stream in sub-second increments.

[0139] 3. Dataset batch processing

[0140] Buffer management: The buffer management of the big data processing engine Spark Streaming ensures the orderliness and integrity of the data.

[0141] Batch processing logic: Define batch processing logic, including data cleaning, feature extraction, etc.

[0142] 4. Data writing and updating

[0143] Streaming data lake platform hudi operations: Use the streaming data lake platform hudi to perform data UPSERT (insert update), INSERT (insert) and BULKINSERT (write sort) operations.

[0144] Data synchronization: ensures real-time update of data in the hudi table of the streaming data lake platform.

[0145] 5. Monitoring and Optimization

[0146] Performance monitoring: monitor key indicators in the data processing process, such as processing speed, error rate, etc.

[0147] Performance optimization: Optimize the data processing process according to the monitoring results to improve the efficiency of data processing.

[0148] 6. Data consistency

[0149] Data consistency check: Ensure data accuracy and consistency to prevent data loss or corruption.

[0150] Optionally, in this application, in terms of writing data into HDFS, the streaming data lake platform hudi method is adopted. The streaming data lake platform hudi designs HoodieKey, which is similar to a primary key. HoodieKey has Min / Max statistics and BloomFilter, which is used to quickly locate the file where the Record is located.

[0151] When doing Upserts, if HoodieKey does not exist in BloomFilter, then insert is performed; otherwise, confirm whether HoodieKey actually exists. If so, then update is performed.

[0152] The following is the workflow of the streaming data lake platform hudi when performing Upserts (i.e. updates and inserts):

[0153] 1. Generation of HoodieKey:

[0154] The streaming data lake platform hudi generates a HoodieKey for each record. This key is composed of multiple fields, and each field is the key information of the record.

[0155] HoodieKey usually contains the primary key field and other fields used to distinguish records, such as timestamps.

[0156] 2. Use of BloomFilter:

[0157] The streaming data lake platform hudi uses BloomFilter to quickly determine whether HoodieKey exists in the data lake.

[0158] BloomFilter is a probabilistic data structure that can quickly determine whether an element exists in a collection without traversing the entire collection.

[0159] BloomFilter is used to quickly locate the file where the record is located, thereby reducing disk I / O operations.

[0160] 3.Upserts operation:

[0161] When performing an Upserts operation, the streaming data lake platform hudi first checks whether the HoodieKey exists in the BloomFilter.

[0162] If HoodieKey does not exist in BloomFilter, it means that the record is not in the data lake, and the streaming data lake platform hudi will perform an insert operation to write the new record to the data lake.

[0163] If HoodieKey exists in BloomFilter, the streaming data lake platform hudi needs to confirm whether HoodieKey actually exists in the data lake.

[0164] If HoodieKey does exist in the data lake, the streaming data lake platform hudi will perform an update operation to update the value of the new record to the data lake.

[0165] If HoodieKey does not exist, the streaming data lake platform hudi will ignore this operation to avoid writing erroneous records.

[0166] Through HoodieKey, BloomFilter and Upserts operations, the streaming data lake platform hudi achieves efficient record positioning and updating, thereby improving the efficiency of data writing to HDFS. This design not only reduces disk I / O operations, but also improves the real-time and accuracy of data processing.

[0167] Optionally, in this application, the streaming data lake platform hudi is used to assist in data management, the data is stored with the help of the HDFS file system, and the big data processing engine spark Streaming is used to operate the data for micro-batch processing, with a batch processing time of once every 5 minutes.

[0168] The following is the workflow of the streaming data lake platform hudi streaming data lake platform:

[0169] 1. Data collection and processing:

[0170] Data is collected through various data sources (such as distributed messaging systems Kafka, Apache NiFi, etc.) to the streaming data lake platform hudi streaming data lake platform.

[0171] Before entering the streaming data lake platform hudi, data can be micro-batch processed through the big data processing engine sparkStreaming.

[0172] The big data processing engine Spark Streaming buffers the stream in sub-second increments and then batches the data in the buffer as small, fixed data sets.

[0173] 2. Data writing and storage:

[0174] The micro-batch data processed by the big data processing engine spark Streaming is written to the HDFS file system.

[0175] The streaming data lake platform hudi uses HoodieKey and BloomFilter technologies to achieve efficient data positioning and updating.

[0176] For a new record, if the HoodieKey does not exist in the BloomFilter, an insert operation is performed.

[0177] For existing records, if the HoodieKey exists in the BloomFilter, an update operation is performed.

[0178] The streaming data lake platform hudi supports ACID transactions to ensure data consistency and integrity.

[0179] 3. Batch processing time interval:

[0180] The batch processing time interval can be set according to business needs.

[0181] In this example, the batch processing interval is set to 5 minutes. - Every 5 minutes, the big data processing engine sparkStreaming batches the data in the buffer and writes the processed data to HDFS.

[0182] In some embodiments, it also includes: creating a mapping of the distributed file system HDFS in the distributed database, wherein the mapping is used to obtain corresponding query result data from the distributed file system HDFS when the distributed database receives an external query request.

[0183] Specifically, the distributed database Xingyun database is used as an example for explanation. In this application, in order to solve the compatibility problem between Xingyun and the hudi table of the streaming data lake platform (the problem of multiple versions of hudi on the streaming data lake platform), the hudi table of the Xingyun streaming data lake platform is created, and the HDFS path is mapped to ensure that the latest version of the data is accessed, and finally the latest version of the data on the HDFS path is queried, which specifically includes the following contents:

[0184] 1. Create the hudi table of Xingyun streaming data lake platform:

[0185] Create a streaming data lake platform hudi table in the Xingyun system and ensure that it is consistent with the table structure in the streaming data lake platform hudi data lake.

[0186] Define the primary key and index of the table so that data can be quickly located and queried.

[0187] 2. Map the HDFS path:

[0188] Ensure that the Xingyun system can access the hudi table of the streaming data lake platform on HDFS.

[0189] Create a mapping to map the streaming data lake platform hudi table path on HDFS to the table path in the Xingyun system.

[0190] 3. Data synchronization:

[0191] Regularly synchronize the streaming data lake platform hudi table on HDFS to the table in the Xingyun system.

[0192] You can use the SyncAPI of the streaming data lake platform hudi or scheduled tasks to perform synchronization operations.

[0193] 4. Data query:

[0194] When querying data in the Xingyun system, make sure that you are querying the mapped streaming data lake platform hudi table path.

[0195] When querying, the Xingyun system will directly access the hudi table of the streaming data lake platform on HDFS to obtain the latest version of data.

[0196] 5. Version Control:

[0197] The streaming data lake platform Hudi supports multi-version data, and the Xingyun system needs to be able to process these multi-version data.

[0198] The query logic in the Xingyun system needs to be able to handle different versions of records and ensure data consistency.

[0199] 6. Exception handling:

[0200] During the data synchronization process, you may encounter abnormal situations, such as network problems or inaccessible hudi tables on the streaming data lake platform.

[0201] A corresponding exception handling mechanism is needed to ensure the stability of the system and the reliability of the data.

[0202] 7. Performance optimization:

[0203] According to the query performance requirements, the hudi table of the streaming data lake platform is optimized, such as adding indexes and adjusting partition strategies.

[0204] Regularly monitor and adjust to ensure query performance.

[0205] This application uses a distributed database (such as Xingyun) as a data query engine, and solves the compatibility issues between the distributed database (such as Xingyun) and the hudi table of the streaming data lake platform (the problem of multiple versions of the hudi of the streaming data lake platform), ensuring that the database accesses the latest version of the data of the hudi of the streaming data lake platform.

[0206] The present application provides a micro-batch data collection and processing method. The present application uses a synchronization tool, a distributed collection tool, and a distributed messaging system Kafka message queue to form the target data collected by the data collection module. The real-time data processing task framework flink processes the data of the source distributed messaging system Kafka and reasonably sorts the disordered data, and performs a series of transcoding and parsing operations; finally, the micro-batch processing results are output to the distributed messaging system Kafka cluster.

[0207] First, this application uses the computing engine big data processing engine spark to read the data of the distributed messaging system Kafka and write it into the data lake streaming data lake platform hudi to synchronize the data to hdfs for real-time addition, deletion and modification calculations, which effectively solves the atomicity and consistency problems of distributed data and greatly reduces the problem of resource waste; this application quickly sorts the disordered data of the distributed messaging system Kafka and formats the data, thereby fundamentally avoiding the subsequent incorrect update and insertion of the streaming data lake platform hudi.

[0208] In addition, this application decouples data source collection and analysis (analysis uses the real-time data processing task framework flink) and data writing (writing uses the big data processing engine spark / streaming data lake platform hudi) processing, so that the big data processing engine spark micro-batch processing process only needs to read data, shortening the batch processing time

[0209] In addition, this application uses Xingyun database as a data query engine for users to query offline data and real-time data processing results. All offline and real-time business statistics are completed through the storage of distributed data mode, the big data processing engine Spark batch processing integrated data warehouse computing architecture and the streaming data lake platform Hudi heterogeneous technology stack, which effectively solves the problems of batch data processing and large data processing efficiency; by using Xingyun as a data query engine, more efficient data query and analysis are achieved, thereby improving data query efficiency.

[0210] It should be understood that, although the various steps in the flowcharts in the above-described embodiments are sequentially displayed according to the indications of the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and they can be executed in other orders. Moreover, at least a portion of the steps in the figure may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily to be carried out sequentially, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0211] Figure 3 A schematic diagram of a micro-batch data acquisition and processing device provided in an embodiment of the present application, such as Figure 3 As shown, the present application provides a micro-batch data acquisition and processing device, the device comprising:

[0212] A data collection module 11, which is configured to collect real-time data and store the real-time data in a distributed messaging system Kafka;

[0213] A first processing module 12 is configured to process the real-time data in Kafka through the real-time data processing task framework flink, obtain a first processing result, and return the first processing result to Kafka;

[0214] A second processing module 13, which is configured to perform micro-batch processing on the first processing result through a big data processing engine Spark to obtain a second processing result;

[0215] The data saving module 14 is configured to save the second processing result to a distributed file system HDFS.

[0216] Regarding the limitation of the micro-batch data acquisition and processing device, reference may be made to the limitation of the micro-batch data acquisition and processing method in the above-mentioned embodiments of the present application, which will not be elaborated in this embodiment.

[0217] Figure 4 Another schematic diagram of the micro-batch data acquisition and processing device provided in the embodiment of the present application is as follows: Figure 4 As shown, in some embodiments, the present application provides a micro-batch data acquisition and processing device, including a memory 22 and a processor 21, the memory stores a computer program, and the processor is configured to run the computer program to execute the micro-batch data acquisition and processing method in the above-mentioned embodiments of the present application.

[0218] The memory is connected to the processor, the memory may be a flash memory or a read-only memory or other memory, and the processor may be a central processing unit or a single-chip microcomputer.

[0219] In some embodiments, the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the micro-batch data acquisition and processing method in the above-mentioned embodiments of the present application is implemented.

[0220] The computer-readable storage medium includes volatile or non-volatile, removable or non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, computer program modules or other data). Computer-readable storage media include, but are not limited to, RAM (Random Access Memory), ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable read only memory), flash memory or other memory technology, CD-ROM (Compact Disc Read-Only Memory), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer.

[0221] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present application, but the present application is not limited thereto. For those skilled in the art, various modifications and improvements can be made without departing from the spirit and substance of the present application, and these modifications and improvements are also considered to be within the scope of protection of the present application.

Claims

1. A micro-batch data collection and processing method, characterized in that: The method comprises: S1. Collect real-time data and store the real-time data in the distributed messaging system Kafka; S2. Process the real-time data in Kafka through the real-time data processing task framework flink to obtain a first processing result, and return the first processing result to Kafka; S3, performing micro-batch processing on the first processing result through the big data processing engine Spark to obtain a second processing result; S4. Save the second processing result to the distributed file system HDFS.

2. The micro-batch data acquisition and processing method according to claim 1, characterized in that: In S1, real-time data is collected, including: S11. Building a data collection component based on at least one of a synchronization tool, a distributed collection tool, and a distributed messaging system Kafka message queue; S12. Collect real-time data from at least one data source through the data collection component.

3. The micro-batch data acquisition and processing method according to claim 1, characterized in that: S2, including: Based on the real-time data processing task framework flinkSQL, the real-time data in Kafka is encoded and processed, and the encoded real-time data is imported into the distributed messaging system Kafka cluster, and the first processing result includes the encoded real-time data.

4. The micro-batch data acquisition and processing method according to claim 1, characterized in that: Before S2, it also included: Kafka is used to sort out the disordered real-time data to obtain real-time data arranged in chronological order.

5. The micro-batch data acquisition and processing method according to claim 1, characterized in that: S3, including: Using the big data processing engine spark Streaming component, buffering the first processing result in sub-second increments to obtain buffer data; The buffer data is batch processed as a fixed data set of a preset size to obtain micro-batch data, and the second processing result includes the micro-batch data.

6. The micro-batch data acquisition and processing method according to claim 1, characterized in that: The distributed file system HDFS includes a streaming data lake platform hudi; S4, including: The second processing result is written into the streaming data lake platform hudi by at least one of insert update UPSERT, insert INSERT and write sort BULK INSERT.

7. The micro-batch data acquisition and processing method according to any one of claims 1 to 6, characterized in that: Also includes: A mapping of a distributed file system HDFS is created in a distributed database, and the mapping is used to obtain corresponding query result data from the distributed file system HDFS when the distributed database receives an external query request.

8. A micro-batch data acquisition and processing device, characterized in that: The device comprises: A data collection module, which is configured to collect real-time data and store the real-time data in a distributed messaging system Kafka; A first processing module is configured to process the real-time data in Kafka through the real-time data processing task framework flink, obtain a first processing result, and return the first processing result to Kafka; A second processing module is configured to perform micro-batch processing on the first processing result through a big data processing engine Spark to obtain a second processing result; The data saving module is configured to save the second processing result to the distributed file system HDFS.

9. A micro-batch data acquisition and processing device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the micro-batch data acquisition and processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the micro-batch data acquisition and processing method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Session recommendation system based on graph algorithm

    CN116485496A