zoukankan      html  css  js  c++  java
  • 创建hive整合hbase的表总结

    [Author]: kwu 

    创建hive整合hbase的表总结。例如以下两种方式:

    1、创建hive表的同步创建hbase的表

    CREATE  TABLE stage.hbase_news_company_content(key string comment "流水号",
    news_id string comment "新闻id",
    news_content string comment "文章内容")   
    STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'   
    WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:news_id,cf1:news_content")   
    TBLPROPERTIES("hbase.table.name" = "news_company_content");
    

    这样的方式创建hive表,删除hive的表。hbase的表的数据也会被删除


    2、外表创建hive表整合hbase的表

    须要先创建hbase的表:

    create 'jsActionPage','cf1'

    创建hive的外表

    CREATE EXTERNAL TABLE ods.hbase_jsActionPage(key string, bdcCookieId string ,
    pcScreenRatio string ,
    pageCloseTime string ,
    pageLoadCompleteTime string,
    pageOpenTime string,
    currentURL string)   
    STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'   
    WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf1:bdcCookieId,cf1:pcScreenRatio,
    cf1:pageCloseTime,
    cf1:pageLoadCompleteTime,
    cf1:pageOpenTime,
    cf1:currentURL")   
    TBLPROPERTIES("hbase.table.name" = "jsActionPage"); 
    

    3、假设往hive整合hbase的表中插入数据

    SQL方式:

    insert into stage.hbase_news_company_content select a,b,c from stage.tracklog limit 15;


    hbase命令

    put 'jsActionPage','row1','cf1:time','20150818'



  • 相关阅读:
    百度打不开
    欢迎大家来到华网科技
    可扩展消息出席协议:核心 RFC 3920
    谈网站的黏度
    手机游戏沙龙7月11日谈话记录
    基于开源软件做个和GTalk聊天的小命令行程序
    WAP网站推广
    算法的魅力
    JSP技术在WAP开发中的应用
    在J2ME实现UTF8转换为Unicode编码的方法
  • 原文地址:https://www.cnblogs.com/yxysuanfa/p/7111747.html
Copyright © 2011-2022 走看看