Hi Dave I reuse HBase configuration object as much as possible. I make it static so that there is one config per JVM. But the problem is stopping and starting the batches or the tomcat container which is where I keep getting the issue. The issue is I run in to this issue with HBase shell also to make things worse. I increased the zookeeper max client connections to 200 but that will not be of much use because eventually those will also be used up.
Thanks NY On Sat, May 12, 2012 at 3:27 AM, Dave Revell <[email protected]> wrote: > Hi Narenda, > > There are some shared static data structures inside the HBase client that > are keyed on Configuration objects. Do you reuse the same Configuration > object everytime you instantiate an HTable? By reusing the same > Configuration objects you may cause ZooKeeper connections to be reused. > > I'm not completely sure of any of this, so good luck :) > > -Dave > > On Fri, May 11, 2012 at 10:03 AM, Narendra yadala < > [email protected] > > wrote: > > > Hi Christoph > > > > Thanks for the response. My issue is more general in nature. I also have > > stand alone batches where I need to manage these zookeeper client > > connections. These batches are just POJOs that get terminated without any > > shutdown hooks so this is a bit challenging for me to get rid of existing > > zookeeper client connections. I thought HBase should automatically get > rid > > of the stale connections but that is not happening. Even in my HBase > shell > > I am running into the same issue where I get the "too many connections" > > issue. I am trying *HConnectionManager.deleteAllConnections(false); *on > > load of my DAO class but I am not sure if this will actually close the > > connections related to my previous HBaseConfig instance. > > > > Thanks > > Narendra > > > > On Fri, May 11, 2012 at 7:37 PM, Christoph Bauer < > > [email protected]> wrote: > > > > > Hi, > > > > > > that depends how you open it in tomcat. > > > > > > if you open the connection to zookeeper inside a Servlet you can > > > implement the destroy() method to clean up your resources. > > > /** > > > * Cleans up resource connection > > > */ > > > public void destroy() { > > > try { > > > resource .close(); > > > } catch (Exception e) { > > > e.printStackTrace(); > > > } finally { > > > resource = null; > > > } > > > } > > > > > > > > > if you do it elsewhere: Search the documentation for destroy or > > > tearDown methods and implement them accordingly. > > > > > > This question is better asked in the servlet community. > > > > > > HTH > > > Christoph > > > > > > 2012/5/11 Narendra yadala <[email protected]>: > > > > I have a client which connects to Zookeeper (which runs as part of > > HBase > > > > installation) from my web application running on top of Tomcat > Servlet > > > > Container. Now whenever I restart my Tomcat the zookeeper client > > > > connections are left open or something which in turn causes the Max > > > > connections error from Zookeeper. What would be the best way to > manage > > > > (close) the zookeeper connections gracefully. > > > > > > > > Thanks > > > > NY > > > > > >
