zoukankan      html  css  js  c++  java
  • Hive集成HBase实践

    #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 ' ';
    "

    #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;
    "

  • 相关阅读:
    activity生命周期
    logcat
    URI
    intent Filter
    隐式intent
    intent
    訪问远程WAMP 下phpmyadmin
    CFileDialog的使用方法简单介绍
    JAVA wait(), notify(),sleep具体解释
    Android开发之去掉标题栏的三种方法,推荐第三种
  • 原文地址:https://www.cnblogs.com/SeaSky0606/p/8878545.html
Copyright © 2011-2022 走看看