Index: src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java (revision 1092811) +++ src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java (working copy) @@ -404,18 +404,20 @@ String baseNode) throws KeeperException { List newNodes = new ArrayList(); - synchronized(zkw.getNodes()) { + //synchronized(zkw.getNodes()) { List nodes = ZKUtil.listChildrenAndWatchForNewChildren(zkw, baseNode); for(String node : nodes) { String nodePath = ZKUtil.joinZNode(baseNode, node); if(!zkw.getNodes().contains(nodePath)) { byte [] data = ZKUtil.getDataAndWatch(zkw, nodePath); - newNodes.add(new NodeAndData(nodePath, data)); - zkw.getNodes().add(nodePath); + if (data != null) { + newNodes.add(new NodeAndData(nodePath, data)); + zkw.getNodes().add(nodePath); + } } } - } + //} return newNodes; } @@ -1036,6 +1038,23 @@ // ZooKeeper cluster information // + public static String totalConnections(ZooKeeperWatcher zkw) { + String[] servers = zkw.getQuorum().split(","); + int totalConn = 0; + StringBuilder sb = new StringBuilder(); + for (String server : servers) { + try { + String[] stat = getServerStats(server); + totalConn += stat.length - 10; + } catch (Exception e) { + sb.append(" ERROR: ").append(e.getMessage()); + } + } + if (sb.length() > 0) sb.append(" | "); + sb.append("Total connections: " + totalConn); + return sb.toString(); + } + /** @return String dump of everything in ZooKeeper. */ public static String dump(ZooKeeperWatcher zkw) { StringBuilder sb = new StringBuilder(); Index: src/main/resources/hbase-webapps/master/master.jsp =================================================================== --- src/main/resources/hbase-webapps/master/master.jsp (revision 1092811) +++ src/main/resources/hbase-webapps/master/master.jsp (working copy) @@ -8,16 +8,23 @@ import="org.apache.hadoop.hbase.master.HMaster" import="org.apache.hadoop.hbase.HConstants" import="org.apache.hadoop.hbase.client.HBaseAdmin" + import="org.apache.hadoop.hbase.client.HConnection" import="org.apache.hadoop.hbase.client.HConnectionManager" import="org.apache.hadoop.hbase.HServerInfo" import="org.apache.hadoop.hbase.HServerAddress" - import="org.apache.hadoop.hbase.HTableDescriptor" %><% + import="org.apache.hadoop.hbase.HTableDescriptor" + import="org.apache.hadoop.hbase.zookeeper.ZKUtil" + import="org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher" + %><% HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER); Configuration conf = master.getConfiguration(); HServerAddress rootLocation = master.getCatalogTracker().getRootLocation(); boolean metaOnline = master.getCatalogTracker().getMetaLocation() != null; Map serverToServerInfos = master.getServerManager().getOnlineServers(); + HBaseAdmin hbadmin = new HBaseAdmin(conf); + HConnection connection = hbadmin.getConnection(); + ZooKeeperWatcher watcher = connection.getZooKeeperWatcher(); int interval = conf.getInt("hbase.regionserver.msginterval", 1000)/1000; if (interval == 0) { interval = 1; @@ -73,7 +80,7 @@ <% if (showFragmentation) { %> Fragmentation<%= frags.get("-TOTAL-") != null ? frags.get("-TOTAL-").intValue() + "%" : "n/a" %>Overall fragmentation of all tables, including .META. and -ROOT-. <% } %> -Zookeeper Quorum<%= master.getZooKeeperWatcher().getQuorum() %>Addresses of all registered ZK servers. For more, see zk dump. +Zookeeper Quorum<%= master.getZooKeeperWatcher().getQuorum() %><%= ZKUtil.totalConnections(watcher) %>. See zk dump.

Catalog Tables