Yeah that part of the code wasn't expecting that one HBaseConfiguration would equal to one "HBase instance". HBASE-3777 fixes that and you shouldn't need to tweak either the number of connections or that hard-coded parameter.
In the mean time it's kinda odd, you would need to recompile HBase with a new setting... J-D On Sat, May 7, 2011 at 7:59 PM, Gaojinchao <[email protected]> wrote: > I have a silly question. > > It has modified the parameter hbase.zookeeper.property.maxClientCnxns > It seems like that MAX_CACHED_HBASE_INSTANCES needs modify. > It is hard code for hbase. So who will create 5000 connections? > If hbase is , It may be some exception. > > > > > -----邮件原件----- > 发件人: [email protected] [mailto:[email protected]] 代表 Stack > 发送时间: 2011年5月7日 2:03 > 收件人: [email protected] > 主题: Re: svn commit: r1100300 - in /hbase/branches/0.90: CHANGES.txt > src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java > src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java > src/test/resources/hbase-site.xml > > Is there another constructor in there Andrew that was assigning data > members -- arrays and stuff? > St.Ack > > On Fri, May 6, 2011 at 10:43 AM, <[email protected]> wrote: >> Author: apurtell >> Date: Fri May 6 17:43:06 2011 >> New Revision: 1100300 >> >> URL: http://svn.apache.org/viewvc?rev=1100300&view=rev >> Log: >> HBASE-3861 MiniZooKeeperCluster should refer to maxClientCnxns >> >> Modified: >> hbase/branches/0.90/CHANGES.txt >> >> hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java >> >> hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java >> hbase/branches/0.90/src/test/resources/hbase-site.xml >> >> Modified: hbase/branches/0.90/CHANGES.txt >> URL: >> http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1100300&r1=1100299&r2=1100300&view=diff >> ============================================================================== >> --- hbase/branches/0.90/CHANGES.txt (original) >> +++ hbase/branches/0.90/CHANGES.txt Fri May 6 17:43:06 2011 >> @@ -41,6 +41,8 @@ Release 0.90.3 - Unreleased >> HBASE-3821 "NOT flushing memstore for region" keep on printing for half >> an hour (zhoushuaifeng) >> HBASE-3848 request is always zero in WebUI for region server (gaojinchao) >> + HBASE-3861 MiniZooKeeperCluster should refer to maxClientCnxns (Eugene >> + Koontz via Andrew Purtell) >> >> IMPROVEMENT >> HBASE-3717 deprecate HTable isTableEnabled() methods in favor of >> HBaseAdmin >> >> Modified: >> hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java >> URL: >> http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java?rev=1100300&r1=1100299&r2=1100300&view=diff >> ============================================================================== >> --- >> hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java >> (original) >> +++ >> hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java >> Fri May 6 17:43:06 2011 >> @@ -31,7 +31,9 @@ import java.net.Socket; >> >> import org.apache.commons.logging.Log; >> import org.apache.commons.logging.LogFactory; >> +import org.apache.hadoop.conf.Configuration; >> import org.apache.hadoop.fs.FileUtil; >> +import org.apache.hadoop.hbase.HBaseConfiguration; >> import org.apache.zookeeper.server.NIOServerCnxn; >> import org.apache.zookeeper.server.ZooKeeperServer; >> import org.apache.zookeeper.server.persistence.FileTxnLog; >> @@ -53,9 +55,17 @@ public class MiniZooKeeperCluster { >> private NIOServerCnxn.Factory standaloneServerFactory; >> private int tickTime = 0; >> >> + private Configuration configuration; >> + >> /** Create mini ZooKeeper cluster. */ >> public MiniZooKeeperCluster() { >> + this(HBaseConfiguration.create()); >> + } >> + >> + /** Create mini ZooKeeper cluster with configuration (usually from test >> environment) */ >> + public MiniZooKeeperCluster(Configuration configuration) { >> this.started = false; >> + this.configuration = configuration; >> } >> >> public void setClientPort(int clientPort) { >> @@ -105,8 +115,9 @@ public class MiniZooKeeperCluster { >> ZooKeeperServer server = new ZooKeeperServer(dir, dir, tickTimeToUse); >> while (true) { >> try { >> + int numberOfConnections = >> this.configuration.getInt("hbase.zookeeper.property.maxClientCnxns",5000); >> standaloneServerFactory = >> - new NIOServerCnxn.Factory(new InetSocketAddress(clientPort)); >> + new NIOServerCnxn.Factory(new InetSocketAddress(clientPort), >> numberOfConnections); >> } catch (BindException e) { >> LOG.info("Failed binding ZK Server to client port: " + clientPort); >> //this port is already in use. try to use another >> >> Modified: >> hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java >> URL: >> http://svn.apache.org/viewvc/hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=1100300&r1=1100299&r2=1100300&view=diff >> ============================================================================== >> --- >> hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java >> (original) >> +++ >> hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java >> Fri May 6 17:43:06 2011 >> @@ -260,7 +260,7 @@ public class HBaseTestingUtility { >> if (this.zkCluster != null) { >> throw new IOException("Cluster already running at " + dir); >> } >> - this.zkCluster = new MiniZooKeeperCluster(); >> + this.zkCluster = new MiniZooKeeperCluster(this.getConfiguration()); >> int clientPort = this.zkCluster.startup(dir); >> this.conf.set("hbase.zookeeper.property.clientPort", >> Integer.toString(clientPort)); >> >> Modified: hbase/branches/0.90/src/test/resources/hbase-site.xml >> URL: >> http://svn.apache.org/viewvc/hbase/branches/0.90/src/test/resources/hbase-site.xml?rev=1100300&r1=1100299&r2=1100300&view=diff >> ============================================================================== >> --- hbase/branches/0.90/src/test/resources/hbase-site.xml (original) >> +++ hbase/branches/0.90/src/test/resources/hbase-site.xml Fri May 6 >> 17:43:06 2011 >> @@ -133,4 +133,14 @@ >> The port at which the clients will connect. >> </description> >> </property> >> + <property> >> + <name>hbase.zookeeper.property.maxClientCnxns</name> >> + <value>5000</value> >> + <description>Property from ZooKeeper's config zoo.cfg. >> + Limit on number of concurrent connections (at the socket level) that a >> + single client, identified by IP address, may make to a single member of >> + the ZooKeeper ensemble. Set high to avoid zk connection issues running >> + standalone and pseudo-distributed. >> + </description> >> + </property> >> </configuration> >> >> >> >
