Hive整合HBase

前提条件: hadoop hive hbase  将hive的 hive-hbase-handler-.jar 复制到hbase/lib

  1.hadoop hive hbase 都已安装 且成功启动

  2. 进入hive启动hive :./hive

  3.j进入hbhbase启动hbase : hbase shell

 4.在hive中输入create table t_student(id int,name string) stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' with serdeproperties("hbase.columns.mapping"=":key,st1:name") tblproperties("hbase.table.name"="t_student","hbase.mapred.output.outputtable" = "t_student");

4.1:show tables;

4.2:describe t_student;

5.hbase中输入

5.1:list  

5.2:describe ‘t_student’    ---查看表的描述

5.3:put 't_student','1001','st1:name','zhangsan'    -----向表中添加一条数据

5.4:scan 't_student' --查看表中内容 扫描

6.再切换到hive 输入select * from t_student;

此时的hive与hbase的融合 基础就完成了

问题1:ERROR: KeeperErrorCode = NoNode for /hbase/master

在hbase下使用list或者相关命令 会出现 上述错误  解决办法:

在hbase-site.xml中添加:


        hbase.tmp.dir
        /hbase/tmp
        Temporary directory on the local filesystem.
问题2:FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT' at line 1)

解决办法:mysql 的驱动与hive不匹配 换掉hive/bin目录中的mysql驱动  用这个mysql-connector-java-5.1.38

你可能感兴趣的:(BigDate,Hive整合HBase,hbase,hive,KeeperErrorCode,Execution,Error)