zoukankan      html  css  js  c++  java
  • hive与hbase关联

     1 进入hbase: hbase shell
     2 进入HIVE: hive
     3 
     4 hbase中建一张t_student_info表,添加两个列族
     5 create 't_student_info','st1','st2'
     6 
     7 hbase查看表结构
     8 describe 't_student_info'
     9 
    10 
    11 
    12 hive 创建外部表要使用EXTERNAL 关键字
    13 create external table t_student_info(
    14      id int
    15     ,age int
    16     ,sex string
    17 ) 
    18 stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' 
    19 with serdeproperties("hbase.columns.mapping"=":key,st1:age,st2:sex") 
    20 tblproperties("hbase.table.name"="t_student_info")
    21 ;
    22 
    23 
    24 hbase t_student_info 中添加数据
    25 put 't_student_info','1001','st2:sex','man'
    26 put 't_student_info','1001','st1:age','20'
    27 put 't_student_info','1002','st1:age','18'
    28 put 't_student_info','1002','st2:sex','woman'
    29 
    30 hive 数据查询
    31 select * from t_student_info;
  • 相关阅读:
    六、Redis主从复制 
    五、AOF持久化
    四、RDB持久化
    三、数据类型
    二、redis的配置文件介绍
    第八章、堆
    九、补充
    八、Filter
    七、监听器和国际化
    六、JDBC
  • 原文地址:https://www.cnblogs.com/chenzechao/p/8624031.html
Copyright © 2011-2022 走看看