Hbase database operation method and device, equipment, storage medium and program product

By obtaining the user's SQL operation request in the Hbase database, mapping it to a relational database and using SQL statements to operate, the complexity and performance problems of Hbase database operations are solved, and convenient and efficient database operations and ACID transaction support are achieved.

CN118673052APending Publication Date: 2024-09-20ZHONGJINKE INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410755836.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

Hbase database operations have high technical barriers and are inconvenient to use, especially in complex queries and aggregation operations, with limited performance and lack of complete ACID transaction support.

Method used

By obtaining the user's SQL operation request on the web page, the Hbase database is mapped to a relational database, and SQL statements are used to operate it, an operation plan is generated, and the operation plan is converted into an Hbase API call to realize the operation of the Hbase database.

Benefits of technology

It lowers the technical threshold for Hbase database operations, improves operational convenience and ease of use, operates Hbase database through SQL statements, improves operational efficiency and accuracy, and supports ACID transactions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118673052A
    Figure CN118673052A
Patent Text Reader

Abstract

The invention provides an Hbase database operation method and apparatus, a device, a storage medium and a program product. The method comprises the steps of obtaining a structured query language (SQL) operation request input by a user on a web page; the SQL operation request comprises related information of an Hbase database to be operated; determining the to-be-operated Hbase database according to the SQL operation request, performing mapping processing on data in the to-be-operated Hbase database, and determining a mapped relational database and data; and operating the data in the relational database by adopting an SQL (Structured Query Language) statement, and determining target data of an Hbase type. By adopting the method and the device, the convenience of operating the Hbase database can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to an Hbase database operation method, device, equipment, storage medium and program product. Background Art

[0002] Hbase is a distributed, column-oriented open source database. Unlike general relational databases, HBase is a database suitable for storing unstructured data, and HBase is column-based rather than row-based. Hbase technology can be used to build a large-scale data storage cluster on the server to store and process large data.

[0003] In the related art, when operating an Hbase database, users are generally required to use operation syntax related to the Hbase database to operate the Hbase database. For example, users need to use Hbase shell operations / commands and Hbasejava API (Application Programming Interface) interface to operate the Hbase database to implement operations such as adding, deleting, modifying and querying the Hbase database.

[0004] However, the above-mentioned operation method for the Hbase database has the problem of inconvenient operation. Summary of the invention

[0005] The present invention provides an Hbase database operation method, device, equipment, storage medium and program product, which are used to solve the defect of inconvenient Hbase database operation in the prior art and achieve the technical effect of improving the convenience of Hbase database operation.

[0006] The present invention provides an Hbase database operation method, comprising: Obtaining a structured query language SQL operation request entered by a user on a web page; the SQL operation request includes relevant information of the Hbase database to be operated; Determine the Hbase database to be operated according to the SQL operation request, and map the data in the Hbase database to be operated to determine the relational database and data after mapping; Use SQL statements to operate on the data in the relational database and determine the target data of Hbase type.

[0007] According to an Hbase database operation method provided by the present invention, the above-mentioned determining the Hbase database to be operated according to the SQL operation request includes: Compile and optimize the SQL operation request to generate an operation plan for operating the Hbase data to be operated; convert the operation plan into an application programming interface API call command, and call the Hbase database to be operated according to the API call command to obtain the Hbase database to be operated.

[0008] According to an Hbase database operation method provided by the present invention, the data in the Hbase database to be operated is mapped and processed to determine the relational database and data after mapping, including: Map the table structure in the Hbase database to be operated to obtain the mapped relational table structure; Preprocess the data in the Hbase database to be operated and determine the preprocessed data; Map the preprocessed data and determine the relational database and data after mapping.

[0009] According to an Hbase database operation method provided by the present invention, the mapping process is performed on the pre-processed data to determine the mapped relational database and data, including: Perform field mapping processing on the preprocessed data, and perform index mapping processing on the preprocessed data, and determine the relational database and data after mapping.

[0010] According to an Hbase database operation method provided by the present invention, the above-mentioned use of SQL statements to operate data in a relational database to determine Hbase type target data includes: Use SQL statements to operate on data in a relational database to obtain candidate data of SQL type; Perform data type conversion on the candidate data to determine the target data of Hbase type.

[0011] An Hbase database operation method provided by the present invention also includes: Print the target data of Hbase type to the log; The print results in the log are transmitted back to the web page for display; the print results include the target data of Hbase type.

[0012] The present invention also provides an Hbase database operating device, comprising: The acquisition module is used to acquire the structured query language SQL operation request entered by the user on the web page; the above SQL operation request includes relevant information of the Hbase database to be operated; A mapping module is used to determine the Hbase database to be operated according to the SQL operation request, and to map the data in the Hbase database to be operated, and to determine the relational database and data after mapping; The operation module is used to operate the data in the relational database using SQL statements to determine the target data of Hbase type.

[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the above-mentioned Hbase database operation methods is implemented.

[0014] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the Hbase database operation method described above is implemented.

[0015] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned Hbase database operation methods.

[0016] The Hbase database operation method, device, equipment, storage medium and program product provided by the present invention obtain the SQL operation request input by the user on the web page, and determine the Hbase database to be operated based on the relevant information of the Hbase database to be operated in the SQL operation request, and then map the data in the Hbase database to be operated to determine the mapped relational database and data, and then use SQL statements to operate the data in the relational database to determine the Hbase type of data. In this method, the Hbase database is mapped to a relational database based on the SQL operation request, and then the mapped relational database is operated using SQL statements to obtain Hbase type data, so that the Hbase database can be operated through SQL statements, which can reduce the technical threshold of Hbase database operators and improve the convenience and ease of operation of Hbase database; at the same time, operating through a web page will further improve the convenience of operating the Hbase database. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0018] Figure 1 This is one of the flow charts of the Hbase database operation method provided by the present invention.

[0019] Figure 2 This is the second flow chart of the Hbase database operation method provided by the present invention.

[0020] Figure 3 This is the third flow chart of the Hbase database operation method provided by the present invention.

[0021] Figure 4 It is a schematic diagram of mapping the Hbase database provided by the present invention to a relational database.

[0022] Figure 5 This is the fourth flow chart of the Hbase database operation method provided by the present invention.

[0023] Figure 6 It is a detailed flow chart of the Hbase database operation provided by the present invention.

[0024] Figure 7 It is a structural schematic diagram of the Hbase database operating device provided by the present invention.

[0025] Figure 8 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are 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.

[0027] Hbase is a highly reliable, high-performance, column-oriented, scalable distributed storage system. Using Hbase technology, a large-scale structured storage cluster can be built on a cheap PC Server (Personal Computer Server) to store and process large data. It is precisely by using this feature that various companies have used Hbase to build their own big data platform online read and write service capabilities to support business scenarios for massive data read and write access. In the related technology, in the Hbase data operation process, common data operations such as querying a row of data in a table, querying a row of data in a specified column family, querying a row of data in a specified column family and column name, querying all data in a table, and updating data require users to master the syntax of Hbase shell operations / commands and even the usage of Hbase java API interfaces. This technical threshold greatly reduces the ease of use and convenience of Hbase. In addition, since HBase is not designed for SQL queries, HBase may be subject to performance limitations in complex queries and aggregation operations. Especially in the case of processing complex connections and data scanning, performance is affected to a certain extent, and HBase itself does not provide complete ACID transaction support. Although the method involved provides transaction support, there will also be performance limitations. Based on this, the embodiments of the present invention provide an Hbase database operation method, device, equipment, storage medium and program product, which can solve the technical problem.

[0028] The above ACID refers to the four characteristics that a database management system (DBMS) must have to ensure that transactions are correct and reliable during the process of writing or updating data: atomicity (or indivisibility), consistency (consistency), isolation (also known as independence), and durability.

[0029] Combine the following Figure 1-Figure 6 The Hbase database operation method of the present invention is described.

[0030] It should be noted that the executor of the following embodiments of the present invention may be an electronic device, or a terminal or server including the electronic device, or an Hbase database operating device including the electronic device. The following embodiments take the electronic device as an example to illustrate the Hbase database operating method of the present invention.

[0031] Figure 1 This is one of the flow charts of the Hbase database operation method provided by the present invention, such as Figure 1 As shown, the method may include the following steps: S102, obtaining a structured query language SQL operation request input by a user on a web page; the above SQL operation request includes relevant information of the Hbase database to be operated.

[0032] The web page is a visual interface provided by the present invention, and includes controls for user operation and display, such as "SQL edit box", "execute button" and "result display box". The "SQL edit box" is used to provide an entry for users to input SQL statements, the "execute button" is used to transmit the SQL statements input by users to the backend for execution to operate the Hbase database, and the "result display box" is used to display the results of the operation on the Hbase database through the SQL statement.

[0033] Specifically, the user can enter the operation request that he wants to perform on the Hbase database in the "SQL edit box" on the web page. After the user enters the operation request, the parsing query SQL control module in the electronic device can obtain the operation request entered by the user, which is recorded as the SQL operation request. The SQL operation request here refers to the operation request performed using an SQL statement, and the SQL operation request represents the operation request to be performed on the Hbase database, which may include relevant information on the Hbase database to be operated. The relevant information may include the identifier of the Hbase database, the specific operation to be performed on the Hbase database, keywords, table names and other information. The specific operation here may be, for example, a new operation, a delete operation, a modification operation, a query operation, etc. on the Hbase database to be operated.

[0034] In addition, as an optional embodiment, in the above web page, user identity authentication, permission control and access control mechanisms can also be added based on the application layer to better manage and control the web page.

[0035] S104, determining the Hbase database to be operated according to the SQL operation request, and performing mapping processing on the data in the Hbase database to be operated to determine the relational database and data after mapping.

[0036] Among them, relational databases store data in the form of tables or tables, and manage and query these data through SQL. In a relational database, data is stored in the form of rows and columns, and this format makes the data easy to understand and process. Relational databases use constraints such as primary keys and foreign keys to represent the relationship between data, thereby achieving accurate management and retrieval of data. For the above-mentioned relational database, it can include SQL database, MySQL database, Oracle database and SQLServer database, etc.

[0037] Specifically, after obtaining the SQL operation request input by the user, the corresponding Hbase database to be operated can be found according to the relevant information of the Hbase to be operated in the SQL operation request. Then the Hbase database to be operated can be mapped to a relational database, specifically, the data, data structure, library structure and other contents in the Hbase database to be operated are mapped to the relational database model, and the relational database corresponding to the Hbase database to be operated is obtained, and the data in the relational database is obtained at the same time. The data, data structure, library structure and other contents in the relational database are all relational database type data, data structure and library structure, which can facilitate users to use SQL statements for operation without having to learn Hbase-related database operation methods, thereby lowering the technical threshold.

[0038] S106, using SQL statements to operate on the data in the relational database to determine the target data of Hbase type.

[0039] In this step, as mentioned above, the Hbase database to be operated can be mapped to a relational database, so the SQL statement in the above SQL operation request can be used to perform corresponding operations on the relational database, and corresponding operation data can be obtained after the operation. After obtaining the operation data, since the data obtained by operating in the relational database is generally also relational data, the operation data can be converted into Hbase type data here and recorded as target data, thereby obtaining Hbase type target data for operating the Hbase database.

[0040] For example, the following are some common SQL statements to operate Hbase database: 1. Create a table: CREATE TABLE IF NOT EXISTS us_population1( state CHAR(2)NOT NULL, city ​​VARCHAR NOT NULL, population BIGINT CONSTRAINT my_pk PRIMARY KEY(state,city)); 2. Insert records upsert into us_population values('NY','NewYork',8143197); 3. Query records select*from us_population where state='NY'; 4. Delete records delete from us_population where state='NY'; 5. Delete table drop table us_population; 6. Exit the command line ! Quit It should be noted that the above-mentioned electronic device may include a general SQL device. By default, the table created directly in the HBase backend cannot be operated through the above-mentioned general SQL device. Therefore, if you want to operate the table created directly in the HBase backend stock in the device of the present invention, you need to map the table in the sql editor of the device. When a table already exists in HBase, you can create an associated table in a similar way to creating a view. You only need to change create view to create table. If the stock table created in Hbase is test1, create an associated table in the front-end page of this device: create table "test1" (empid varchar primary key,"name"."firstname"varchar,"name"."lastname"varchar,"company"."name"varchar,"company"."address"varchar) column_encoded_bytes = 0; After the associated table is created, the table created in the HBase backend can also perform data operations on the front-end visualization page of this device.

[0041] In addition, in order to facilitate the use of the data of this SQL operation when rolling back or restoring data, as an optional embodiment, a transaction management module can be used to assign a unique identifier to the transaction corresponding to each SQL operation request, and track all operations involved in the transaction corresponding to the SQL operation request. During the execution of the transaction corresponding to each SQL operation request, the transaction manager will record the operation in the log for subsequent use. For the above-mentioned transaction management module, it supports transactions and is responsible for implementing the transaction mechanism, including the guarantee of ACID properties. Its internal structure includes components such as a transaction manager, a log manager, and a lock manager. When a transaction is executed, the transaction manager assigns a unique identifier to the transaction and tracks all operations involved in the transaction. During the execution of the transaction, the transaction manager records these operations in the log for use when rollback or recovery is required. The lock manager coordinates access to shared resources between multiple transactions. If two transactions try to modify the same data item at the same time, the lock manager ensures that only one transaction performs the modification operation, and the other transaction must wait. When the transaction is executed, the transaction manager will update the corresponding status information and release the occupied resources according to the result of transaction submission or rollback.

[0042] From the above description, it can be seen that in this embodiment, users can use SQL statements to operate the Hbase database, so there is no need for users to be proficient in the use of Hbase shell and the use of Hbase java API interface. For users, using SQL statements to operate the database is more flexible, simple, efficient and familiar, thereby reducing the technical threshold for operating the Hbase database and improving the efficiency and accuracy of users' operations on the Hbase database.

[0043] The above Hbase database operation method obtains the SQL operation request input by the user on the web page, and determines the Hbase database to be operated based on the relevant information of the Hbase database to be operated in the SQL operation request, and then maps the data in the Hbase database to be operated to determine the mapped relational database and data, and then uses SQL statements to operate the data in the relational database to determine the Hbase type of data. In this method, the Hbase database is mapped to a relational database based on the SQL operation request, and then the mapped relational database is operated using SQL statements to obtain Hbase type data, so that the Hbase database can be operated through SQL statements, which can reduce the technical threshold of Hbase database operators and improve the convenience and ease of operation of Hbase database; at the same time, operating through a web page will further improve the convenience of operating the Hbase database.

[0044] In the above embodiment, it is mentioned that the Hbase database to be operated can be determined based on the SQL operation request input by the user. The following embodiment describes a feasible way of the determination process.

[0045] Figure 2 This is the second flow chart of the Hbase database operation method provided by the present invention. Figure 2 As shown, the "determining the Hbase database to be operated according to the SQL operation request" in the above S104 may include the following steps: S202, compile and optimize the SQL operation request to generate an operation plan for operating the Hbase data to be operated.

[0046] In this step, after obtaining the SQL operation request, the compilation and optimization control module can be used to compile the SQL operation request to generate a preliminary operation plan. The operation plan here can be an operation strategy for operating the Hbase database, which may include the operation mode, sorting mode, access path (such as access by row or column, etc.) for operating the Hbase data to be operated.

[0047] After the preliminary operation plan is compiled, the preliminary operation plan can be optimized, such as modifying inappropriate content, to obtain a final operation plan. Taking the operation as a query operation as an example, the operation plan here can be a query plan, which can include the query method, sorting method, access path, etc. for querying the Hbase database.

[0048] S204, converting the operation plan into an application programming interface API call command, and calling the Hbase database to be operated according to the API call command to obtain the Hbase database to be operated.

[0049] The API call commands are commands for operating the Hbase database, such as query commands, delete commands, etc.

[0050] Specifically, after obtaining the operation plan as mentioned above, the operation plan can be executed by using a query plan or execution management module. Specifically, the operation plan can be converted into an API call command or instruction of the Hbase database, and then the corresponding Hbase database to be operated and the data in the Hbase database to be operated are queried according to the converted API call command.

[0051] For example, the operation plan can be converted into Hbase API or JDBC, and then the original data can be obtained through Hbase API or JDBC, that is, the database to be operated and the data therein. JDBC (Java Database Connectivity) is a Java database connection, a Java application programming interface (API) that allows Java programs to access relational databases through standard SQL statements. It consists of a set of classes and interfaces written in Java. The main functions of JDBC include establishing a connection with the database, sending statements to operate the database, and processing results.

[0052] In this embodiment, the SQL operation request input by the user is compiled into an operation plan and then converted into an API call command, and then the Hbase database is called based on the API call command to obtain the Hbase database. This can provide a prerequisite for subsequent table mapping and index mapping on the one hand, and on the other hand, the Hbase database can be found relatively quickly without the user having to master the usage of the Hbase-related database. Therefore, the efficiency of finding the Hbase database and the convenience of users operating the Hbase database can be improved.

[0053] The above embodiment illustrates that the corresponding Hbase database can be obtained through an API call command. The following embodiment illustrates the process of mapping the Hbase database to a relational database.

[0054] Figure 3 This is the third flow chart of the Hbase database operation method provided by the present invention, such as Figure 3 As shown, the above S104 of "mapping the data in the Hbase database to be operated and determining the relational database and data after mapping" may include the following steps: S302, mapping the table structure in the Hbase database to be operated to obtain a mapped relational table structure.

[0055] In this step, after obtaining the corresponding Hbase database and the data therein through the API call command, the obtained Hbase database to be operated and the data therein can be returned to the query plan or execution management module, that is, the query plan or execution management module can include the original database and original data of the Hbase type.

[0056] Afterwards, a mapping module may be used to map the original database and original data of the Hbase type in the query plan or execution management module to obtain the mapped relational database and data.

[0057] Specifically, operations such as mapping and structural adjustment may be performed on the table structure in the Hbase database to be operated, so as to convert the table structure in the Hbase database into a table structure of a relational database type, which is recorded as a relational table structure.

[0058] S304, pre-processing the data in the Hbase database to be operated, and determining pre-processed data.

[0059] In this step, after converting the table structure in the Hbase database into a relational table structure, the data in the Hbase database to be operated may be preprocessed to obtain preprocessed data, which is recorded as preprocessed data.

[0060] Optionally, the data preprocessing here may include data cleaning and data verification, such as removing duplicate data, processing missing values, and checking the validity of data, etc. By preprocessing the data, the accuracy, completeness, and consistency of the data can be ensured.

[0061] It should be noted that there is no particular order between the above S302 and S304 , and both can be executed simultaneously or in a certain order, which is not specifically limited here.

[0062] S306, mapping the pre-processed data to determine the relational database and data after mapping.

[0063] In this step, after mapping the table structure of the Hbase database to be operated into a relational table structure and preprocessing the data in the Hbase database to be operated, the preprocessed data can continue to be mapped to map all the data in the Hbase database to be operated into the relational database to obtain the relational database and the data therein.

[0064] As an optional embodiment, when mapping the preprocessed data, the preprocessed data may be subjected to field mapping processing, and the preprocessed data may be subjected to index mapping processing to determine the relational database and data after mapping. In other words, the preprocessed data may be subjected to field and index mapping to map the fields and indexes of the preprocessed data in the Hbase database to be operated to the relational database.

[0065] For the above mapping of Hbase database to relational database, see Figure 4The storage structure mapping example diagram shown can map the Column Family in the Hbase database to the table in the relational database, map the Row Key in the Hbase database to the row and index in the relational database, and map the Qualifier (column identifier / string) in the Hbase database to the column in the relational database.

[0066] The mapping processing of the above mapping module mainly includes table mapping and index mapping. Here, table mapping can be implemented by the mapping module and the metadata management module, and index mapping can be implemented by the mapping module and the index management module. The metadata management module and the index management module are described below respectively.

[0067] 1. Metadata management module, which is responsible for storing metadata information, such as table definition, column family, index, etc. It is also responsible for managing this metadata information, including operations such as creating, modifying and deleting tables, column families and indexes. The metadata management module / metadata manager uses metadata tables, system tables and metadata client components to manage metadata information, and describes metadata through SQL-like system tables. Its internal structure is as follows: Metadata table: The metadata table is an HBase table used to store metadata information, such as table definition, column families, indexes, etc.

[0068] System tables: System tables store special metadata information, system configuration, permissions, sequences, etc.

[0069] Metadata client: is a Java class library used to operate the data in metadata tables and system tables and convert the data into Java object representation.

[0070] When a user executes a DDL (Data Definition Language) statement (such as creating a table), the metadata client will parse the statement and store the relevant information in the metadata table or system table. When a user executes a DML (Data Manipulation Language) statement (such as inserting data), the metadata client will call the data in the metadata table to determine whether the format is correct. If the user needs to query the metadata information of the table, the metadata client will obtain the corresponding information by querying the metadata table.

[0071] 2. Index management module: responsible for maintaining the index (or multi-level index), which includes operations such as creating, modifying and deleting secondary indexes. The index management module / index manager consists of a local index metadata table, a global index metadata table, an index maintenance process and an index wall component. Its internal structure is as follows: Local index metadata: is an HBase table used to store metadata information of secondary indexes, such as index name, index column, index type, etc.

[0072] Global index metadata: is an HBase table used to store metadata information of global secondary indexes, such as the global index name, the name of the table to which it belongs, and index columns.

[0073] Index maintenance: It is a background process responsible for maintaining secondary indexes, such as automatically updating corresponding indexes when inserting or updating records.

[0074] Index Wall: Used to record all transaction logs related to secondary indexes to prevent index damage due to failures.

[0075] When a user executes a create index statement, the index manager parses the statement and stores the index definition in the local index metadata table. If a global index is created, the index definition also needs to be stored in the global index metadata table. When a user executes an insert, update, or delete statement, index maintenance detects whether a secondary index needs to be updated and updates the corresponding index if necessary. Index maintenance obtains index definition information from the local index metadata table and updates index data through the HBase API.

[0076] Specifically, the mapping module can map the table structure of the Hbase database to be operated to a fixed relational table structure in the metadata management module, and the query plan or execution management module can obtain the mapped table structure from the metadata management module when it is needed, and the metadata management module can return the table, column family and other information in the mapped table structure to the query plan or execution management module. At the same time, the mapping module can map the index of the Hbase database to be operated to the index information in a fixed format in the index management module, and the query plan or execution management module can obtain the mapped index information from the metadata management module when it is needed, and the metadata management module can return the mapped index information to the query plan or execution management module.

[0077] In this embodiment, by mapping the table structure and data in the Hbase database to be operated, it can be ensured that the mapped table structure and data can be used accurately and without error; at the same time, the data in the Hbase database is preprocessed, so that the accuracy, completeness and consistency of the data obtained after the Hbase database operation can be ensured. Further, when mapping the data in the Hbase database, the field mapping and the index mapping can be performed, so that the data in the Hbase database can be fully mapped to the relational database, and the accuracy, completeness and consistency of the data mapping can be further improved.

[0078] The following embodiment describes an implementation method of operating a relational database through SQL statements after the relational database is obtained.

[0079] Figure 5 This is a fourth flow chart of the Hbase database operation method provided by the present invention, such as Figure 5 As shown, the above S106 may include the following steps: S402, using SQL statements to operate on the data in the relational database to obtain candidate data of SQL type.

[0080] In this step, after the Hbase database to be operated is mapped to a relational database, the data in the relational database can be operated according to SQL statements. The SQL statements here can be the SQL statements in the SQL operation request input by the user, or can be SQL statements re-entered by the user.

[0081] After operating the data in the relational database according to the SQL statement, the corresponding operation data can be obtained. The operation data obtained here is generally SQL type data, which can be recorded as candidate data. For example, if the SQL statement is an SQL query statement, data can be searched in the relational database according to the SQL query statement to obtain the found SQL type candidate data.

[0082] S404, performing data type conversion processing on the candidate data to determine the target data of Hbase type.

[0083] In this step, after obtaining the candidate data of SQL type in the relational database, the data conversion module can be used to convert the candidate data into Hbase type data. Specifically, the data conversion module can be used to perform data type conversion processing on the candidate data to obtain Hbase type data, which is recorded as target data.

[0084] In addition, the above data conversion module supports most SQL data types, including numeric, character, date, etc., and is mainly responsible for converting these SQL data types into Hbase data types. At the same time, the data conversion module / data type converter can call the corresponding conversion method according to the type of the input parameter, convert the data into the target type and return it. For example, when a Long (long integer) type in HBase needs to be converted into a BIGINT (a long integer in SQL type) type, the program will call the API interface provided by the data type converter as needed to complete the data type conversion.

[0085] Furthermore, after obtaining the target data of the Hbase type, as an optional embodiment, the target data of the Hbase type can also be printed into a log; the printed result in the log is transmitted back to the web page for display; the printed result includes the target data of the Hbase type. Here, storing the data obtained by operating the Hbase database through SQL statements in the log can facilitate the subsequent data search to have a data basis, and at the same time, the data stored in the log is echoed on the web page, which can facilitate the user to intuitively see the data obtained after the operation, and facilitate the user to check the operation results, thereby improving the user's operating experience of the Hbase database operation.

[0086] In this embodiment, by converting the SQL type candidate data obtained after using SQL statements to operate the database, the Hbase type target data is obtained, so that the data of the corresponding type of the Hbase database can be obtained more easily, and the user's operation on the Hbase database and the return of the operation results can be realized.

[0087] A detailed embodiment is given below to illustrate the technical solution of the present invention. Based on the above embodiment, the present invention mainly provides a general SQL device to operate the Hbase database, which may specifically include the following process steps: S1, deploy or prepare a set of general SQL installation programs on the Hbase node (or independent server) of the Hadoop cluster and start it; S2, design the "SQL edit box", "execution button" and "result display box" for operating the Hbase data table in the web front-end page; S3, after the SQL statement is written, click the "Execute" button to pass the SQL statement as a parameter to the Hadoop cluster Hbase node in the back-end deployed device; S4: The SQL statement parameters passed by the front end are executed on the Hbase node back end, and the execution results are printed to the log; S5, the printing result in the log is transmitted back to the "result display box" on the front end, and a data operation is completed.

[0088] Take the above-mentioned general SQL device as SQL query engine application service, web front-end page as web application service, and Hbase database as an example, see Figure 6 As shown in the detailed flow diagram, the above-mentioned general SQL device / SQL query engine application service may include a parsing query SQL control module, a compilation and optimization control module, a transaction management module, a query plan or execution management module, a mapping module, a metadata management module, an index management module and a data conversion module. The functions of each module have been introduced in the above-mentioned embodiments, and will not be repeated here, and only the specific process will be described. The above-mentioned web application service mainly provides web service access, communicates with the client, and forwards the request to the background SQL query engine application service.

[0089] The specific process includes: the user enters a query data request on the web application service page, the web application service forwards the request to the background SQL query engine application service, the SQL query engine application service's parsing query SQL control module receives the request, sends the request to the compilation and optimization control module for compilation and optimization, generates a query plan, and the query plan or execution management module calls Hbase API / JDBC to obtain the original data in the Hbase database according to the generated query plan, and returns the original data to the mapping module for index mapping and table mapping. The index information, table information and mapping relationship are stored in the index management module and metadata module respectively, the metadata management module and the index management module are called to obtain the table, column family and index information, and the information is returned to the query plan or execution management module. After receiving the information, the execution management module transmits it to the data conversion module to filter, sort, convert the data type and other operations, and then returns the query results to the web application service, which are successfully echoed through the web console.

[0090] In addition, the above-mentioned parsing query SQL control module can submit the transaction of each query to the transaction management module (commit transaction, BEGIN TRANSACTION, start transaction), and the transaction management module can send the query request to the compilation and optimization control module for compilation and optimization. In addition, after the compilation and optimization control module generates a query plan and sends it to the query plan or execution management module, the query plan or execution management module can also send the query plan to the transaction management module. After receiving the query plan, the transaction management module can allow the query plan or execution management module to perform database operations according to the query plan.

[0091] It should also be noted that the above Figure 6It is just an example, and the content thereof does not affect the essential content of the embodiments of the present invention.

[0092] In this embodiment, by supporting users to use SQL statements to operate the data of the Hbase database, the technical threshold for Hbase data operation is lowered, and the usability and convenience of the Hbase distributed storage system are improved. At the same time, SQL statements are edited and executed through a visual web interface, and users do not need to log in to the backend Hbase node to operate, thereby reducing the system risks caused by other misoperations by users logging in to the backend Hbase node.

[0093] The Hbase database operation device provided by the present invention is described below. The Hbase database operation device described below and the Hbase database operation method described above can be referred to each other.

[0094] Figure 7 is a schematic diagram of the structure of the Hbase database operation device provided by the present invention, see Figure 7 As shown, the device may include: The acquisition module 710 is used to acquire a structured query language SQL operation request input by a user on a web page; the above SQL operation request includes relevant information of the Hbase database to be operated; A mapping module 720 is used to determine the Hbase database to be operated according to the SQL operation request, and to perform mapping processing on the data in the Hbase database to be operated, and to determine the relational database and data after mapping; The operation module 730 is used to operate the data in the relational database using SQL statements to determine the target data of Hbase type.

[0095] In an exemplary embodiment, the above-mentioned mapping module 720 is specifically used to compile and optimize the SQL operation request to generate an operation plan for operating the Hbase data to be operated; convert the operation plan into an application programming interface API call command, and call the Hbase database to be operated according to the API call command to obtain the Hbase database to be operated.

[0096] In an exemplary embodiment, the above-mentioned mapping module 720 is specifically used to map the table structure in the Hbase database to be operated to obtain the mapped relational table structure; preprocess the data in the Hbase database to be operated to determine the preprocessed data; map the preprocessed data to determine the mapped relational database and data.

[0097] In an exemplary embodiment, the mapping module 720 is specifically used to perform field mapping processing on the preprocessed data and index mapping processing on the preprocessed data to determine the mapped relational database and data.

[0098] In an exemplary embodiment, the operation module 730 is specifically used to operate the data in the relational database using SQL statements to obtain candidate data of SQL type; perform data type conversion processing on the candidate data to determine target data of Hbase type.

[0099] In an exemplary embodiment, the above device further comprises: Print module, used to print Hbase type target data to the log; The display module is used to transmit the printing results in the log back to the web page for display; the above printing results include the target data of Hbase type.

[0100] Figure 8 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 8 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820 and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute the Hbase database operation method, which includes: obtaining a structured query language SQL operation request input by a user on a web page; the above SQL operation request includes relevant information of the Hbase database to be operated; determining the Hbase database to be operated according to the SQL operation request, and mapping the data in the Hbase database to be operated to determine the mapped relational database and data; using SQL statements to operate the data in the relational database to determine the target data of the Hbase type.

[0101] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0102] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the Hbase database operation method provided by the above methods, and the method includes: obtaining a structured query language SQL operation request input by a user on a web page; the above SQL operation request includes relevant information of the Hbase database to be operated; determining the Hbase database to be operated according to the SQL operation request, and mapping the data in the Hbase database to be operated to determine the mapped relational database and data; using SQL statements to operate the data in the relational database to determine the target data of the Hbase type.

[0103] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the Hbase database operation method provided by the above-mentioned methods, the method comprising obtaining a structured query language SQL operation request input by a user on a web page; the above-mentioned SQL operation request includes relevant information of the Hbase database to be operated; determining the Hbase database to be operated according to the SQL operation request, and mapping the data in the Hbase database to be operated to determine the mapped relational database and data; using SQL statements to operate the data in the relational database to determine the target data of the Hbase type.

[0104] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0105] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0106] 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 make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for operating an Hbase database, characterized in that: include: Obtain the structured query language SQL operation request entered by the user on the web page; The SQL operation request includes relevant information of the Hbase database to be operated; Determine the Hbase database to be operated according to the SQL operation request, and perform mapping processing on the data in the Hbase database to be operated to determine the relational database and data after mapping; The data in the relational database is operated by using SQL statements to determine the target data of Hbase type.

2. The Hbase database operation method according to claim 1, characterized in that: The determining the Hbase database to be operated according to the SQL operation request includes: Compile and optimize the SQL operation request to generate an operation plan for operating the Hbase data to be operated; The operation plan is converted into an application programming interface API call command, and the Hbase database to be operated is called according to the API call command to obtain the Hbase database to be operated.

3. The Hbase database operation method according to claim 1 or 2, characterized in that: The mapping process is performed on the data in the Hbase database to be operated to determine the relational database and data after the mapping, including: Mapping the table structure in the Hbase database to be operated to obtain a mapped relational table structure; Preprocess the data in the Hbase database to be operated to determine the preprocessed data; The pre-processed data is mapped to determine the relational database and data after mapping.

4. The Hbase database operation method according to claim 3, characterized in that: The mapping process is performed on the pre-processed data to determine the mapped relational database and data, including: Performing field mapping processing on the preprocessed data and index mapping processing on the preprocessed data to determine a relational database and data after mapping.

5. The Hbase database operation method according to claim 1 or 2, characterized in that: The using of SQL statements to operate the data in the relational database to determine the target data of the Hbase type includes: Using SQL statements to operate on the data in the relational database to obtain candidate data of SQL type; The candidate data is subjected to data type conversion processing to determine the target data of the Hbase type.

6. The Hbase database operation method according to claim 5, characterized in that: Also includes: Print the target data of the Hbase type to the log; The printing result in the log is transmitted back to the web page for display; the printing result includes the target data of the Hbase type.

7. An Hbase database operation device, characterized in that: include: The acquisition module is used to acquire the structured query language SQL operation request entered by the user on the web page; The SQL operation request includes relevant information of the Hbase database to be operated; A mapping module, used to determine the Hbase database to be operated according to the SQL operation request, and perform mapping processing on the data in the Hbase database to be operated to determine the relational database and data after mapping; The operation module is used to operate the data in the relational database using SQL statements to determine the target data of Hbase type.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the Hbase database operation method according to any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the Hbase database operation method according to any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the Hbase database operation method according to any one of claims 1 to 6 is implemented.