WO2019165671A1 - 大数据快速导入的方法、装置、终端设备及存储介质 - Google Patents

大数据快速导入的方法、装置、终端设备及存储介质 Download PDF

Info

Publication number
WO2019165671A1
WO2019165671A1 PCT/CN2018/081518 CN2018081518W WO2019165671A1 WO 2019165671 A1 WO2019165671 A1 WO 2019165671A1 CN 2018081518 W CN2018081518 W CN 2018081518W WO 2019165671 A1 WO2019165671 A1 WO 2019165671A1
Authority
WO
WIPO (PCT)
Prior art keywords
batch data
data
sub
valid
processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2018/081518
Other languages
English (en)
French (fr)
Inventor
石宇
李云利
张文君
张小敏
吴春海
李辉
陈晶
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2019165671A1 publication Critical patent/WO2019165671A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/254Extract, transform and load [ETL] procedures, e.g. ETL data flows in data warehouses
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases

Definitions

  • the present application relates to the field of big data processing, and in particular, to a method, device, terminal device and storage medium for quickly importing big data.
  • the data processed by the big data management platform has a large amount of data, and its data occupies a disk space of 500G or even T.
  • a relational database such as MySQL, Oracle or Postgres, etc.
  • the Sqoop tool is usually used to import batch data into a relational database.
  • the Sqoop tool is a tool for transferring data from Hadoop (that is, distributed system infrastructure) and relational database to each other, that is, the data in the relational database can be imported into Hadoop's HDFS (Hadoop Distributed File System).
  • HDFS Hadoop Distributed File System
  • data in HDFS can also be imported into a relational database.
  • the present invention provides a method, a device, a terminal device and a storage medium for quickly importing big data, so as to solve the problem that the current batch data is imported into a relational database, the data importing efficiency is often low.
  • the application provides a method for quickly importing big data, including:
  • Each of the original batch data is stored in a pre-created temporary table, and the corresponding state parameter is stored in the state table;
  • the application provides a device for quickly importing big data, including:
  • the original batch data obtaining module is configured to obtain at least one original batch data sent by the big data management platform, where each original batch data corresponds to a state parameter;
  • a first storage module configured to store each of the original batch data in a pre-created temporary table, and store the corresponding state parameter in the state table
  • the batch data obtaining module is configured to trigger a data monitoring instruction, scan a state parameter in the state table, and obtain a batch data to be processed whose state parameter is a to-be-processed state;
  • the second storage module is configured to perform deduplication processing on the batch data to be processed, obtain valid batch data, and store the valid batch data in a target table in the relational database.
  • the present application provides a terminal device including a memory, a processor, and computer readable instructions stored in the memory and executable on the processor, the processor executing the computer readable instructions The following steps are implemented:
  • Each of the original batch data is stored in a pre-created temporary table, and the corresponding state parameter is stored in the state table;
  • the application provides one or more non-transitory readable storage media storing computer readable instructions, such as one or more, when executed by one or more processors
  • the processor implements the following steps:
  • Each of the original batch data is stored in a pre-created temporary table, and the corresponding state parameter is stored in the state table;
  • Embodiment 1 is a flow chart of a method for quickly importing big data in Embodiment 1;
  • FIG. 2 is a specific flow chart of step S20 of Figure 1;
  • FIG. 3 is a specific flow chart of step S22 of Figure 2;
  • FIG. 4 is a specific flow chart of step S30 of Figure 1;
  • Embodiment 5 is a schematic block diagram of an apparatus for quickly importing big data in Embodiment 2;
  • Fig. 6 is a schematic diagram of a terminal device provided in Embodiment 4.
  • FIG. 1 shows a flow chart of a method for quickly importing big data in this embodiment.
  • the method for quickly importing big data is applied to a database management system, and the database management system is connected to a big data management platform, and is used for quickly importing large data (that is, batch data) with a large amount of data of a big data management platform into a relational database.
  • relational database Traditional relational data such as MySQL, Oracle or Postgres
  • the Oracle database management system is taken as an example for quickly importing batch data in the big data management platform into the Oracle database.
  • the method for quickly importing big data includes the following steps:
  • S10 Acquire at least one original batch data sent by the big data management platform, where each original batch data corresponds to a state parameter.
  • Raw batch data refers to bulk data that is pre-stored by the big data management platform but not uploaded to the relational database.
  • batch data refers to data with a large amount of data.
  • the original batch data may specifically be service data sent by the different service systems (such as a large financial asset business system or a large medical health service system) to the big data management platform.
  • the service data includes, but is not limited to, account opening information data provided by the large financial asset business system mentioned in the embodiment and user registration information data of the large medical health service system.
  • the big data management platform stores a large amount of service data sent from different service systems, the service system sends the service data in batches, and the data volume is large. Therefore, the service data can be sent in batches for each service system. For raw batch data.
  • the big data management platform stores the original batch data sent by different business data, and imports the original batch data as a whole into the relational database.
  • the state parameter refers to a parameter describing a processing state corresponding to each original batch data, and the processing state includes four state parameters: a to-be-processed state, an in-process state, a process success state, and a process failure state.
  • the status parameter is used to indicate the corresponding processing state, specifically: 0 corresponds to the pending state, 1 corresponds to the processing state, 2 corresponds to the processing success state, and 3 corresponds to the processing failure state.
  • the status parameter corresponding to each original batch data stored by the big data management platform is to be processed, that is, the status parameter corresponding to 0.
  • the big data management platform only stores the stored state parameter as 0 and the corresponding original.
  • Bulk data is sent to the Oracle database management system using the Sqoop tool. Only the original batch data in the pending state is sent to the Oracle database management system, which is convenient for effectively identifying the original batch data of the pending state, effectively reducing the data processing amount of the Oracle database management system and improving the data processing efficiency.
  • the state parameters whose status parameters are not 0 and the corresponding original batch data are not sent to the Oracle database management system to avoid repeated processing of the original batch data, which saves processing time and improves processing efficiency.
  • S20 Store each original batch data in a pre-created temporary table, and store corresponding state parameters in the state table.
  • the temporary table refers to a data table temporarily created by the Oracle database management system to temporarily store the original bulk data sent by the big data management platform.
  • the status table refers to a table for recording the processing status corresponding to the original bulk data stored in the Oracle temporary table.
  • the Oracle database management system After obtaining the state parameter and the corresponding original batch data sent by the big data management platform, the Oracle database management system stores the original batch data in a pre-created temporary table, and the corresponding state parameter is stored in the pre-created state table.
  • a raw batch data corresponds to a state table. It can be understood that when the original database data is acquired by the Oracle database management system, the corresponding processing state is the pending state, and the state parameter in the setting state table is 0; when the original batch data is processed, the corresponding processing is performed.
  • the state is the in-process state, so that the state parameter in the state table is changed to 1; and according to the success or failure of the processing, respectively, whether the corresponding processing success state or processing failure state is determined, to determine that the state parameter in the state table is 2 Or 3.
  • the processing in this embodiment refers to a process of importing original batch data into a relational database.
  • the temporary table releases the corresponding original batch data to save the temporary table.
  • Temporary tables serve as temporary storage.
  • S30 trigger a data monitoring instruction, scan a state parameter in the state table, and obtain a batch data to be processed whose state parameter is a pending state.
  • a data monitoring instruction is an instruction that triggers a data monitoring operation.
  • the batch data to be processed refers to the original batch data corresponding to the status parameter to be processed.
  • the Oracle database management system When the Oracle database management system stores the obtained original batch data and the corresponding state parameters into the pre-created temporary table and the state table, the Oracle database management system triggers the data monitoring command to start the data monitoring when a specific trigger event occurs.
  • the program scans all the state parameters stored in the state table. When the state parameter is 0, the batch data to be processed corresponding to the state parameter is obtained. Through the data monitoring program, only the batch data to be processed corresponding to the state parameter of 0 is obtained, which facilitates the Oracle database management system to process the batch data in step S40, and reduces the processing amount of the batch data to improve the processing efficiency.
  • the specific trigger event in this embodiment refers to an event that triggers a data monitoring instruction to perform a data monitoring operation within a preset trigger time. When the current time of the system is the trigger time, the specific trigger event is formed.
  • S40 Perform deduplication processing on the batch data to obtain valid batch data, and store the valid batch data in the target table in the relational database.
  • the effective batch data refers to the batch data obtained by performing deduplication processing on the batch data to be processed.
  • the Oracle database management system performs deduplication processing on the obtained batch data to be processed based on the specified column.
  • the specified column refers to a pre-specified data column containing the data storage time.
  • the Oracle database management system When the state parameter in the state table is changed to 1, the Oracle database management system returns the modified state parameter to the state parameter corresponding to the original batch data corresponding to the big data management platform, so as to avoid the same data being repeated by the big data management platform.
  • Raw bulk data is sent to the Oracle database management system, resulting in duplicate processing.
  • the latest time refers to the time closest to the current time of the system.
  • the effective batch data obtained after the de-duplication processing is stored in the corresponding relational database, thereby improving the efficiency of importing the batch data into the relational data.
  • the personal information of the policyholder includes but not limited to the policyholder ID, the name of the policyholder, the reserved mobile phone number and the email address, if When a policyholder ID corresponds to at least two reserved mobile phone numbers or email addresses, the personal information of the policyholder before the latest time is deleted based on the storage time of the personal information of the policyholder, and only the personal information corresponding to the latest time is retained. .
  • the personal information corresponding to the latest time is stored as valid batch data in the corresponding relational database, so that the business personnel can obtain the personal information data of the corresponding insured person, and the accuracy of the personal information data of the insured person is improved.
  • the target table refers to a pre-established data table in a relational database, which is a data table for storing valid batch data.
  • the Oracle database management system performs deduplication processing on the batch data, and stores the obtained valid batch data into the target table in the relational database, so that different business systems directly call the target table when the data in the target table needs to be acquired.
  • Steps S10-S40 the big data management platform stores each original batch data and corresponding state parameters respectively in a temporary table and a state table pre-created by the Oracle database management system, and the Oracle database management system triggers data monitoring instructions and scans.
  • the status parameter in the status table is obtained as the pending batch data corresponding to the pending status.
  • the obtained valid batch data is stored in the target table created by the relational database.
  • the original batch data is stored in the temporary table by the method, and the original batch data in the temporary table is processed, and the valid batch data is stored in the target table of the relational database, thereby overcoming the import of the original batch data from the big data platform.
  • the success rate of data import is not high due to different data types, which also improves the efficiency of importing the original batch data into the target table of the relational database.
  • each original batch data is stored in a pre-created temporary table, which specifically includes the following steps:
  • Map-Reduce Map-Reduce
  • Map-Reduce is a mobile distributed computing framework based on key-values. It consists of a Map function and a Reduce function.
  • the Map function maps a raw batch data into N(N ⁇ 2) sub-batch data according to the user-defined data amount, and then maps the key-value pairs in the sub-batch data into new key-value pairs, one sub-batch.
  • the data includes at least one new key-value pair.
  • the size of each sub-batch data is fixed, and the execution operation corresponding to the map function is the same. Therefore, the operation of executing N sub-batch data in parallel does not cause significant time imbalance, and the parallel efficiency is the highest.
  • the Map function first decomposes the original batch data into N according to the user-defined condition (N ⁇ 2). ) Sub-batch data. Then, the key value pairs in the sub-batch data are mapped into a new key-value pair.
  • the key-value pairs in the original batch data are: the insured ID as a key, the insured business corresponding to the insured ID, the name of the insured, The mobile phone number and the email address are reserved as values, that is, the insured person ID in the original batch data forms a mapping relationship with the insured business, the insured name, the reserved mobile phone number and the email address corresponding to the insured ID. Formed a key-value pair.
  • the new key-value pair refers to the insured business as a key, the policyholder ID corresponding to the insured service, the name of the insured, the reserved mobile phone number, and the email address as values, that is, the insured business corresponds to the insured business.
  • the insured ID, the name of the insured, the reserved mobile number and the email address form a new mapping relationship that constitutes a new key-value. Since one policyholder ID may correspond to multiple insurance services, when the new key is the insurance service, at least one insurance service is included in one sub-batch data, that is, at least one new key appears in one sub-batch data.
  • Each sub-batch data acquired in step S21 is sent to a corresponding Reduce function.
  • the Reduce function will not be less than the number of sub-bulk data, that is, M ⁇ N, so that Processing the failed sub-batch data by using the Reduce function of other sub-batch data to improve processing efficiency.
  • N and M are positive integers.
  • the Reduce function will summarize each sub-batch data based on the new key, that is, the value corresponding to the same new key (value).
  • a data table based on the new key determination is formed, and the corresponding sub-batch data is imported into the temporary table according to the user-defined data amount.
  • the N sub-bulk data are exported and processed into the temporary table by using M reduction functions in the mapping reduction function, which can improve the speed of data export and save time.
  • the temporary table does not set the primary key and the unique index.
  • the primary key can be a combination of one or more columns whose value uniquely identifies each row in the table, by which the entity integrity of the table can be enforced.
  • the primary key is mainly used to record the association between the table and the table, as well as to modify and delete the data of the table.
  • a unique index is a structure that sorts the values of one or more columns in a database table.
  • the temporary table does not set the primary key, which ensures that a part of the sub-bulk data in the original batch data is successfully imported into the temporary table first, and does not affect other partial sub-batch data that has not been successfully imported into the temporary table.
  • the target table detects that the corresponding data exists in the set primary key, which causes the Oracle database management system to trigger a system error in which the primary key is not unique, resulting in a system error.
  • the entire Mapreduce process terminates, causing the data export to fail.
  • the temporary table does not set a unique index.
  • the sub-batch data can be scanned one by one according to different indexes and imported into the temporary table to ensure the comprehensiveness of data import.
  • a sub-batch data includes two new keys
  • the insured service A and the insured service B after each sub-batch data is sent to the corresponding Reduce function, the Reduce function will batch each sub-batch.
  • the values belonging to the same key in the data are reduced together, and the values corresponding to the insured service A are reduced together, and the values corresponding to the insured service B are reduced together to form a data table corresponding to the insured service A and the insured service B.
  • the data table corresponding to the formed insurance business A and the insurance business B is imported into a temporary table for storage.
  • step S22 the M sub-batch data is exported by using the M mapping reduction functions, so that the exported sub-batch data is stored in the temporary table, which includes the following steps:
  • S221 Exporting N sub-batch data by using N mapping reduction functions to obtain a derivation processing result corresponding to each sub-batch data.
  • the N mapping reduction functions are selected in the M mapping reduction functions to perform one-to-one derivation processing on the N sub-batch data, that is, each reduction function corresponds to one sub-batch data, so that N sub-batch data are exported in parallel.
  • the result of the export processing corresponding to each mapping reduction function includes the export success and the export failure.
  • the mapping reduction function starts a pre-set retry mechanism.
  • the retry mechanism refers to a mechanism for placing the corresponding sub-batch data in the N+1th mapping reduction function when the export result is an export failure.
  • the re-trying mechanism is set in the fast data importing method to ensure that when the export processing result of a sub-bulk data is an export failure, the server automatically puts the sub-batch data that failed to be exported into another idle mapping reduction process.
  • the export process is performed to improve the data export success rate.
  • step S30 triggering a data monitoring instruction to scan a status parameter in the status table, specifically includes the following steps:
  • S31 Acquire a timing trigger instruction, where the timing trigger instruction includes a process ID and a trigger time.
  • the timing triggering instruction refers to triggering data monitoring a triggering instruction at a timing preset by the oracle database management system, and the timing triggering instruction includes a process ID and a triggering time.
  • the process ID is an identifier of a data monitoring process that performs export processing on the original batch data, and the process ID can be used to uniquely identify a data monitoring process that performs export processing on the original bulk data.
  • the triggering time refers to a preset time. When the current time of the system reaches the preset time, the data monitoring process corresponding to the process ID in the corresponding timing triggering instruction is triggered.
  • the oracle database management system presets a timing triggering instruction, and the timing triggering instruction triggers the data monitoring instruction set by the oracle database management system when the current time of the oracle database management system is the same as the preset triggering time, based on the data monitoring instruction. Step S32 is performed.
  • the oracle database management system determines whether the current time of the system is the same as the preset trigger time. If the current time is the same as the preset trigger time, the data monitoring process corresponding to the process ID is triggered to scan the status parameter in the status table. When the scan state parameter is 0, the original batch data corresponding to the state table is subjected to export processing, that is, the original batch data whose processing state is the pending state is simultaneously exported.
  • step S40 the valid batch data is stored in the target table in the relational database, and specifically includes the following steps: the effective batch data is merged and processed by the merge sort algorithm, and inserted into the target created by the relational database. In the table.
  • the merge sort algorithm is an effective sorting algorithm based on the merge operation. It is also called the merge algorithm.
  • the merge sort algorithm refers to matching the obtained valid batch data with the data stored in the target table. The update operation is performed, and the insert operation is performed when the match is unsuccessful. In this embodiment, only the insert operation is used to insert the valid batch data, that is, the valid batch data that does not exist in the target table is inserted into the target table.
  • the valid batch data obtained by the oracle database management system and the target table stored in the relational database are matched and matched, and the valid batch data with unsuccessful matching is inserted into the target table, that is, the data existing in the valid batch data is Data that does not exist in the target table is inserted into the target table.
  • the merge sort algorithm is used to insert the valid batch data that does not exist in the target table into the target table, and only one full table scan is needed to complete the insertion of all valid batch data that does not exist in the target table into the target table, thereby improving the data. The efficiency of the insertion.
  • the method for quickly importing the big data further includes:
  • S50 Change the status parameter of the valid batch data that has been successfully inserted into the target table to the processing success status, and change the status parameter of the valid batch data that was not successfully inserted into the target table to the processing failure status.
  • the Oracle database management system can identify the processing of the effective batch data insertion into the target table, and facilitate the Oracle database management system to re-insert the effective batch data that fails to be processed in time.
  • Reasons for valid batch data not being successfully inserted into the target table include reasons such as a temporary table being too large, an insert timeout, or a network. If the valid batch data is not successfully inserted into the target table because the valid batch data is too large or the insertion timeout is exceeded, the reason for the insertion failure is that the amount of data in the temporary table is too large, which is not conducive to the insertion operation, and the temporary should be The valid batch data of the table is split, and the plurality of sub-active batch data is inserted into the target table; if the reason for the insertion failure is the network cause, the insertion process of the temporary table is refreshed, and the valid batch data is reinserted into the target table. .
  • the method for quickly importing big data is pre-created in the Oracle database management system when each raw batch data and corresponding state parameters obtained by the big data management platform are imported into the target table in the Oracle database management system.
  • the temporary table and the state table use the mapping protocol function to split the original batch data into N sub-batch data, and perform export processing to improve data export efficiency.
  • the Oracle database management system triggers the data monitoring instruction, scans the state parameter in the state table, and obtains the batch data to be processed corresponding to the state to be processed, and performs deduplication processing on the batch data to be processed to avoid repeating the batch to be processed.
  • the data is processed to save processing time and improve processing efficiency.
  • the merge sort algorithm is used to match the valid batch data with the data in the target table, and the data with unsuccessful matching is inserted into the target table, and only a full table scan is needed to complete the effective batch that does not exist in the target table.
  • the data is all inserted into the target table, which improves the efficiency of data insertion execution.
  • FIG. 2 is a schematic block diagram showing an apparatus for quickly importing big data corresponding to the method of fast import of big data in the first embodiment.
  • the apparatus for quickly importing big data includes an original batch data obtaining module 10, a first storage module 20, a batch data acquiring module 30 to be processed, and a second storage module 40.
  • the steps of the original batch data obtaining module 10, the first storage module 20, the to-be-processed batch data acquiring module 30, the second storage module 40, and the state parameter changing module 50, and the method corresponding to the method for quickly importing big data in the embodiment One-to-one correspondence, in order to avoid redundancy, this embodiment will not be described in detail.
  • the original batch data obtaining module 10 is configured to obtain at least one original batch data sent by the big data management platform, where each original batch data corresponds to a state parameter.
  • the first storage module 20 is configured to store each original batch data in a pre-created temporary table, and store the corresponding state parameter in the state table.
  • the batch data obtaining module 30 is configured to trigger a data monitoring instruction, scan a state parameter in the state table, and obtain a batch data to be processed whose state parameter is a pending state.
  • the second storage module 40 is configured to perform deduplication processing on the batch data to be processed, obtain valid batch data, and store the valid batch data in the target table in the relational database.
  • the temporary table does not set a primary key and a unique index.
  • the first storage module 20 includes a sub-batch data acquisition unit 21 and a sub-batch data storage unit 22.
  • the sub-batch data obtaining unit 21 is configured to split each original batch data into N sub-batch data by using a mapping reduction function, where N ⁇ 2.
  • the sub-batch data storage unit 22 is configured to perform derivation processing on the N sub-batch data by using M mapping reduction functions, so as to store the exported sub-batch data in a temporary table, where M ⁇ N, where N and M are positive integers.
  • the sub-batch data storage unit 22 includes a derivation processing result acquisition unit 221, a first derivation result processing unit 222, and a second derivation result processing unit 223.
  • the derivation processing result obtaining unit 221 is configured to perform derivation processing on the N sub-batch data by using the N mapping reduction functions, and obtain the derivation processing result corresponding to each sub-batch data.
  • the first export result processing unit 222 is configured to store the derived sub-batch data in the temporary table if the export processing result is that the export is successful.
  • the second export result processing unit 223 is configured to: when the export processing result is the export failure, assign the sub-batch data whose export processing result is the export failure to the N+1th map reduction function, and perform the export processing until all the export processing The result ends when the export is successful.
  • the to-be-processed batch data acquisition module 30 includes a timing trigger instruction acquisition unit 31 and a data monitoring process scanning unit 32.
  • the timing triggering instruction acquiring unit 31 is configured to acquire a timing triggering instruction, where the timing triggering instruction includes a process ID and a triggering time.
  • the data monitoring process scanning unit 32 is configured to trigger a state parameter in the data monitoring process scan status table corresponding to the process ID if the current time of the system is the trigger time.
  • the second storage module 40 is configured to merge the valid batch data into a target table created by the relational database by using a merge sort algorithm.
  • the device for quickly importing big data further includes a state parameter changing module 50.
  • the status parameter change module 50 is configured to change the status parameter of the valid batch data that has been successfully inserted into the target table to the successfully processed status, and change the status parameter of the valid batch data that was not successfully inserted into the target table to the unsuccessful processing status.
  • This embodiment provides one or more non-volatile readable storage media having computer readable instructions stored thereon.
  • the one or more non-readable readable storage media storing computer readable instructions, when executed by one or more processors, causing one or more processors to perform the big data in embodiment 1.
  • the method of fast import, in order to avoid duplication, will not be described here.
  • the computer readable instructions when executed by the processor, the functions of the modules/units in the apparatus for quickly importing big data in Embodiment 2 are implemented. To avoid repetition, details are not described herein again.
  • non-volatile readable storage media storing computer readable instructions may comprise: any entity or device capable of carrying the computer readable instruction code, a recording medium, a USB flash drive, a mobile hard drive, Disk, optical disk, computer memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier signals, and telecommunications signals.
  • FIG. 6 is a schematic diagram of a terminal device according to an embodiment of the present application.
  • the terminal device 60 of this embodiment includes a processor 61, a memory 62, and computer readable instructions 63 stored in the memory 62 and operable on the processor 61.
  • the processor 61 executes the computer readable instructions 63, the functions of the modules/units of the apparatus for quickly importing big data in the above embodiment 2 are implemented, for example, the original batch data acquiring module 10, the first storage module 20, The functions of the batch data acquisition module 30, the second storage module 40, and the state parameter modification module 50 to be processed.

Landscapes

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

Abstract

本申请公开了一种大数据快速导入的方法、装置、终端设备及存储介质。该大数据快速导入的方法包括:获取大数据管理平台发送的至少一个原始批量数据,每一原始批量数据对应一状态参数;将每一原始批量数据存储在预先创建的临时表中,并将对应的状态参数存储在状态表中;触发数据监控指令,扫描状态表中的状态参数,获取状态参数为待处理状态的待处理批量数据;对待处理批量数据进行去重处理,获取有效批量数据,将有效批量数据存储到关系型数据库中的目标表中。该方法可以提高批量数据导入到关系型数据库的效率。

Description

大数据快速导入的方法、装置、终端设备及存储介质
本申请以2018年2月27日提交的申请号为201810161582.X,名称为“大数据快速导入的方法、装置、终端设备及存储介质”的中国发明专利申请为基础,并要求其优先权。
技术领域
本申请涉及大数据处理领域,尤其涉及一种大数据快速导入的方法、装置、终端设备及存储介质。
背景技术
在互联网和金融行业,大数据管理平台处理的数据的数据量较大,其数据占用磁盘空间会达到500G甚至T级别。为了便于对数据进行分析处理,需将大数据管理平台中数据量较大的数据(以下简称批量数据)导入到关系型数据库(如MySQL,Oracle或Postgres等)中。在当前大数据管理平台中,通常采用Sqoop工具将批量数据导入到关系型数据库。其中,Sqoop工具是一个用来将Hadoop(即分布式系统基础架构)和关系型数据库中的数据相互转移的工具,即可以将关系型数据库中的数据导入到Hadoop的HDFS(Hadoop Distributed File System,分布式文件系统)中,也可以将HDFS中的数据导入到关系型数据库中。当前批量数据导入到关系型数据库的过程中,经常会出现数据导入效率低的问题。
发明内容
本申请提供一种大数据快速导入的方法、装置、终端设备及存储介质,以解决当前批量数据导入到关系型数据库的过程经常会出现数据导入效率低的问题。
第一方面,本申请提供一种大数据快速导入的方法,包括:
获取大数据管理平台发送的至少一个原始批量数据,每一原始批量数据对应一状态参数;
将每一所述原始批量数据存储在预先创建的临时表中,并将对应的状态参数存储在状态表中;
触发数据监控指令,扫描所述状态表中的状态参数,获取状态参数为待处理状态的待处理批量数据;
对所述待处理批量数据进行去重处理,获取有效批量数据,将所述有效批量数据存储到关系型数据库中的目标表中。
第二方面,本申请提供一种大数据快速导入的装置,包括:
原始批量数据获取模块,用于获取大数据管理平台发送的至少一个原始批量数据,每一原始批量数据对应一状态参数;
第一存储模块,用于将每一所述原始批量数据存储在预先创建的临时表中,并将对应的状态参数存储在状态表中;
待处理批量数据获取模块,用于触发数据监控指令,扫描所述状态表中的状态参数,获取状态参数为待处理状态的待处理批量数据;
第二存储模块,用于对所述待处理批量数据进行去重处理,获取有效批量数据,将所述有效批量数据存储到关系型数据库中的目标表中。
第三方面,本申请提供一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:
获取大数据管理平台发送的至少一个原始批量数据,每一原始批量数据对应一状态参数;
将每一所述原始批量数据存储在预先创建的临时表中,并将对应的状态参数存储在状态表中;
触发数据监控指令,扫描所述状态表中的状态参数,获取状态参数为待处理状态的待处理批量数据;
对所述待处理批量数据进行去重处理,获取有效批量数据,将所述有效批量数据存储到关系型数据库中的目标表中。
第四方面,本申请提供一个或多个存储有计算机可读指令的非易失性可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器实现如下步骤:
获取大数据管理平台发送的至少一个原始批量数据,每一原始批量数据对应一状态参数;
将每一所述原始批量数据存储在预先创建的临时表中,并将对应的状态参数存储在状态表中;
触发数据监控指令,扫描所述状态表中的状态参数,获取状态参数为待处理状态的待处理批量数据;
对所述待处理批量数据进行去重处理,获取有效批量数据,将所述有效批量数据存储 到关系型数据库中的目标表中。
本申请的一个或多个实施例的细节在下面的附图及描述中提出。本申请的其他特征和优点将从说明书、附图以及权利要求书变得明显。
附图说明
为了更清楚地说明本申请的技术方案,下面将对本申请的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是实施例1中大数据快速导入的方法的一流程图;
图2是图1中步骤S20的一具体流程图;
图3是图2中步骤S22的一具体流程图;
图4是图1中步骤S30的一具体流程图;
图5是实施例2中大数据快速导入的装置的一原理框图;
图6是实施例4中提供的终端设备的示意图。
具体实施方式
下面将结合本申请中的附图,对本申请中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
实施例1
图1示出本实施例中大数据快速导入的方法的流程图。该大数据快速导入的方法应用数据库管理系统中,该数据库管理系统与大数据管理平台相连,用于将大数据管理平台的数据量较大的大型数据(即批量数据)快速导入到关系型数据库(如MySQL,Oracle或Postgres等传统的关系型数据),以提高批量数据导入的效率。本实施例中,以Oracle数据库管理系统为例进行说明,用于将大数据管理平台中的批量数据快速导入到Oracle数据库中。如图1所示,该大数据快速导入的方法包括如下步骤:
S10:获取大数据管理平台发送的至少一个原始批量数据,每一原始批量数据对应一状态参数。
原始批量数据是指大数据管理平台预先存储但未上传给关系型数据库的批量数据。其中,批量数据是指数据量较大的数据。具体地,该原始批量数据具体可以是不同的业务系统(如大金融资产业务系统或大医疗健康业务系统等)发送给大数据管理平台的业务数据。 该业务数据包括但不限于本实施例提及的大金融资产业务系统提供的开户信息数据和大医疗健康业务系统的用户注册信息数据。
由于大数据管理平台存储着大量的来自不同业务系统发送的业务数据,业务系统在发送业务数据时,都是批量发送的,数据量较大,因此,可以每一业务系统批量发送的业务数据定义为原始批量数据。大数据管理平台存储不同业务数据发送的原始批量数据,并将该原始批量数据作为一个整体导入到关系型数据库。
每一原始批量数据都有一个对应的状态参数。状态参数是指描述每一原始批量数据对应的处理状态的参数,该处理状态包括待处理状态、处理中状态、处理成功状态和处理失败状态四种状态参数。本实施例中,为了方便辨识不同的处理状态,使用状态参数表示对应的处理状态,具体为:0对应待处理状态,1对应处理中状态,2对应处理成功状态,3对应处理失败状态。具体地,大数据管理平台存储的每一原始批量数据对应的状态参数为待处理,即对应0这一状态参数。
由于四种处理状态中,只有待处理状态对应的原始批量数据是未经处理的,需上传到Oracle数据库管理系统进行处理,因此,大数据管理平台仅将存储的状态参数为0和对应的原始批量数据采用Sqoop工具发送给Oracle数据库管理系统。只将处于待处理状态的原始批量数据发送给Oracle数据库管理系统,方便有效辨识待处理状态的原始批量数据,有效减少Oracle数据库管理系统的数据处理量,提高数据处理效率。相应地,状态参数不为0的状态参数和对应的原始批量数据不会发送给Oracle数据库管理系统,以避免对原始批量数据进行重复处理,节省处理时间,以提高处理效率。
S20:将每一原始批量数据存储在预先创建的临时表中,并将对应的状态参数存储在状态表中。
临时表是指Oracle数据库管理系统临时创建的,用来临时存储大数据管理平台发送的原始批量数据的数据表。状态表是指用于记录存储在Oracle临时表中的原始批量数据对应的处理状态的表格。
Oracle数据库管理系统在获取到大数据管理平台发送的状态参数和对应的原始批量数据后,将原始批量数据存储到预先创建的临时表中,对应的状态参数存储到预先创建的状态表中。其中,一个原始批量数据对应一个状态表。可以理解地,Oracle数据库管理系统在获取到原始批量数据时,其对应的处理状态为待处理状态,设置状态表中的状态参数为0;在开始对原始批量数据进行处理时,其对应的处理状态为处理中状态,使得状态表中的状态参数更改为1;并可依据其处理成功与否,分别确定其对应的属于处理成功状态 还是处理失败状态,以确定状态表中的状态参数为2或3。本实施例中的处理是指将原始批量数据导入到关系型数据库的处理过程。
进一步地,当状态表中的状态参数为2时,即原始批量数据导出从临时表中导入到关系型数据库的处理过程成功时,临时表会将对应的原始批量数据释放,以节省临时表的存储空间。临时表起到了临时存储的作用。
S30:触发数据监控指令,扫描状态表中的状态参数,获取状态参数为待处理状态的待处理批量数据。
数据监控指令是指触发进行数据监控操作的指令。待处理批量数据是指状态参数为待处理状态对应的原始批量数据。
当Oracle数据库管理系统将获取到的原始批量数据和对应的状态参数存储到预先创建的临时表中和状态表后,在特定触发事件发生时,Oracle数据库管理系统会触发数据监控指令,启动数据监控程序,扫描状态表中存储的所有状态参数,当状态参数为0时,获取该状态参数对应的待处理批量数据。通过数据监控程序,只获取状态参数为0对应的待处理批量数据,方便Oracle数据库管理系统有针对性地对待处理批量数据执行步骤S40,减少了批量数据的处理数量,以提高处理效率。本实施例中的特定触发事件是指在预先设置的触发时间内,触发数据监控指令执行数据监控操作的事件,当系统当前时间为该触发时间时,则形成这一特定触发事件。
S40:对待处理批量数据进行去重处理,获取有效批量数据,将有效批量数据存储到关系型数据库中的目标表中。
有效批量数据是指对待处理批量数据进行去重处理后得到的批量数据。本实施例中,获取到的待处理批量数据后,Oracle数据库管理系统会基于指定列对获取的待处理批量数据进行去重处理。该指定列是指预先指定的包含数据存储时间的数据列。在开始对待处理批量数据进行去重处理时,需修改该待处理批量数据对应的状态表中的状态参数为1,表示该待处理批量数据处于处理中状态,以避免重复对该待处理批量数据进行处理,节省处理时间,提高处理效率。
当状态表中的状态参数改为1时,Oracle数据库管理系统会将修改后的状态参数返回给大数据管理平台对应的原始批量数据对应的状态参数,以避免大数据管理平台重复将这相同的原始批量数据发送给Oracle数据库管理系统,从而导致重复处理。
在对待处理批量数据进行去重处理过程中,若待处理批量数据存在至少两个相同的数据时,则基于数据对应的存储时间只保留最新时间对应的数据,将该最新时间之前存储的 数据进行清除处理,以节省数据的存储空间。其中,最新时间是指与系统当前时间最接近的时间。将进行去重处理后得到的有效批量数据存储到对应的关系型数据库中,从而提高批量数据导入到关系型数据的效率。
如有效批量数据是保险业务系统发送的某个保险产品对应的投保人的个人信息数据,投保人的个人信息中包括但不限于投保人ID、投保人姓名、预留手机号和邮箱地址,若一个投保人ID对应了至少两个预留手机号或者邮箱地址时,则基于该投保人的个人信息的存储时间,删除最新时间之前的该投保人的个人信息,只保留最新时间对应的个人信息。将最新时间对应的个人信息作为有效批量数据存储到对应的关系型数据库中,方便业务人员获取对应的投保人的个人信息数据,提高了投保人的个人信息数据的准确性。
目标表是指关系型数据库中预先建立的数据表,该目标表是用于存储有效批量数据的数据表。Oracle数据库管理系统对待处理批量数据进行去重处理,将获取的有效批量数据存储到关系型数据库中的目标表中,便于不同的业务系统在需要获取目标表中的数据时,直接调用目标表。
步骤S10-S40,大数据管理平台将获取到的每一原始批量数据和对应的状态参数分别存储在Oracle数据库管理系统预先创建的临时表和状态表中,Oracle数据库管理系统触发数据监控指令,扫描状态表中的状态参数,获取状态参数为待处理状态对应的待处理批量数据,对待处理批量数据进行去重处理后将获取的有效批量数据存储到关系型数据库创建的目标表中。通过该方法将原始批量数据存储在临时表中,对临时表中的原始批量数据进行处理后,将有效批量数据存储到关系型数据库的目标表中,克服了从大数据平台将原始批量数据导入到关系型数据库的目标表中时,由于数据类型不同导致数据导入的成功率不高的问题,从而也提高了原始批量数据导入到关系型数据库的目标表中的效率。
在一具体实施方式中,如图2所示,步骤S20,将每一原始批量数据存储在预先创建的临时表中,具体包括如下步骤:
S21:采用映射归约函数将每一原始批量数据拆分成N个子批量数据,N≥2。
由于大数据管理平台导入到临时表中的数据量较大,为了加快原始批量数据导入到临时表中的速度,缩短导入时间,需要使用多个映射归约(Map-Reduce)进程对原始批量数据进行分布式导出。映射归约(Map-Reduce)是一个移动式的基于键值对(key-value)形成的分布式计算框架,由Map(映射)函数和Reduce(归约)函数组成。Map(映射)函数根据用户自定义的数据量将一个原始批量数据分解成N(N≥2)子批量数据,然后将子批量数据中的键值对映射成新的键值对,一个子批量数据中包括至少一个新的键值对。 每个子批量数据的大小是固定的,而map(映射)函数对应的执行操作也是相同的,因此,并行执行N个子批量数据的操作时不会出现明显的时间不均衡,并行效率最高。
如大数据管理平台将保险业务系统关于投保人的个人信息对应的原始批量数据导入到临时表中时,Map(映射)函数先根据用户自定义的条件将原始批量数据分解成N(N≥2)子批量数据。然后,将子批量数据中的键值对映射成新的键值对,原始批量数据中键值对为:投保人ID作为键(key),与投保人ID对应的投保业务、投保人姓名、预留手机号和邮箱地址作为值(value),即原始批量数据中的投保人ID与该投保人ID对应的投保业务、投保人姓名、预留手机号和邮箱地址形成了一种映射关系,组成了一个键值对(key-value)。新的键值对是指以投保业务作为键(key),与投保业务对应的投保人ID、投保人姓名、预留手机号和邮箱地址作为值(value),即投保业务与该投保业务对应的投保人ID、投保人姓名、预留手机号和邮箱地址形成了一种新的映射关系,组成了一个新的键值对(key-value)。由于一个投保人ID可能会对应多个投保业务,当新的键为投保业务时,一个子批量数据中会包含至少一个投保业务,即一个子批量数据中会出现至少一个新的键。
S22:采用M个映射归约函数对N个子批量数据进行导出处理,以将导出的子批量数据存储在临时表中,M≥N,其中N、M为正整数。
将步骤S21获取的每一子批量数据发送给对应的Reduce(归约)函数。一般地,由于Reduce(归约)函数在对数据进行汇总时,会不可避免地出现汇总失败的问题,因此Reduce(归约)函数不会少于子批量数据的数量,即M≥N,以便于采用其他子批量数据的Reduce(归约)函数对处理失败的子批量数据进行处理,提高处理效率。其中,N、M为正整数。Reduce(归约)函数在map(映射)函数获取至少一个子批量数据时,会基于新的键对每一子批量数据进行汇总处理,即将同一个新的键(key)对应的值(value)汇总到一起,形成基于新的键确定的数据表,将该数据表根据用户自定义的数据量将对应的子批量数据导入到临时表中。采用映射归约函数中的M个归约函数对N个子批量数据进行导出处理,存储到临时表中,可以提高数据导出的速度,节省时间。
本实施例中,为了保证步骤S20的实现,临时表不设置主键和唯一索引。其中,主键可以是一个列或多列的组合,其值能唯一地标识表中的每一行,通过它可强制表的实体完整性。主键主要用于记录表与表之间的关联,以及用于记录本表的数据修改与删除。唯一索引是对数据库表中一列或多列的值进行排序的一种结构。临时表不设置主键,可以保证原始批量数据中的一部分子批量数据先成功导入到临时表中后,不会影响还没有成功导入 到临时表中的其他部分子批量数据。若临时表中设置主键,则在一部分子批量数据导入到目标中后,目标表检测到设置的主键中已经有对应的数据存在,就会使Oracle数据库管理系统触发主键不唯一的系统错误,导致整个Mapreduce进程终止,从而导致数据导出失败。临时表不设置唯一索引,可以依据不同索引对子批量数据进行逐条的扫描,导入到临时表中,保证了数据导入的全面性。
如一个子批量数据包括两个新的键,投保业务A和投保业务B,将每一子批量数据发送给对应的Reduce(归约)函数后,Reduce(归约)函数会将每一子批量数据中属于同一个键的值归约到一起,即将投保业务A对应的值归约到一起,投保业务B对应的值归约到一起,形成投保业务A和投保业务B对应的数据表。将形成的投保业务A和投保业务B对应的数据表导入到临时表中进行存储。
在一具体实施方式中,如图3所示,步骤S22,采用M个映射归约函数对N个子批量数据进行导出处理,以将导出的子批量数据存储在临时表中,具体包括如下步骤:
S221:采用N个映射归约函数分别对N个子批量数据进行导出处理,获取每一子批量数据对应的导出处理结果。
具体地,在M个映射归约函数选出N个映射归约函数对N个子批量数据进行一对一导出处理,即每一个归约函数对应一个子批量数据,使得N个子批量数据采用并行导出方式进行处理,以提高数据导出的效率。每一个映射归约函数对应的导出处理结果包括导出成功和导出失败。
S222:若导出处理结果为导出成功时,将导出的子批量数据存储在临时表中。
S223:若导出处理结果为导出失败时,则将导出处理结果为导出失败的子批量数据分配给第N+1个映射归约函数进行导出处理,直至所有导出处理结果均为导出成功时结束。
具体地,在导出过程中,当导出结果为导出失败时,映射归约函数会启动预先设置的重试机制。该重试机制是指在导出结果为导出失败时,将对应的子批量数据放在第N+1个映射归约函数中执行的机制。该大数据快速导入的方法中设置重试机制,可以保证在某一子批量数据的导出处理结果为导出失败时,服务器自动将导出失败的子批量数据放到另外一个空闲的映射归约进程中进行导出处理,提高了数据的导出成功率。
在一具体实施方式中,如图4所示,步骤S30,触发数据监控指令,扫描状态表中的状态参数,具体包括如下步骤:
S31:获取定时触发指令,定时触发指令包括进程ID和触发时间。
定时触发指令是指在oracle数据库管理系统预先设置的定时触发数据监控一个触发 指令,该定时触发指令包括进程ID和触发时间。进程ID是指对原始批量数据进行导出处理的数据监控进程的标识,该进程ID可用于唯一识别对原始批量数据进行导出处理的数据监控进程。触发时间是指预先设置好的一个时间,当系统当前时间到达该预先设置好的时间时,则触发对应的定时触发指令中进程ID对应的数据监控进程。
oracle数据库管理系统预先设置一个定时触发指令,该定时触发指令在oracle数据库管理系统的系统当前时间与预设的触发时间相同时,会触发oracle数据库管理系统设置的数据监控指令,基于数据监控指令,执行步骤S32。
S32:若系统当前时间为触发时间时,触发与进程ID相对应的数据监控进程扫描状态表中的状态参数。
获取定时触发指令后,oracle数据库管理系统会判断该系统当前时间是否与预先设置的触发时间相同。若该当前时间与预先设置的触发时间相同,则触发与进程ID相对应的数据监控进程扫描状态表中的状态参数。当扫描到状态参数为0时,则对该状态表对应的原始批量数据进行导出处理,即同时对该处理状态为待处理状态的原始批量数据进行导出处理。
在一具体实施方式中,步骤S40,将有效批量数据存储到关系型数据库中的目标表中,具体包括如下步骤:将有效批量数据采用归并排序算法进行归并处理,插入到关系型数据库创建的目标表中。
归并排序算法是建立在归并操作上的一种有效的排序算法,也称为merge算法,归并排序算法是指将获取到的有效批量数据和目标表中存储的数据进行匹配查询,匹配成功时则执行更新操作,匹配不成功时则执行插入操作。本实施例中仅采用插入操作对有效批量数据进行插入,即将目标表中不存在的有效批量数据插入到目标表中。
具体地,oracle数据库管理系统获取的有效批量数据和存储在关系型数据库中的目标表进行匹配查询,将匹配不成功的有效批量数据插入到目标表中,即将有效批量数据中存在的数据,但目标表中不存在的数据插入到目标表中。使用归并排序算法将目标表中不存在的有效批量数据插入到目标表中,仅需要做一次全表扫描就可以完成将目标表中不存在的有效批量数据全部插入到目标表中,提高了数据插入的效率。
在一具体实施方式中,在步骤S40,获取有效批量数据,将有效批量数据存储到关系型数据库中的目标表中的步骤之后,该大数据快速导入的方法,还包括:
S50:将已成功插入目标表的有效批量数据的状态参数更改为处理成功状态,并将未成功插入目标表的有效批量数据的状态参数更改为处理失败状态。
具体地,有效批量数据成功插入到目标表中后,有效批量数据对应的状态表中的状态参数为2,表示处理成功状态,有效批量数据没有成功插入到目标表中时,有效批量数据对应的状态表中的状态参数为3,表示处理失败状态。Oracle数据库管理系统基于状态参数,可以辨识有效批量数据插入目标表的处理情况,方便Oracle数据库管理系统对处理失败的有效批量数据及时作出重新插入的反映。
有效批量数据没有成功插入到目标表中的原因包括,临时表太大、插入超时或者网络等原因。若有效批量数据没有成功插入到目标表的原因为临时表有效批量数据太大或者插入超时,则表示插入失败的原因是临时表中的数据量过大,不利于进行插入操作,应该将该临时表的有效批量数据进行拆分,分为多个子有效批量数据插入到目标表中;若插入失败的原因是网络原因,则刷新该临时表的插入进程,将有效批量数据重新插入到目标表中。
本申请提供的大数据快速导入的方法,在大数据管理平台将获取到的每一原始批量数据和对应的状态参数导入到Oracle数据库管理系统中的目标表中时,在Oracle数据库管理系统预先创建临时表和状态表,采用映射规约函数将原始批量数据拆分成N个子批量数据,进行导出处理,提高数据导出效率。Oracle数据库管理系统触发数据监控指令,扫描状态表中的状态参数,获取状态参数为待处理状态对应的待处理批量数据,在将待处理批量数据进行去重处理,以避免重复对该待处理批量数据进行处理,节省处理时间,提高处理效率。然后,采用归并排序算法将有效批量数据和目标表中的数据进行匹配,对匹配不成功的数据插入到目标表中,仅需要做一次全表扫描就可以完成将目标表中不存在的有效批量数据全部插入到目标表中,提高了数据插入执行的效率。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请的实施过程构成任何限定。
实施例2
图2示出与实施例1中大数据快速导入的方法一一对应的大数据快速导入的装置的原理框图。如图2所示,该大数据快速导入的装置包括原始批量数据获取模块10、第一存储模块20、待处理批量数据获取模块30和第二存储模块40。其中,原始批量数据获取模块10、第一存储模块20、待处理批量数据获取模块30、第二存储模块40和状态参数更改模块50的实现功能与实施例中大数据快速导入的方法对应的步骤一一对应,为避免赘述,本实施例不一一详述。
原始批量数据获取模块10,用于获取大数据管理平台发送的至少一个原始批量数据,每一原始批量数据对应一状态参数。
第一存储模块20,用于将每一原始批量数据存储在预先创建的临时表中,并将对应的状态参数存储在状态表中。
待处理批量数据获取模块30,用于触发数据监控指令,扫描状态表中的状态参数,获取状态参数为待处理状态的待处理批量数据。
第二存储模块40,用于对待处理批量数据进行去重处理,获取有效批量数据,将有效批量数据存储到关系型数据库中的目标表中。
优选地,临时表不设置主键和唯一索引。
第一存储模块20包括:子批量数据获取单元21和子批量数据存储单元22。
子批量数据获取单元21,用于采用映射归约函数将每一原始批量数据拆分成N个子批量数据,N≥2。
子批量数据存储单元22,用于采用M个映射归约函数对N个子批量数据进行导出处理,以将导出的子批量数据存储在临时表中,M≥N,其中N、M为正整数。
优选地,子批量数据存储单元22包括导出处理结果获取单元221、第一导出结果处理单元222和第二导出结果处理单元223。
导出处理结果获取单元221,用于采用N个映射归约函数分别对N个子批量数据进行导出处理,获取每一子批量数据对应的导出处理结果。
第一导出结果处理单元222,用于若导出处理结果为导出成功时,将导出的子批量数据存储在临时表中。
第二导出结果处理单元223,用于若导出处理结果为导出失败时,则将导出处理结果为导出失败的子批量数据分配给第N+1个映射归约函数进行导出处理,直至所有导出处理结果均为导出成功时结束。
优选地,待处理批量数据获取模块30包括定时触发指令获取单元31和数据监控进程扫描单元32。
定时触发指令获取单元31,用于获取定时触发指令,定时触发指令包括进程ID和触发时间。
数据监控进程扫描单元32,用于若系统当前时间为触发时间时,触发与进程ID相对应的数据监控进程扫描状态表中的状态参数。
优选地,第二存储模块40,用于将有效批量数据采用归并排序算法进行归并处理,插入到关系型数据库创建的目标表中。
优选地,该大数据快速导入的装置,还包括状态参数更改模块50。
状态参数更改模块50,用于将已成功插入目标表的有效批量数据的状态参数更改为已成功处理状态,并将未成功插入目标表的有效批量数据的状态参数更改为未成功处理状态。
实施例3
本实施例提供一个或多个存储有计算机可读指令的非易失性可读存储介质。该一个或多个存储有计算机可读指令的非易失性可读存储介质中,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行实施例1中大数据快速导入的方法,为避免重复,这里不再赘述。或者,该计算机可读指令被处理器执行时实现实施例2中大数据快速导入的装置中各模块/单元的功能,为避免重复,这里不再赘述。
可以理解地,一个或多个存储有计算机可读指令的非易失性可读存储介质可以包括:能够携带所述计算机可读指令代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号和电信信号等。
实施例4
图6是本申请一实施例提供的终端设备的示意图。如图6所示,该实施例的终端设备60包括:处理器61、存储器62以及存储在存储器62中并可在处理器61上运行的计算机可读指令63。处理器61执行计算机可读指令63时实现上述实施例1中大数据快速导入的方法的步骤,例如图1所示的步骤S10至S50。或者,处理器61执行计算机可读指令63时实现上述实施例2看大数据快速导入的装置的各模块/单元的功能,例如图5所示原始批量数据获取模块10、第一存储模块20、待处理批量数据获取模块30、第二存储模块40和状态参数更改模块50的功能。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。

Claims (20)

  1. 一种大数据快速导入的方法,其特征在于,包括:
    获取大数据管理平台发送的至少一个原始批量数据,每一原始批量数据对应一状态参数;
    将每一所述原始批量数据存储在预先创建的临时表中,并将对应的状态参数存储在状态表中;
    触发数据监控指令,扫描所述状态表中的状态参数,获取状态参数为待处理状态的待处理批量数据;
    对所述待处理批量数据进行去重处理,获取有效批量数据,将所述有效批量数据存储到关系型数据库中的目标表中。
  2. 如权利要求1所述的大数据快速导入的方法,其特征在于,所述临时表不设置主键和唯一索引;
    所述将每一所述原始批量数据存储在预先创建的临时表中,包括:
    采用映射归约函数将每一所述原始批量数据拆分成N个子批量数据,N≥2;
    采用M个映射归约函数对N个所述子批量数据进行导出处理,以将导出的子批量数据存储在所述临时表中,M≥N,其中N、M为正整数。
  3. 如权利要求2所述的大数据快速导入的方法,其特征在于,所述采用M个映射归约函数对N个所述子批量数据进行导出处理,以将导出的子批量数据存储在所述临时表中,包括:
    采用N个映射归约函数分别对N个所述子批量数据进行导出处理,获取每一所述子批量数据对应的导出处理结果;
    若所述导出处理结果为导出成功时,将导出的子批量数据存储在所述临时表中;
    若所述导出处理结果为导出失败时,则将导出处理结果为导出失败的所述子批量数据分配给第N+1个映射归约函数进行导出处理,直至所有导出处理结果均为导出成功时结束。
  4. 如权利要求1所述的大数据快速导入的方法,其特征在于,所述触发数据监控指令,扫描所述状态表中的状态参数,包括:
    获取定时触发指令,所述定时触发指令包括进程ID和触发时间;
    若系统当前时间为所述触发时间时,触发与所述进程ID相对应的数据监控进程扫描所述状态表中的状态参数。
  5. 如权利要求1所述的大数据快速导入的方法,其特征在于,所述将所述有效批量数据存储到关系型数据库中的目标表中,包括;
    将所述有效批量数据采用归并排序算法进行归并处理,插入到关系型数据库创建的目标表中。
  6. 如权利要求1所述的大数据快速导入的方法,其特征在于,在所述获取有效批量数据,将所述有效批量数据存储到关系型数据库中的目标表中的步骤之后,所述大数据快速导入的方法,还包括:
    将已成功插入所述目标表的有效批量数据的状态参数更改为已成功处理状态,并将未成功插入所述目标表的有效批量数据的状态参数更改为处理失败状态。
  7. 一种大数据快速导入的装置,其特征在于,包括:
    原始批量数据获取模块,用于获取大数据管理平台发送的至少一个原始批量数据,每一原始批量数据对应一状态参数;
    第一存储模块,用于将每一所述原始批量数据存储在预先创建的临时表中,并将对应的状态参数存储在状态表中;
    待处理批量数据获取模块,用于触发数据监控指令,扫描所述状态表中的状态参数,获取状态参数为待处理状态的待处理批量数据;
    第二存储模块,用于对所述待处理批量数据进行去重处理,获取有效批量数据,将所述有效批量数据存储到关系型数据库中的目标表中。
  8. 如权利要求7所述的大数据快速导入的装置,其特征在于,所述临时表不设置主键和唯一索引;
    所述第一存储模块包括:
    子批量数据获取单元,用于采用映射归约函数将每一所述原始批量数据拆分成N个子批量数据,N≥2;
    子批量数据存储单元,用于采用M个映射归约函数对N个所述子批量数据进行导出处理,以将导出的子批量数据存储在所述临时表中,M≥N,其中N、M为正整数。
  9. 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现如下步骤:
    获取大数据管理平台发送的至少一个原始批量数据,每一原始批量数据对应一状态参数;
    将每一所述原始批量数据存储在预先创建的临时表中,并将对应的状态参数存储在状态表中;
    触发数据监控指令,扫描所述状态表中的状态参数,获取状态参数为待处理状态的待处理批量数据;
    对所述待处理批量数据进行去重处理,获取有效批量数据,将所述有效批量数据存储到关系型数据库中的目标表中。
  10. 如权利要求9所述的终端设备,其特征在于,所述临时表不设置主键和唯一索引;
    所述将每一所述原始批量数据存储在预先创建的临时表中,包括:
    采用映射归约函数将每一所述原始批量数据拆分成N个子批量数据,N≥2;
    采用M个映射归约函数对N个所述子批量数据进行导出处理,以将导出的子批量数据存储在所述临时表中,M≥N,其中N、M为正整数。
  11. 如权利要求10所述的终端设备,其特征在于,所述采用M个映射归约函数对N个所述子批量数据进行导出处理,以将导出的子批量数据存储在所述临时表中,包括:
    采用N个映射归约函数分别对N个所述子批量数据进行导出处理,获取每一所述子批量数据对应的导出处理结果;
    若所述导出处理结果为导出成功时,将导出的子批量数据存储在所述临时表中;
    若所述导出处理结果为导出失败时,则将导出处理结果为导出失败的所述子批量数据分配给第N+1个映射归约函数进行导出处理,直至所有导出处理结果均为导出成功时结束。
  12. 如权利要求9所述的终端设备,其特征在于,所述触发数据监控指令,扫描所述状态表中的状态参数,包括:
    获取定时触发指令,所述定时触发指令包括进程ID和触发时间;
    若系统当前时间为所述触发时间时,触发与所述进程ID相对应的数据监控进程扫描所述状态表中的状态参数。
  13. 如权利要求9所述的终端设备,其特征在于,所述将所述有效批量数据存储到关系型数据库中的目标表中,包括;
    将所述有效批量数据采用归并排序算法进行归并处理,插入到关系型数据库创建的目标表中。
  14. 如权利要求9所述的终端设备,其特征在于,在所述获取有效批量数据,将所述有效批量数据存储到关系型数据库中的目标表中的步骤之后,所述处理器执行所述计算机可读指令时还实现如下步骤:
    将已成功插入所述目标表的有效批量数据的状态参数更改为已成功处理状态,并将未成功插入所述目标表的有效批量数据的状态参数更改为处理失败状态。
  15. 一个或多个存储有计算机可读指令的非易失性可读存储介质,其特征在于,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器实现如下步骤:
    获取大数据管理平台发送的至少一个原始批量数据,每一原始批量数据对应一状态参数;
    将每一所述原始批量数据存储在预先创建的临时表中,并将对应的状态参数存储在状态表中;
    触发数据监控指令,扫描所述状态表中的状态参数,获取状态参数为待处理状态的待处理批量数据;
    对所述待处理批量数据进行去重处理,获取有效批量数据,将所述有效批量数据存储到关系型数据库中的目标表中。
  16. 如权利要求15所述的非易失性可读存储介质,其特征在于,所述临时表不设置主键和唯一索引;
    所述将每一所述原始批量数据存储在预先创建的临时表中,包括:
    采用映射归约函数将每一所述原始批量数据拆分成N个子批量数据,N≥2;
    采用M个映射归约函数对N个所述子批量数据进行导出处理,以将导出的子批量数据存储在所述临时表中,M≥N,其中N、M为正整数。
  17. 如权利要求16所述的非易失性可读存储介质,其特征在于,所述采用M个映射归约函数对N个所述子批量数据进行导出处理,以将导出的子批量数据存储在所述临时表中,包括:
    采用N个映射归约函数分别对N个所述子批量数据进行导出处理,获取每一所述子批量数据对应的导出处理结果;
    若所述导出处理结果为导出成功时,将导出的子批量数据存储在所述临时表中;
    若所述导出处理结果为导出失败时,则将导出处理结果为导出失败的所述子批量数据分配给第N+1个映射归约函数进行导出处理,直至所有导出处理结果均为导出成功时结束。
  18. 如权利要求15所述的非易失性可读存储介质,其特征在于,所述触发数据监控指令,扫描所述状态表中的状态参数,包括:
    获取定时触发指令,所述定时触发指令包括进程ID和触发时间;
    若系统当前时间为所述触发时间时,触发与所述进程ID相对应的数据监控进程扫描 所述状态表中的状态参数。
  19. 如权利要求15所述的非易失性可读存储介质,其特征在于,所述将所述有效批量数据存储到关系型数据库中的目标表中,包括;
    将所述有效批量数据采用归并排序算法进行归并处理,插入到关系型数据库创建的目标表中。
  20. 如权利要求15所述的非易失性可读存储介质,其特征在于,在所述获取有效批量数据,将所述有效批量数据存储到关系型数据库中的目标表中的步骤之后,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器还实现如下步骤:
    将已成功插入所述目标表的有效批量数据的状态参数更改为已成功处理状态,并将未成功插入所述目标表的有效批量数据的状态参数更改为处理失败状态。
PCT/CN2018/081518 2018-02-27 2018-04-02 大数据快速导入的方法、装置、终端设备及存储介质 Ceased WO2019165671A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810161582.X 2018-02-27
CN201810161582.XA CN108376171B (zh) 2018-02-27 2018-02-27 大数据快速导入的方法、装置、终端设备及存储介质

Publications (1)

Publication Number Publication Date
WO2019165671A1 true WO2019165671A1 (zh) 2019-09-06

Family

ID=63018168

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/081518 Ceased WO2019165671A1 (zh) 2018-02-27 2018-04-02 大数据快速导入的方法、装置、终端设备及存储介质

Country Status (2)

Country Link
CN (1) CN108376171B (zh)
WO (1) WO2019165671A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114138447A (zh) * 2021-12-08 2022-03-04 北京百度网讯科技有限公司 任务处理方法、装置、设备以及存储介质

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110297578B (zh) * 2019-06-27 2021-06-25 北京金山安全软件有限公司 批量处理海量数据中部分数据的方法、装置及电子设备
CN110781231B (zh) * 2019-09-19 2023-07-21 平安科技(深圳)有限公司 基于数据库的批量导入方法、装置、设备及存储介质
CN113722277A (zh) * 2020-05-25 2021-11-30 中兴通讯股份有限公司 一种数据导入方法、装置、服务平台及存储介质
US11573936B2 (en) * 2020-08-12 2023-02-07 International Business Machines Corporation Method for loading data in a target database system
CN112506866A (zh) * 2020-10-10 2021-03-16 浪潮云信息技术股份公司 一种适用于大数据量文件的导入方法
CN112463769A (zh) * 2020-12-11 2021-03-09 中国人寿保险股份有限公司 一种HBase大批量数据删除方法、装置、电子设备和存储介质
CN113222703B (zh) * 2021-05-20 2023-04-07 青岛海信智慧生活科技股份有限公司 一种商品图片批量上传方法及装置
CN113505115B (zh) * 2021-07-07 2025-01-24 北京金山云网络技术有限公司 一种数据批量导入方法、装置及电子设备
CN114064783B (zh) * 2021-12-02 2024-12-20 建信金融科技有限责任公司 一种导入数据的方法、装置、电子设备及存储介质
CN115017157A (zh) * 2022-05-30 2022-09-06 中国银行股份有限公司 基于并发场景的导表方法及装置
CN115238664A (zh) * 2022-07-01 2022-10-25 富盛科技股份有限公司 一种表格数据批量汇入方法、装置、设备和介质
CN115309821A (zh) * 2022-08-03 2022-11-08 南瑞轨道交通技术有限公司 大数据平台主数据实时同步方法及系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040078398A1 (en) * 2002-10-18 2004-04-22 Taiwan Semiconductor Manufacturing Co., Ltd. System and method to enhance availability of a relational database
CN104424229A (zh) * 2013-08-26 2015-03-18 腾讯科技(深圳)有限公司 一种多维度拆分的计算方法及系统
CN106649455A (zh) * 2016-09-24 2017-05-10 孙燕群 一种大数据开发的标准化系统归类、命令集系统
CN106874334A (zh) * 2016-08-12 2017-06-20 阿里巴巴集团控股有限公司 一种数据处理方法及装置、资讯处理系统

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100498719C (zh) * 2006-12-30 2009-06-10 中国建设银行股份有限公司 一种执行批处理作业的方法及装置
CN106649646A (zh) * 2016-12-09 2017-05-10 北京锐安科技有限公司 一种数据去重的方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040078398A1 (en) * 2002-10-18 2004-04-22 Taiwan Semiconductor Manufacturing Co., Ltd. System and method to enhance availability of a relational database
CN104424229A (zh) * 2013-08-26 2015-03-18 腾讯科技(深圳)有限公司 一种多维度拆分的计算方法及系统
CN106874334A (zh) * 2016-08-12 2017-06-20 阿里巴巴集团控股有限公司 一种数据处理方法及装置、资讯处理系统
CN106649455A (zh) * 2016-09-24 2017-05-10 孙燕群 一种大数据开发的标准化系统归类、命令集系统

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114138447A (zh) * 2021-12-08 2022-03-04 北京百度网讯科技有限公司 任务处理方法、装置、设备以及存储介质

Also Published As

Publication number Publication date
CN108376171A (zh) 2018-08-07
CN108376171B (zh) 2020-04-03

Similar Documents

Publication Publication Date Title
WO2019165671A1 (zh) 大数据快速导入的方法、装置、终端设备及存储介质
CN113312338A (zh) 数据一致性的校验方法、装置、设备、介质及程序产品
WO2021051627A1 (zh) 基于数据库的批量导入方法、装置、设备及存储介质
CN107622091A (zh) 一种数据库查询方法和装置
US12001450B2 (en) Distributed table storage processing method, device and system
CN110647562B (zh) 一种数据查询方法和装置、电子设备、存储介质
CN112912870A (zh) 租户标识符的转换
CN116089527B (zh) 一种数据校验方法、存储介质与设备
WO2016169237A1 (zh) 数据处理方法及装置
CN108153852A (zh) 一种数据处理方法、装置、终端设备及存储介质
CN106326222A (zh) 一种数据处理方法和装置
CN108121774B (zh) 一种数据表备份方法及终端设备
WO2025138618A1 (zh) 存储数据的修复方法、装置、系统、电子设备及存储介质
CN115495620A (zh) 基于图结构的数据管理方法及相关设备
CN115543966A (zh) 数据库结构的并发迁移方法、装置、设备及存储介质
CN107577787B (zh) 关联数据信息入库的方法及系统
CN115454969A (zh) 数据迁移方法、装置、计算机设备和存储介质
CN103970792A (zh) 一种基于索引进行文件比对的方法和装置
CN114579530A (zh) 表空间迁移方法、装置、电子设备及计算机可读存储介质
CN108255946B (zh) 一种镭雕设备的编码管理方法及装置、设备及存储介质
CN116450607B (zh) 数据处理方法、设备及存储介质
CN111427868A (zh) 数据库迁移中操作请求的处理方法、装置和电子设备
CN107085571B (zh) 一种校验规则的执行方法和装置
CN116846670A (zh) 网络安全配置策略的生成方法、装置和计算机设备
CN110851437A (zh) 一种存储方法、装置及设备

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 15/12/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18908149

Country of ref document: EP

Kind code of ref document: A1