`
lucky_xingxing
  • 浏览: 118148 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Hive Hbase integration (整合) 出现zk始终连接 localhost:2181

阅读更多

前提是 hive客户端和zk没在一台机器,hive只是作为客户端使用,没有和hadoop集群在一起。

hive 和 hbase 整合(integration) 的时候,在创建hive关联Hbase表的时候出现如下 zk始终连接localhost:2181,

 

建表语句如下:

---------------------------------------------------------------------------------------------------

 create external table h_table_user3(key int,

     name string,age int,city string)

     STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'

     WITH SERDEPROPERTIES('hbase.columns.mapping'=':key,info:name,info:age,address:city') TBLPROPERTIES ("hbase.table.name" = "user");

 

-----------------------------------------------------------------------------------------------------

hive目录 conf下的hive-site.xml里面和zk相关的全部都已经改过后还是无效。

----------------------------------------------------------------------------------------------------------

<property>

  <name>hive.cluster.delegation.token.store.zookeeper.connectString</name>

  <value>l-hdfsgl2.bi.prod.cn1:2181</value>

  <description>The ZooKeeper token store connect string.</description>

</property>

<property>

  <name>hive.zookeeper.quorum</name>

  <value>l-hdfsgl1.bi.prod.cn1,l-hdfsgl2.bi.prod.cn1,l-hdfscc1.bi.prod.cn1</value>

  <description>The list of zookeeper servers to talk to. This is only needed for read/write locks.</description>

</property>

 

<property>

  <name>hive.zookeeper.client.port</name>

  <value>2181</value>

  <description>The port of zookeeper servers to talk to. This is only needed for read/write locks.</description>

</property>

--------------------------------------------------------------------------------------------------------------------------

以上3个配置全部配置了还是依旧出现连接 localhost:2181

...............................................................................................................................................................

b/stax-api-1.0.1.jar:/usr/local/hive-0.12.0-cdh5.1.2/lib/stringtemplate-3.2.1.jar:/usr/local/hive-0.12.0-cdh5.1.2/lib/tempus-fugit-1.1.jar:/usr/local/hive-0.12.0-cdh5.1.2/lib/velocity-1.5.jar:/usr/local/hive-0.12.0-cdh5.1.2/lib/xz-1.0.jar:/usr/local/hive-0.12.0-cdh5.1.2/lib/zookeeper-3.4.5-cdh5.1.2.jar::/usr/local/hadoop-2.3.0-cdh5.1.2/contrib/capacity-scheduler/*.jar

15/03/11 18:19:04 INFO zookeeper.ZooKeeper: Client environment:java.library.path=/usr/local/hadoop-2.3.0-cdh5.1.2/lib/native

15/03/11 18:19:04 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/tmp

15/03/11 18:19:04 INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA>

15/03/11 18:19:04 INFO zookeeper.ZooKeeper: Client environment:os.name=Linux

15/03/11 18:19:04 INFO zookeeper.ZooKeeper: Client environment:os.arch=amd64

15/03/11 18:19:04 INFO zookeeper.ZooKeeper: Client environment:os.version=2.6.32-358.23.2.el6.x86_64

15/03/11 18:19:04 INFO zookeeper.ZooKeeper: Client environment:user.name=hadoop

15/03/11 18:19:04 INFO zookeeper.ZooKeeper: Client environment:user.home=/home/hadoop

15/03/11 18:19:04 INFO zookeeper.ZooKeeper: Client environment:user.dir=/home/hadoop

15/03/11 18:19:04 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=90000 watcher=hconnection-0x4b8264fb, quorum=localhost:2181, baseZNode=/hbase

15/03/11 18:19:04 DEBUG zookeeper.ClientCnxn: zookeeper.disableAutoWatchReset is false

15/03/11 18:19:04 INFO zookeeper.RecoverableZooKeeper: Process identifier=hconnection-0x4b8264fb connecting to ZooKeeper ensemble=localhost:2181

15/03/11 18:19:04 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)

15/03/11 18:19:04 INFO zookeeper.ClientCnxn: Socket connection established to localhost/127.0.0.1:2181, initiating session

15/03/11 18:19:04 DEBUG zookeeper.ClientCnxn: Session establishment request sent on localhost/127.0.0.1:2181

15/03/11 18:19:04 INFO zookeeper.ClientCnxn: Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x24bee862026002d, negotiated timeout = 40000

15/03/11 18:19:04 DEBUG zookeeper.ZooKeeperWatcher: hconnection-0x4b8264fb, quorum=localhost:2181, baseZNode=/hbase Received ZooKeeper Event, type=None, state=SyncConnected, path=null

15/03/11 18:19:04 DEBUG zookeeper.ClientCnxn: Reading reply sessionid:0x24bee862026002d, packet:: clientPath:null serverPath:null finished:false header:: 1,3  replyHeader:: 1,4294978417,-101  request:: '/hbase/hbaseid,F  response::  

15/03/11 18:19:04 DEBUG zookeeper.ZooKeeperWatcher: hconnection-0x4b8264fb-0x24bee862026002d connected

15/03/11 18:19:04 INFO client.ZooKeeperRegistry: ClusterId read in ZooKeeper is null

.....................................................................................................................................................

 

最后发现两种解决方案

1(不推荐)

  将该机器的 hosts里面的localhost 指向 真实 zk的ip地址(只能是一个临时方案)

vi /etc/hosts

--------------------------------------------------------------------------------------------------------

#127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

#::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

10.1.29.1   l-hdfsgl1.bi.prod.cn1

 

10.1.29.1   localhost

-------------------------------------------------------------------------------------------------------

 

2(推荐)

需要在hive的conf hive-site.xml加入一个hbase zk的属性

------------------------------------------------------------------------------------------------------

<property>

     <name>hbase.zookeeper.quorum</name>

    <value>l-hdfsgl1.bi.prod.cn1,l-hdfsgl2.bi.prod.cn1,l-hdfscc1.bi.prod.cn1</value>

      <description></description>

 </property>

--------------------------------------------------------------------------------------------------------

 

退出hive后重新进入执行建表语句即可执行成功。

 

   

  

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics