错误HBASE-ZOOKEEPER:连接太多

dev*_*sri 5 hbase jdo datanucleus apache-zookeeper

我正在使用Hbase-Hadoop组合作为我的应用程序以及Data Nucleus作为ORM.

当我试图一次通过几个线程访问hbase时.它会抛出异常:

Exception in thread "Thread-26" javax.jdo.JDODataStoreException

org.apache.hadoop.hbase.ZooKeeperConnectionException: HBase is able to connect to ZooKeeper but the connection closes immediately. This could be a sign that the server has too many connections (30 is the default). Consider inspecting your ZK server logs for that error and then make sure you are reusing HBaseConfiguration as often as you can. See HTable's javadoc for more information.

Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase
Run Code Online (Sandbox Code Playgroud)

如果需要,我可以提供完整的堆栈跟踪.(因为完整的堆栈跟踪会使事情变得混乱).

请帮我解决一下如何处理这种情况.是否需要进行任何配置来增加连接池?

小智 8

Zookeeper服务器具有活动连接限制,默认情况下为30.您需要通过在zookeeper配置文件zoo.cfg中相应地设置maxClientCnxns属性来增加此限制.

100个连接:

maxClientCnxns=100
Run Code Online (Sandbox Code Playgroud)

告诉zookeeper对连接数没有限制:

maxClientCnxns=0
Run Code Online (Sandbox Code Playgroud)