zoukankan      html  css  js  c++  java
  • 数据从HDFS-->HIVE-->HBASE 执行过程

    1、数据已经load进去hdfs
    
    2、hive、hbase已经安装成功(我用的是hadoop 2.4 hbase 0.98.12  hive 1.2.13、开始!
    
    4、在hive建立表同时生成对应的一张Hbase表,分别在hive和hbase用show tables;和list查看是否生成对应的表
    
    create table hive3 (key string,phone string,price int,room string,large string,floor string,n string,site string,compay string)
    
    STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
    
    WITH SERDEPROPERTIES
    
    ("hbase.columns.mapping" = ":key,info:phone,info:price,info:room,info:large,info:floor,info:n,info:site,info:compay") TBLPROPERTIES ("hbase.table.name"="hive_hbase3");
    
    5、建立一张hive表,用来存放hdfs打入的数据,我这里是以‘|’分割的数据
    
    ​create table hive2(id string,home string,name string,phone string,price int,room string,large string,floor string,n string,site string,compay string) row format delimited fields terminated by '|' lines terminated by '
    ' stored as textfile;​
    
    6、把已经存在于hdfs的数据load进去hive,
    
    命令:load data local inpath '' into table xxx;​
    
    7、select * from xxx(5 建立的表);
    
    8、insert into hive3 (key,phone,price ...) 
    
         select CONCAT(unix_timestamp(),"-",id,"-",name) ​ as key ,phone,price ... from hive2;
    
    (注:我这里是时间戳+id+name 组合成的key)
    
    9、分别count一下数据,看数据是不是正确的   hbase里面可以scan一下或者count一下
    
    
    
    原创:转载注明出处!​
  • 相关阅读:
    2019年9月笔记
    2019年8月笔记
    2019年7月笔记
    2019年5月笔记
    2019年6月笔记
    2019年4月笔记
    JAVA MAC 配置
    ionic3 打包发布,以安卓说明
    Workman websocket 握手连接
    关于mysql数据库的表概况 ,查看表状态
  • 原文地址:https://www.cnblogs.com/tnsay/p/5753547.html
Copyright © 2011-2022 走看看