如果多个应用用到了zookeeper服务,可以使HBase使用集群中已有的一套zookeeper,不使用自己独占的zookeeper服务
将conf里hbase-env.sh的export HBASE_MANAGES_ZK=flase
官方原文如下:
To point HBase at an existing ZooKeeper cluster, one that is not managed by HBase, set HBASE_MANAGES_ZK
inconf/hbase-env.sh to false
... # Tell HBase whether it should manage its own instance of ZooKeeper or not. export HBASE_MANAGES_ZK=false
Next set ensemble locations and client port, if non-standard, in hbase-site.xml.
When HBase manages ZooKeeper, it will start/stop the ZooKeeper servers as a part of the regular start/stop scripts. If you would like to run ZooKeeper yourself, independent of HBase start/stop, you would do the following
${HBASE_HOME}/bin/hbase-daemons.sh {start,stop} zookeeper
Note that you can use HBase in this manner to spin up a ZooKeeper cluster, unrelated to HBase. Just make sure to set HBASE_MANAGES_ZK
to false
if you want it to stay up across HBase restarts so that when HBase shuts down, it doesn’t take ZooKeeper down with it.
For more information about running a distinct ZooKeeper cluster, see the ZooKeeper Getting Started Guide. Additionally, see the ZooKeeper Wiki or the ZooKeeper documentation for more information on ZooKeeper sizing.