Return-Path: X-Original-To: apmail-hbase-user-archive@www.apache.org Delivered-To: apmail-hbase-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 17CDD9F6F for ; Fri, 11 May 2012 21:58:16 +0000 (UTC) Received: (qmail 58481 invoked by uid 500); 11 May 2012 21:58:14 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 58399 invoked by uid 500); 11 May 2012 21:58:14 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 58390 invoked by uid 99); 11 May 2012 21:58:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 May 2012 21:58:14 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW X-Spam-Check-By: apache.org Received-SPF: unknown (nike.apache.org: error in processing during lookup of dave@urbanairship.com) Received: from [209.85.214.169] (HELO mail-ob0-f169.google.com) (209.85.214.169) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 May 2012 21:58:07 +0000 Received: by obbwd18 with SMTP id wd18so5393197obb.14 for ; Fri, 11 May 2012 14:57:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=tz2L+IMJnJSc+hUk6xDaNzxjaRpMYF93nS8zdK6W+1s=; b=KUlqVWFoo/uIL511eeU0Wtqc4MNGtucDwRfFuULrAaXZxKSBgzOeQwaegZXk6ejKh8 stTAPxz9Mv6a3vwyD0AsWoXDkscrD8I7e8hfWul0Mgk8wctT9nHW5coTxfIJyWrolJtC 16bL2XGf+PNgUCiIp5p6xF+1cA3aPabYGhEzJ9tSK5rWbfVsGx8OTDX667GAdHqp3QyR 3mvyKJVX827/HXlttZOHswWpsKGzNkAie121Cs9gcLEtNgx8l9hBDQ1jeXyoTL0/45Ve gES0O1EKd9WlpBB3MNiCtbDR2ywSOZG+y7l1l9r2Mc4cMLUpzShATNT8oYZJGgPQUa7D Jxow== MIME-Version: 1.0 Received: by 10.182.167.68 with SMTP id zm4mr13966639obb.25.1336773465959; Fri, 11 May 2012 14:57:45 -0700 (PDT) Received: by 10.182.12.4 with HTTP; Fri, 11 May 2012 14:57:45 -0700 (PDT) In-Reply-To: References: Date: Fri, 11 May 2012 14:57:45 -0700 Message-ID: Subject: Re: Manager Zookeeper Client Connections From: Dave Revell To: user@hbase.apache.org Content-Type: multipart/alternative; boundary=e89a8f83a5a1956ea204bfc9d341 X-Gm-Message-State: ALoCoQnUWmZO0XvuzqmbFoie2JHtT63eesUu9RvsGcxrDQ3gEOkqR6hormQqhBgZrscRht9ckzhw --e89a8f83a5a1956ea204bfc9d341 Content-Type: text/plain; charset=ISO-8859-1 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 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 < > christoph.bauer@unbelievable-machine.com> 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 : > > > 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 > > > --e89a8f83a5a1956ea204bfc9d341--