SeaSky0606

#step1: create hive table \'t_test\'
hive -e "
create table test.t_user(id int,name string,age int)
row format delimited
fields terminated by \'\t\';
"

#step2: prepare dataset and load into hive table \'t_test\'
cat /tmp/t_user.txt
----------------------
101 Jack 12
102 Michael 18
103 John 21
104 July 20

hive -e "
load data local inpath \'/tmp/t_user.txt\' overwrite into table test.t_user;
"

#step3: create hbase mapping table \'t_user\'
echo "create \'t_user\',\'i\'" | hbase shell


#step4: create external hive table \'t_user_hbase\' related with hbase table \'t_uesr\'
hive -e "
create external table test.t_user_hbase(id int, name string, age int)
STORED BY \'org.apache.hadoop.hive.hbase.HBaseStorageHandler\'
WITH SERDEPROPERTIES (\'hbase.columns.mapping\' = \':key,i:name,i:age\')
TBLPROPERTIES(\'hbase.table.name\' = \'t_user\');
"

#step5: copy data from hive raw table \'t_user\' to hbase table \'t_user\'
hive -e "
insert overwrite table test.t_user_hbase select id,name,age from test.t_user;
"

分类:

技术点:

相关文章:

  • 2021-09-07
  • 2021-09-30
  • 2021-10-06
  • 2021-07-02
  • 2018-05-07
  • 2021-09-11
  • 2021-11-30
猜你喜欢
  • 2021-11-01
  • 2021-07-25
  • 2021-11-01
  • 2021-11-01
  • 2021-11-01
  • 2021-01-25
相关资源
相似解决方案