我在我的应用程序中使用 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
我该如何处理这种情况?我需要做任何配置来增加连接池吗?
Zookeeper 服务器有一个活动连接限制,默认为 30。
您需要通过在zookeeper配置文件zoo.cfg中相应地设置maxClientCnxns属性来增加此限制。
对于 100 个连接:
maxClientCnxns=100
告诉zookeeper对连接数不施加限制:
maxClientCnxns=0
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)