hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1498785 - in /hbase/branches/0.95: hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ hbase-common/src/main/resources/ hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ hbase-server/src/test/java/org/apache/hadoop/hb...
Date Tue, 02 Jul 2013 05:30:57 GMT
Author: stack
Date: Tue Jul  2 05:30:57 2013
New Revision: 1498785

URL: http://svn.apache.org/r1498785
Log:
HBASE-8501 The hbase zkcli will connection failure the first and the second ip from ZooKeeperMainServerArg
return connection string

Modified:
    hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java
    hbase/branches/0.95/hbase-common/src/main/resources/hbase-default.xml
    hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java
    hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperMainServer.java

Modified: hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java?rev=1498785&r1=1498784&r2=1498785&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java
(original)
+++ hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java
Tue Jul  2 05:30:57 2013
@@ -108,6 +108,7 @@ public class RecoverableZooKeeper {
   public RecoverableZooKeeper(String quorumServers, int sessionTimeout,
       Watcher watcher, int maxRetries, int retryIntervalMillis, String identifier)
   throws IOException {
+    // TODO: Add support for zk 'chroot'; we don't add it to the quorumServers String as
we should.
     this.zk = new ZooKeeper(quorumServers, sessionTimeout, watcher);
     this.retryCounterFactory =
       new RetryCounterFactory(maxRetries, retryIntervalMillis);

Modified: hbase/branches/0.95/hbase-common/src/main/resources/hbase-default.xml
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-common/src/main/resources/hbase-default.xml?rev=1498785&r1=1498784&r2=1498785&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-common/src/main/resources/hbase-default.xml (original)
+++ hbase/branches/0.95/hbase-common/src/main/resources/hbase-default.xml Tue Jul  2 05:30:57
2013
@@ -76,13 +76,17 @@ possible configurations would overwhelm 
   <property>
     <name>hbase.zookeeper.quorum</name>
     <value>localhost</value>
-    <description>Comma separated list of servers in the ZooKeeper Quorum.
+    <description>Comma separated list of servers in the ZooKeeper ensemble
+    (This config. should have been named hbase.zookeeper.ensemble).
     For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com".
     By default this is set to localhost for local and pseudo-distributed modes
     of operation. For a fully-distributed setup, this should be set to a full
-    list of ZooKeeper quorum servers. If HBASE_MANAGES_ZK is set in hbase-env.sh
+    list of ZooKeeper ensemble servers. If HBASE_MANAGES_ZK is set in hbase-env.sh
     this is the list of servers which hbase will start/stop ZooKeeper on as
-    part of cluster start/stop.
+    part of cluster start/stop.  Client-side, we will take this list of
+    ensemble members and put it together with the hbase.zookeeper.clientPort
+    config. and pass it into zookeeper constructor as the connectString
+    parameter.
     </description>
   </property>
   <!--The above are the important configurations for getting hbase up

Modified: hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java?rev=1498785&r1=1498784&r2=1498785&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java
(original)
+++ hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperMainServer.java
Tue Jul  2 05:30:57 2013
@@ -38,7 +38,6 @@ public class ZooKeeperMainServer {
     // HConstants.ZOOKEEPER_QUORUM from the HBaseConfiguration because the
     // user may be using a zoo.cfg file.
     Properties zkProps = ZKConfig.makeZKProps(c);
-    String host = null;
     String clientPort = null;
     List<String> hosts = new ArrayList<String>();
     for (Entry<Object, Object> entry: zkProps.entrySet()) {
@@ -51,15 +50,15 @@ public class ZooKeeperMainServer {
         clientPort = value;
       }
     }
-    if (hosts.isEmpty() || clientPort == null)
-      return null;
+    if (hosts.isEmpty() || clientPort == null) return null;
+    StringBuilder host = new StringBuilder();
     for (int i = 0; i < hosts.size(); i++) {
-      if (i > 0)
-        host += "," + hosts.get(i);
-      else
-        host = hosts.get(i);
+      if (i > 0)  host.append("," + hosts.get(i));
+      else host.append(hosts.get(i));
+      host.append(":");
+      host.append(clientPort);
     }
-    return host != null ? host + ":" + clientPort : null;
+    return host.toString();
   }
 
   /**
@@ -78,4 +77,4 @@ public class ZooKeeperMainServer {
     }
     ZooKeeperMain.main(newArgs);
   }
-}
+}
\ No newline at end of file

Modified: hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperMainServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperMainServer.java?rev=1498785&r1=1498784&r2=1498785&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperMainServer.java
(original)
+++ hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperMainServer.java
Tue Jul  2 05:30:57 2013
@@ -32,15 +32,13 @@ public class TestZooKeeperMainServer {
 
   @Test public void test() {
     Configuration c = HBaseConfiguration.create();
-    assertEquals("localhost:" + c.get(HConstants.ZOOKEEPER_CLIENT_PORT),
-      parser.parse(c));
+    assertEquals("localhost:" + c.get(HConstants.ZOOKEEPER_CLIENT_PORT), parser.parse(c));
     final String port = "1234";
     c.set(HConstants.ZOOKEEPER_CLIENT_PORT, port);
     c.set("hbase.zookeeper.quorum", "example.com");
     assertEquals("example.com:" + port, parser.parse(c));
     c.set("hbase.zookeeper.quorum", "example1.com,example2.com,example3.com");
-    assertTrue(port,
-        parser.parse(c).matches("(example[1-3]\\.com,){2}example[1-3]\\.com:" + port));
+    String ensemble = parser.parse(c);
+    assertTrue(port, ensemble.matches("(example[1-3]\\.com:1234,){2}example[1-3]\\.com:"
+ port));
   }
-}
-
+}
\ No newline at end of file



Mime
View raw message