标签:key .com 图片 zook 精品 enable english ant base
cd /home/hbase/lib cp ./* /home/hive/lib
cp /home/hive/lib/hive-hbase-handler-0.13.1.jar /home/hbase/lib/
cd /home/hive/conf vi hive-site.xml <!-- Hbase zookeeper quorum --> <property> <name>hbase.zookeeper.quorum</name> <value>node1,node2,node3</value> </property>
--在Hbase中创建表 create ‘hbase_to_hive_t_user‘, ‘cf_user_info‘ hbase(main):010:0> desc ‘hbase_to_hive_t_user‘ Table hbase_to_hive_t_user is ENABLED COLUMN FAMILIES DESCRIPTION {NAME => ‘cf_user_info‘, DATA_BLOCK_ENCODING => ‘NONE‘, BLOOMFILTER => ‘ROW‘, REPLICATION_S COPE => ‘0‘, VERSIONS => ‘1‘, COMPRESSION => ‘NONE‘, MIN_VERSIONS => ‘0‘, TTL => ‘FOREVER‘, KEEP_DELETED_CELLS => ‘FALSE‘, BLOCKSIZE => ‘65536‘, IN_MEMORY => ‘false‘, BLOCKCACHE => ‘ true‘} 1 row(s) in 0.0650 seconds
--插入数据 put ‘hbase_to_hive_t_user‘, ‘1‘, ‘cf_user_info:name‘,‘Tom‘ put ‘hbase_to_hive_t_user‘, ‘1‘, ‘cf_user_info:age‘,24 put ‘hbase_to_hive_t_user‘, ‘2‘, ‘cf_user_info:name‘,‘John‘ put ‘hbase_to_hive_t_user‘, ‘2‘, ‘cf_user_info:age‘,18 put ‘hbase_to_hive_t_user‘, ‘3‘, ‘cf_user_info:name‘,‘Steven‘ put ‘hbase_to_hive_t_user‘, ‘3‘, ‘cf_user_info:age‘,38 scan ‘hbase_to_hive_t_user‘ hbase(main):009:0> scan ‘hbase_to_hive_t_user‘ ROW COLUMN+CELL 1 column=cf_user_info:age, timestamp=1546754368046, value=24 1 column=cf_user_info:name, timestamp=1546754367972, value=Tom 2 column=cf_user_info:age, timestamp=1546754368166, value=18 2 column=cf_user_info:name, timestamp=1546754368103, value=John 3 column=cf_user_info:age, timestamp=1546754370447, value=38 3 column=cf_user_info:name, timestamp=1546754368211, value=Steven 3 row(s) in 0.1600 seconds
--如果你想要Hive去访问Hbase中已经存在的表,你可以创建外部表(CREATE EXTERNAL TABLE) CREATE EXTERNAL TABLE hive_access_hbase_table_t_user (key string, name string, age int) STORED BY ‘org.apache.hadoop.hive.hbase.HBaseStorageHandler‘ WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf_user_info:name,cf_user_info:age") TBLPROPERTIES ("hbase.table.name" = "hbase_to_hive_t_user");
select * from hive_access_hbase_table_t_user; hive> select * from hive_access_hbase_table_t_user; OK 1 Tom 24 2 John 18 3 Steven 38 Time taken: 0.325 seconds, Fetched: 3 row(s)
https://blog.csdn.net/qq_33689414/article/details/80328665
https://blog.csdn.net/aaronhadoop/article/details/28398157
========================================================
More reading,and english is important.
I‘m Hongten
大哥哥大姐姐,觉得有用打赏点哦!你的支持是我最大的动力。谢谢。
Hongten博客排名在100名以内。粉丝过千。
Hongten出品,必是精品。
E | hongtenzone@foxmail.com B | http://www.cnblogs.com/hongten
========================================================
标签:key .com 图片 zook 精品 enable english ant base
原文地址:https://www.cnblogs.com/hongten/p/hongten_hive_with_hbase.html