[Software]
HBase 0.98.5
[Reference]
https://cwiki.apache.org/confluence/display/Hive/HBaseIntegration#HBaseIntegration-Introduction (Hive HBase Integration)
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Cli#LanguageManualCli-HiveCommandLineOptions
(Hive Command and Hive Shell Command)
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL (Hive DDL)
Step:
- Create Hive script called (hive-script.sql)
$nano hive-script.sql :
CREATE TABLE hbase_table_1(key int, value string)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:val")
TBLPROPERTIES ("hbase.table.name" = "hiveTableonHB");
- Execute the sql script :
$hive -f hive-script.sql #This command only execute the sql file and won't start up hive shell
- Check the result :
$hive
hive> DESCRIBE hbase_table_1; #then show following
OK
key int from deserializer
value string form diserializer
Time taken: 0.948 seconds, Fetched: 2 row(s)
hive> quit;
$hbase shell
hbase> list
hiveTableonHB
1 row(s) in 1.0810 seconds
沒有留言:
張貼留言