Big data platform
By using HDFS direct writing technology and regular refresh metadata mechanism on the big data platform to achieve real-time writing, combined with full and incremental defragmentation and query acceleration of the Impala engine, the real-time insufficiency of traditional databases in massive data processing is solved. problem, realizing the real-time data update and fast query capabilities of the big data platform.
Patent Information
- Application Number
- CN202410914194.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-09
- Publication Date
- 2024-10-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional databases are difficult to handle real-time writing and querying of massive data in industrial Internet scenarios, and big data platforms have shortcomings in real-time performance and cannot meet the requirements for massive data storage.
A big data platform is designed that uses HDFS direct writing technology and a regular refresh metadata mechanism to achieve real-time writing. It also solves the problem of file fragmentation and metadata explosion through full and incremental data defragmentation mechanisms. It combines MPP architecture and memory computing. Impala engine performs query acceleration.
It realizes the real-time data update and query functions of the big data platform, improves data writing and query performance, breaks the contradiction between data scale and real-time performance, and supports real-time processing and fast query of massive data.
Smart Images

Figure CN118760707A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data storage technology, and in particular to a big data platform. Background Art
[0002] In the industrial Internet scenario, various devices and sensors generate massive amounts of data in real time, including the operating status of production equipment, environmental monitoring data, energy consumption information, and product quality data. This type of data has two major characteristics:
[0003] 1) Large amount of data: Data is generated every minute and every second, and the amount of data continues to increase over time.
[0004] 2) Real-time: real-time processing, storage and query are required.
[0005] The amount of data is so large that traditional databases are unable to cope with it, and big data platforms are needed. However, real-time performance is a shortcoming of big data platforms:
[0006] Real-time writing and query capabilities Data Capacity Traditional database Strong, millisecond-level write and query Small, not easy to expand Big Data Platform Weak, generally batch write, T+1 query, Large, horizontally scalable
[0007] The traditional database cluster version solution has the following disadvantages:
[0008] 1) The number of cluster data nodes has an upper limit. Generally, about 10 data nodes will reach the bottleneck, and horizontal expansion cannot be achieved. The support for data capacity is still limited.
[0009] 2) The cluster version of traditional databases is generally not open source, but private commercial version, which is expensive and has the risk of technology lock-in.
[0010] The solution of using two sets of technologies for hot and cold data has the following disadvantages:
[0011] 1) The architecture is complex and requires maintenance of two different systems, resulting in high technical and personnel costs.
[0012] 2) Only real-time query support is provided for near-line data. For historical data, the focus is mainly on storage and archiving, and query support is insufficient.
[0013] However, if a big data platform is used, only T+1 queries can be performed, and if traditional database technology is used, it will not be able to support the storage requirements of massive data.
[0014] Specifically, the core capability of the big data platform is the storage and processing of large-scale data, mainly historical data, and real-time performance is not the main consideration. Therefore, the big data platform is mainly in T+1 batch processing mode, that is, processing the data of the whole day yesterday at this morning. There are two non-real-time points implied in this: 1) Data writing is not real-time, and it is necessary to wait until all the data of the day is generated, and then import and process it in batches; 2) Data query is not real-time, T+1 mode, and the data generated on the previous day can only be viewed on the next day. Summary of the invention
[0015] The purpose of the present invention is to provide a big data platform to solve at least one of the above-mentioned technical problems.
[0016] The present invention provides the following scheme:
[0017] According to one aspect of the present invention, a big data platform is provided, the big data platform comprising a real-time writing module, wherein the real-time writing module comprises:
[0018] An acquisition module, which is used to acquire the data to be stored transmitted by the KafKa queue;
[0019] A cache module, the cache module is used to cache the data to be stored according to the data time;
[0020] A transmission module, which is used to commit the cached data to the corresponding HDFS partition according to preset conditions;
[0021] The Hive metadata update module is used to update metadata regularly.
[0022] Optionally, the big data platform further includes:
[0023] A file fragmentation processing module includes a full data defragmentation module, and the full data defragmentation module is used to defragment all existing time series data on the big data platform.
[0024] Optionally, the file fragmentation processing module further includes:
[0025] An incremental data defragmentation module is used to defragment the time series data on a preset data partition on a preset date.
[0026] Optionally, the big data platform further includes:
[0027] A query acceleration module, which is used to query the data in the big data platform according to the query request. The query acceleration module is based on the MPP architecture and the Impala engine of memory computing, manages metadata through the metadata service of Hive, and performs queries through the Impala online engine.
[0028] Optionally, acquiring the spectral data to be identified according to the first spectral data and the second spectral data includes:
[0029] A cross-correlation calculation is performed on the first spectral data and the second spectral data, so as to obtain spectral data to be identified.
[0030] Optionally, caching the data to be stored according to the data time includes:
[0031] Obtaining time information of data to be stored;
[0032] Acquire a partition cache database, wherein the partition cache database includes at least one preset time and a cache partition corresponding to each preset date;
[0033] Obtaining a cache partition corresponding to a preset time that is the same as the time information;
[0034] Store the data to be stored in the corresponding cache partition.
[0035] Optionally, the preset conditions include:
[0036] It is determined whether the size of the data stored in the cache partition exceeds a first threshold, and if so, cache is performed.
[0037] Optionally, the preset conditions further include:
[0038] It is determined whether the event of data being stored in the cache partition exceeds a second threshold, and if so, cache is performed.
[0039] Optionally, the incremental data defragmentation module is used to perform defragmentation after each transmission module operates.
[0040] The big data platform of this application realizes real-time writing of offline platforms by setting up a real-time writing module, through HDFS direct writing technology + regular metadata refresh mechanism, thereby realizing the functions of real-time data updating and retrieval on the big data platform. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is a platform schematic diagram of the big data platform in one embodiment of the present application.
[0042] Figure 2 yes Figure 1The working diagram of the real-time writing module of the big data platform is shown.
[0043] Figure 3 yes Figure 1 The diagram shows the working process of the full data defragmentation module of the big data platform.
[0044] Figure 4 This is the effect of using the full data defragmentation module to defragment data.
[0045] Figure 5 This is the effect of using the full data defragmentation module to defragment data.
[0046] Figure 6 This is the effect of using the full data defragmentation module to defragment data.
[0047] Figure 7 yes Figure 1 The structure diagram of the query acceleration module of the big data platform shown in FIG. DETAILED DESCRIPTION
[0048] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not 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.
[0049] like Figure 1 The big data platform shown includes a real-time writing module, wherein the real-time writing module includes an acquisition module, a cache module, a transmission module and a Hive metadata update module, wherein:
[0050] The acquisition module is used to obtain the data to be stored transmitted by the KafKa queue;
[0051] The cache module is used to cache the data to be stored according to the data time;
[0052] The transmission module is used to commit the cached data to the corresponding HDFS partition according to preset conditions;
[0053] The Hive metadata update module is used to update metadata periodically.
[0054] The big data platform of this application realizes real-time writing of offline platforms by setting up a real-time writing module, through HDFS direct writing technology + regular metadata refresh mechanism, thereby realizing the functions of real-time data updating and retrieval on the big data platform.
[0055] In the existing technology, due to its batch processing and bounded nature, the native big data platform must pre-collect all real-time data within a day, store it in persistent storage (such as a file system), and then import it as a whole in batches of one day.
[0056] This application does not require this step, but directly connects to the real-time data queue and imports in real time. Data does not need to be pre-batch by day, but only needs to flow in continuously. The real-time write module will automatically route to different caches and target partitions based on the data timestamp.
[0057] In this embodiment, the big data platform further includes:
[0058] A file fragmentation processing module includes a full data defragmentation module, and the full data defragmentation module is used to defragment all existing time series data on the big data platform.
[0059] In this embodiment, the file fragment processing module further includes:
[0060] An incremental data defragmentation module is used to defragment the time series data on a preset data partition on a preset date.
[0061] In this embodiment, the big data platform further includes:
[0062] A query acceleration module, which is used to query the data in the big data platform according to the query request. The query acceleration module is based on the MPP architecture and the Impala engine of memory computing, manages metadata through the metadata service of Hive, and performs queries through the Impala online engine.
[0063] In this embodiment, acquiring the spectral data to be identified according to the first spectral data and the second spectral data includes:
[0064] A cross-correlation calculation is performed on the first spectral data and the second spectral data, so as to obtain spectral data to be identified.
[0065] In this embodiment, caching the data to be stored according to the data time includes:
[0066] Obtaining time information of data to be stored;
[0067] Acquire a partition cache database, wherein the partition cache database includes at least one preset time and a cache partition corresponding to each preset date;
[0068] Obtaining a cache partition corresponding to a preset time that is the same as the time information;
[0069] Store the data to be stored in the corresponding cache partition.
[0070] In this embodiment, the preset conditions include:
[0071] It is determined whether the size of the data stored in the cache partition exceeds a first threshold, and if so, cache is performed.
[0072] In this embodiment, the preset conditions further include:
[0073] It is determined whether the event of data stored in the cache partition exceeds a second threshold, and if so, cache is performed. In this embodiment, the incremental data defragmentation module is used to perform defragmentation after each transmission module works.
[0074] The various parts of the big data platform of the present application are described in detail below by way of examples. It should be understood that the examples do not constitute any limitation to the present application.
[0075] See also Figure 1 as well as Figure 2 In this embodiment, the transmission module of the present application adopts streaming real-time writing, thereby improving the real-time performance of data.
[0076] In this embodiment, the SQL-based Hive writing is changed to direct writing to the data partition of HDFS to improve the writing performance.
[0077] In the prior art, the native writing method of the traditional big data platform is to write through the Hive JDBC interface, that is, through the Insert statement of the SQL language. The processing link is very long and the delay is also very high.
[0078] The writing of this application does not require a lengthy SQL link, but is based on the research and understanding of the storage location and file format of the data files of the Hive data table on the HDFS distributed file system, and directly writes the data to the corresponding data file of the data table on HDFS.
[0079] In this embodiment, metadata is updated regularly through a timing mechanism, so that the metadata module can perceive the latest data updated in real time. The HDFS direct write algorithm is the key to achieving real-time writing. Considering the possible disorder of real-time data, it is necessary to map it to the partition cache according to the data timestamp, while taking into account the "write and check" requirement and file fragmentation problems. For example, the data sent may have data for the day, the previous day, or even several days ago due to data hysteresis, upstream delayed transmission, etc. At this time, it is necessary to map it to the partition cache according to the data timestamp.
[0080] Specifically, direct writing to HDFS is at the data level and the metadata (data table) level. The metadata module of the big data platform must be aware of the new partitions and data at the same time.
[0081] This application uses a timing mechanism (half an hour interval) to call the "metadata synchronization" command of the metadata module in units of data tables to keep the records in the metadata consistent with the actual data directory. The core command is: MSCK REPAIRTABLE<table_name> .
[0082] In this embodiment, the specific process of the real-time writing module is as follows:
[0083] When real-time data arrives, the real-time write component routes it to the corresponding partition cache based on the data's own time information.
[0084] To avoid fragmented writes, the partition cache is accumulated to the ideal file size (at least 32M) for the big data platform before being committed to the corresponding HDFS partition.
[0085] At the same time, in order to ensure that the data is read by the consumer in time, there is also a timeout mechanism. When the data cache exceeds 30 minutes, it will also be committed to HDFS. In this way, the system can ensure that the written data can be accessed within 30 minutes, ensuring real-time performance.
[0086] The characteristics of real-time data are that the data arrival rate is unstable, and most of the time the data is sparse, with only a small amount of data arriving within 30 minutes, which will generate a large number of fragmented files. This solution has a dedicated file fragmentation processing module to solve the data file fragmentation and metadata explosion problems caused by the access of real-time data to the big data platform.
[0087] In this embodiment, when real-time data arrives, the real-time write component will route it to the corresponding partition cache according to the time information of the data itself. Although in theory real-time data is the current data of the day, some fault-tolerant scenarios should be considered in system design: the arrival of individual data may be delayed due to special reasons, for example, yesterday's data arrived today. In addition, the upstream of the system may not be able to keep up with the processing capacity, so the real-time data is saved first and then processed later. These situations may cause the data received by this system to not be the data of the day.
[0088] To avoid fragmented writes, the partition cache is committed to the corresponding HDFS partition when it accumulates to the ideal file size (at least 32M) for the big data platform.
[0089] In order to ensure that the data is read by the consumer in time, there is also a timeout mechanism. When the data cache exceeds 30 minutes, it will be committed to HDFS. In this way, the system can ensure that the written data can be accessed within 30 minutes, ensuring real-time performance.
[0090] In this embodiment, the big data platform must prevent file fragmentation problems. Because a large number of small files will significantly reduce the system performance and management efficiency of HDFS. Each file has metadata overhead in the distributed file system. Managing a large number of small files will make the storage and retrieval of metadata complicated, increasing the burden on the file system. The operation efficiency of reading and writing small files is low, and frequent I / O operations will consume a lot of system resources and prolong data processing time. In addition, metadata explosion will significantly increase the memory consumption of HDFS Namenode, which may lead to system instability and crash risks.
[0091] To address the file fragmentation and metadata explosion problems caused by real-time data, this solution proposes a dual protection mechanism of "full data defragmentation + incremental data defragmentation".
[0092] See also Figure 4 In this embodiment, full defragmentation is to defragment all existing time series data on the big data platform, which is time-consuming and generally only needs to be executed once. Subsequent fragments of new data are processed through an incremental mechanism.
[0093] Overall, it is divided into four steps: Report->Plan->Executue->Review (optional).
[0094] Scan fragmentation status: Scan all data partitions on the big data platform in units of data tables to count fragmentation status. Mainly count two basic indicators: a) the number of files in the partition and b) the total amount of data in the partition. Generate a statistical report for each table in the reports directory (see Figure 5 ).
[0095] Generate execution plan: According to the statistical results of the statistical report, determine the partitions that need to be defragmented. The judgment rule is: the number of files in the partition is greater than or equal to 50 and the average file size of the partition is less than 32M (see Figure 6 ).
[0096] At the same time, an execution plan is generated for the partitions that need to be sorted, and placed in the plans directory. The content of a table sorting plan file is as follows: Figure 7 shown.
[0097] Execute: Execute the generated execution plan. Specifically, call the Hive client to execute the finishing script for each table. The following are some code snippets:
[0098]
[0099] Comparison of sorting results: After the sorting is completed, the total number of files on the big data platform is scanned again and compared with the number before the sorting to evaluate the sorting effect.
[0100] In this embodiment, the full data fragmentation solves the problem of existing data fragmentation. However, new real-time data flows into the system every day, and this part of the data also has fragmentation problems. We cannot wait until the fragmentation problem accumulates to a certain extent before calling the full mechanism again, but we must sort out the incremental data in a timely manner. The overall principles of the incremental mechanism and the full mechanism are the same, the difference is:
[0101] 1) During the scanning phase, only the data partitions of a specific date are scanned, and only a statistical report of the incremental data of a specific date is generated. The execution plan generated subsequently is also based on this, and the total amount is much smaller.
[0102] 2) The incremental mechanism needs to be executed regularly on a daily basis, with the date of the day as a parameter. In order to avoid conflicts with the data written in real time on the day, a two-day gap is reserved, that is, the data of the day before yesterday is sorted out today.
[0103] In this embodiment, the default query engine of the big data platform is the offline MapReduce engine. The processes involved in the MapReduce job are all started offline after the query request is submitted (resources are applied for first, and then the process is started). In addition, MapReduce uses disk as the medium for data exchange during execution, and there are a large number of temporary data IO operations. The advantage of MapReduce is that it takes up less memory, but the disadvantage is that it has high latency and is not suitable for real-time data queries. For this reason, this solution transforms the query of the native big data platform and introduces the Impala engine based on MPP architecture and in-memory computing, bypassing the traditional offline Hive / MapReduce engine and only using Hive's metadata service to manage metadata. The query is supported by the Impala online engine.
[0104] Specifically, the modified framework can be found in Figure 7 In order to adapt to real-time data query, this solution has made the following changes to the query architecture of the native big data platform:
[0105] 1) Introduce the online query engine Impala based on in-memory computing to replace the default offline MapReduce engine.
[0106] 2) Keep the metadata management module of Hive and introduce a metadata synchronizer to synchronize the metadata of the latest data to Impala regularly to ensure that Impala can perceive and query the latest data.
[0107] In the existing technology, the query process of the native big data platform is:
[0108] 1) HiveServer receives the SQL request, parses the SQL, and converts it into a MapReduce execution plan
[0109] 2) Apply for CPU and memory resources for MapReduce jobs
[0110] 3) Start the Map task in the MapReduce job first, and write the intermediate results to the HDFS temporary directory
[0111] 4) Start the Reduce task again, read the result of the Map task from the temporary directory, and write the final result to the temporary directory again
[0112] 5) HiveServer reads the final result and returns it to the user.
[0113] The query acceleration module of this application adopts the following method:
[0114] 1) Impala receives the SQL request, parses the SQL, and converts it into an MPP execution plan
[0115] 2) Impala pre-applies for resources and starts instances on each node of the big data platform. There is no need to apply for resources and start processes, but to directly execute the MPP plan.
[0116] 3) When each Impala instance is executing a task, the upstream and downstream data are exchanged directly over the network without passing through the temporary HDFS directory.
[0117] The query performance is improved by the process of this application mainly in two aspects:
[0118] 1) Pre-application of resources: The Impala process that executes the task is pre-launched as a service process, rather than applying for resources on the spot when processing queries and then launching the process.
[0119] 2) Because all processes are started in advance, the intermediate results and data exchange between upstream and downstream use the inter-process network communication method, rather than the upstream writing to the HDFS temporary file and the downstream reading it later.
[0120] In this embodiment, the query acceleration module of the present application abandons the MapReduce execution framework, but metadata is not the focus of performance. In order to reduce minor work, the metadata module of Hive is retained, and the latest metadata is synchronized from the metadata module of Hive to the metadata module of the Impala engine through a metadata synchronizer. The present application transforms the traditional big data platform that mainly processes historical data into a set of technical measures and processes that adapt to the industrial real-time data processing platform. It breaks the contradiction between "data scale" and "real-time low-latency capability". The specific invention points are:
[0121] 1) Realize real-time writing of offline platforms through HDFS direct writing technology + regular metadata refresh mechanism.
[0122] 2) Solve the file fragmentation and metadata explosion problems that are inevitably caused by real-time data access to offline platforms through full and incremental defragmentation technology.
[0123] 3) Graft the online query engine based on memory computing to the offline platform and reuse the existing metadata module to improve the query speed while maintaining the stability of the system.
[0124] The biggest advantage of this solution is that it solves both the data scale and real-time issues. Existing solutions only partially solve these two requirements. For example, in the "traditional database cluster version" solution, real-time is not a problem, but there is an upper limit on the expansion capacity, which is a maximum of 10 data nodes. This solution is based on a big data platform and can basically be expanded horizontally at any level. The "cold and hot data storage + 2 sets of different technologies" solution has the problems of complex architecture and poor maintainability, and does not support low-latency queries for historical data. In this solution, both real-time near-line data and historical data can be quickly queried through the online query engine.
[0125] In addition, it is obvious that the word "comprising" does not exclude other units or steps. Multiple units, modules or devices stated in the device claim can also be implemented by one unit or the overall device through software or hardware.
[0126] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A big data platform, characterized in that: The big data platform includes a real-time writing module, wherein the real-time writing module includes: An acquisition module, which is used to acquire the data to be stored transmitted by the KafKa queue; A cache module, the cache module is used to cache the data to be stored according to the data time; A transmission module, which is used to commit the cached data to the corresponding HDFS partition according to preset conditions; The Hive metadata update module is used to update metadata regularly.
2. The big data platform according to claim 1, characterized in that: The big data platform further includes: A file fragmentation processing module includes a full data defragmentation module, and the full data defragmentation module is used to defragment all existing time series data on the big data platform.
3. The big data platform according to claim 2, characterized in that: The file fragmentation processing module further comprises: An incremental data defragmentation module is used to defragment the time series data on a preset data partition on a preset date.
4. The big data platform according to claim 3, characterized in that: The big data platform further includes: A query acceleration module, which is used to query the data in the big data platform according to the query request. The query acceleration module is based on the MPP architecture and the Impala engine of memory computing, manages metadata through the metadata service of Hive, and performs queries through the Impala online engine.
5. The fiber optic perimeter security system intrusion scene recognition method according to claim 4, characterized in that: The acquiring the spectral data to be identified according to the first spectral data and the second spectral data comprises: A cross-correlation calculation is performed on the first spectral data and the second spectral data, so as to obtain spectral data to be identified.
6. The big data platform according to claim 1, characterized in that: The caching of the data to be stored according to the data time includes: Obtaining time information of data to be stored; Acquire a partition cache database, wherein the partition cache database includes at least one preset time and a cache partition corresponding to each preset date; Obtaining a cache partition corresponding to a preset time that is the same as the time information; Store the data to be stored in the corresponding cache partition.
7. The big data platform according to claim 6, characterized in that: The preset conditions include: It is determined whether the size of the data stored in the cache partition exceeds a first threshold, and if so, cache is performed.
8. The big data platform according to claim 7, characterized in that: The preset conditions further include: It is determined whether the event of data being stored in the cache partition exceeds a second threshold, and if so, cache is performed.
9. The big data platform according to claim 3, characterized in that: The incremental data defragmentation module is used for performing defragmentation after each transmission module works.
Citation Information
Patent Citations
Impala cluster log analysis method and system based on Hadoop
CN106021580A
Data processing method and device and OLAP system
CN106708917A
Mass data platform and big data platform fusion method
CN108959369A
Data synchronization method and system between relational database and big data system
CN112527801A
Spark JDBC transaction processing method and device
CN114398401A
Cited By
Large model memory management method and device and medium
CN121050663A
Data real-time processing method, platform and related equipment
CN121166613A
