HBase 链接问题

总结写之前spark链接hbase的坑。

  • 异常
Will not attempt to authenticate using SASL (unknown error)
ClusterId read in ZooKeeper is null
  • HBase 配置代码
val hBaseConf = HBaseConfiguration.create()
hBaseConf.set("hbase.zookeeper.quorum","fp-bd6,fp-bd5")
hBaseConf.set("hbase.zookeeper.property.clientPort","2181")
hBaseConf.set("hbase.defaults.for.version.skip","true")
  • 解决方法

添加 hBaseConf.set("zookeeper.znode.parent","/hbase-unsecure")
The value of zookeeper.znode.parent in HBASE_CONF/hbase-site.xml is specified as /hbase-unsecure (see below) which is correct but for some reason (still trying to figure this out), the value being printed is /hbase. So currently I’ve overridden this programatically in the client program by adding the following line to the program。
大致意思是:虽然hbase-site.xml配置了hbase-unsecure,这是正确的。但由于某种原因(仍然试图弄清楚),打印的值是/ hbase。
官方文档中有提到:If both clusters use the same ZooKeeper cluster, you must use a different zookeeper.znode.parent, because they cannot write in the same folder。
所以这里需要单独设置zookeeper.znode.paren 的属性。
至于为什么是/hbase-unsecure,我们也可以通过登录zk来进行验证。使用bin/zkCli.sh -server fp-bd6:2181 连接集群zk,然后输入ls /可以得到含hbase的目录只有/hbase-unsecure

[zk: fp-bd6:2181(CONNECTING) 0] ls / 
[registry, cluster, controller, storm, brokers, zookeeper, hbase-unsecure, admin, isr_change_notification, dubbo, templeton-hadoop, hiveserver2, controller_epoch, rmstore, ambari-metrics-cluster, consumers, config, kylin]
[zk: fp-bd6:2181(CONNECTED) 1] 
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐