Search code examples
jdohbasedatanucleusapache-zookeeper

Error HBASE-ZOOKEEPER : Too many connections


I am using Hbase-Hadoop combination for my application along with Data Nucleus as the ORM.

When I am trying to access Hbase via several threads at a single time, it throws exceptions as:

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

How can I handle this kind of situation? Is there any configuration I need to do to increase the connection pool?


Solution

  • Zookeeper servers have an active connections limit, which by default is 30. You need to increase this limit by setting maxClientCnxns property accordingly in your zookeeper config file, zoo.cfg.

    For 100 connections:

    maxClientCnxns=100
    

    To tell zookeeper to impose no limit to the number of connections:

    maxClientCnxns=0