The inquiry methods of exhibiting of a kind of Hbase and Hive and systemTechnical field
The present invention relates to Hbase database and Hive instrument, particularly the inquiry methods of exhibiting of a kind of Hbase and Hive and system.
Background technology
Under the background of large data age, the data of process all calculate with T level PB level, and the data of traditional technology to the such order of magnitude of process are gradually unable to do what one wishes, and what arise at the historic moment is exactly the new technology such as Hadoop cluster and Hbase, hive.But the operated client of Hbase and hive is friendly not, do not have certain large data platform to use the people on basis to use, and the displaying of data is also friendly not.So in the project that cloud is single in detail, be the instrument of User Exploitation one with inquiry Hbase and hive of friendly interface according to the demand of user, user needed the data of inquiring about to be saved in csv file and check for user.
Summary of the invention
Technical matters to be solved by this invention is to provide inquiry methods of exhibiting and the system of Hbase and the Hive of the data in a kind of fast and easy inquiry Hive and Hbase database.
The technical scheme that the present invention solves the problems of the technologies described above is as follows: the inquiry methods of exhibiting of a kind of Hbase and Hive, comprises the following steps:
Obtain the query argument of user's input;
According to query argument, the information in Hbase database or Hive instrument is inquired about, obtain Query Result;
Query Result is shown.
The invention has the beneficial effects as follows: along with the development of the similar large data items such as the detailed single stored items of cloud, after having widely used Hbase and hive technology, user cannot inquire about traditional oracle database as instrument such as use Plsql etc. and use.The invention provides such a instrument and user can inquire about some data oneself wanted easily, avoid the inconvenience using hive and Hbase database.
On the basis of technique scheme, the present invention can also do following improvement.
Described query argument is enquiry number or SQL statement.
Describedly according to query argument, the information in Hbase database to be inquired about, obtains Query Result and be specially:
When described query argument is enquiry number, by Hbase interface accessing Hbase database, the information in Hbase database is inquired about by rowkey according to enquiry number;
When described query argument is SQL statement, call hive instrument by the mode of JDBC, according to SQL statement, the information in hive instrument is inquired about.
Further, described Query Result is csv file and TXT text.
Further, also comprise in the inquiry methods of exhibiting of described Hbase and Hive: Query Result is generated a ZIP compressed package.
Further, the inquiry display systems of a kind of Hbase and Hive, comprises acquisition module, enquiry module and display module:
Described acquisition module, for obtaining the query argument of user's input;
Described enquiry module, for inquiring about the information in Hbase database according to query argument, obtains Query Result;
Described display module, for showing Query Result.
Further, the query argument in described acquisition module is enquiry number or SQL statement.
Further, described enquiry module specifically for: when described query argument is enquiry number, by Hbase interface accessing Hbase database, the information in Hbase database is inquired about by rowkey according to enquiry number;
When described query argument is SQL statement, call Hive instrument by the mode of JDBC, according to SQL statement, the information in Hive instrument is inquired about.
Further, described Query Result is csv file and TXT text.
Further, also comprise compression module, for Query Result being generated a ZIP compressed package.
Accompanying drawing explanation
Fig. 1 is the inventive method flow chart of steps;
Fig. 2 is present system structural drawing.
In accompanying drawing, the list of parts representated by each label is as follows:
1, acquisition module, 2, enquiry module, 3, display module, 4, compression module.
Embodiment
Be described principle of the present invention and feature below in conjunction with accompanying drawing, example, only for explaining the present invention, is not intended to limit scope of the present invention.
Embodiment 1
As shown in Figure 1, the inquiry methods of exhibiting of a kind of Hbase and Hive, comprises the following steps:
Obtain the query argument of user's input;
According to query argument, the information in Hbase database is inquired about, obtain Query Result;
Query Result is shown.
Described query argument is enquiry number or SQL statement.
Describedly according to query argument, the information in Hbase database to be inquired about, obtain Query Result to be specially: when described query argument is enquiry number, by Hbase interface accessing Hbase database, the information in Hbase database is inquired about by rowkey according to enquiry number;
When described query argument is SQL statement, access Hbase database by the mode of JDBC, by hive instrument, the information in Hbase database is inquired about according to SQL statement.
Described Query Result is csv file and TXT text.
Also comprise in the inquiry methods of exhibiting of described Hbase and Hive: Query Result is generated a ZIP compressed package.
As shown in Figure 2, the inquiry display systems of a kind of Hbase and Hive, comprises acquisition module 1, enquiry module 2 and display module 3:
Described acquisition module 1, for obtaining the query argument of user's input;
Described enquiry module 2, for inquiring about the information in Hbase database according to query argument, obtains Query Result;
Described display module 3, for showing Query Result.
Query argument in described acquisition module 1 is enquiry number or SQL statement.
Described enquiry module 2 specifically for: when described query argument is enquiry number, by Hbase interface accessing Hbase database, the information in Hbase database is inquired about by rowkey according to enquiry number;
When described query argument is SQL statement, call Hive instrument by the mode of JDBC, according to SQL statement, the information in Hive instrument is inquired about.
Described Query Result is csv file and TXT text.
Also comprise compression module 4, for Query Result being generated a ZIP compressed package.
Concrete in real time in, the present invention adopts jdbc and HbaseAPI to inquire about hive and Hbase, and foreground adopts J2EE framework, uses the friendly page to inquire about.
Step 1: in charge number or the SQL statement of front end input inquiry
Step 2: click inquire button, charge number or SQL statement are passed to backstage, accesses Hbase by HbaseAPI when importing charge number into, by rowkey, Hbase information is inquired about; Access hive client by the mode of JDBC when importing SQL into, by hive, analysis and consult is carried out to SQL statement.
Step 3: Query Result is generated csv file and the carefully and neatly done TXT text of a correspondence, then by csv file and TXT file generated ZIP compressed package.
Step 4: download and obtain Query Result.
Step 5: check Query Result, Query Result is the neat TXT text of csv file and form.
Undertaken arranging querying condition by a part of rowkey, Hbase database is inquired about.Such as: use charge number as querying condition, charge number is just first 20 in rowkey, so just can inquire corresponding result fast by rowkey.
By SQL input, hive is inquired about.
Under the present invention needs to be deployed in tomcat or WebLogic, this main frame needs install JDK and can access Hadoop cluster.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.