private static Properties makeZKServerPropsFromHBaseConfig(Configuration conf) {
    Properties zkProperties = extractZKServerPropsFromHBaseConfig(conf);

    // If clientPort is not set, assign the default.
    if (zkProperties.getProperty(HConstants.CLIENT_PORT_STR) == null) {
      zkProperties.put(HConstants.CLIENT_PORT_STR, HConstants.DEFAULT_ZOOKEEPER_CLIENT_PORT);
    }

    // Create the server.X properties.
    int peerPort = conf.getInt("hbase.zookeeper.peerport", 2888);
    int leaderPort = conf.getInt("hbase.zookeeper.leaderport", 3888);

    final String[] serverHosts = conf.getStrings(HConstants.ZOOKEEPER_QUORUM, HConstants.LOCALHOST);
    String serverHost;
    String address;
    String key;
    for (int i = 0; i < serverHosts.length; ++i) {
      if (serverHosts[i].contains(":")) {
        serverHost = serverHosts[i].substring(0, serverHosts[i].indexOf(':'));
      } else {
        serverHost = serverHosts[i];
      }
      address = serverHost + ":" + peerPort + ":" + leaderPort;
      key = "server." + i;
      zkProperties.put(key, address);
    }

    return zkProperties;
  }
Make a Properties object holding ZooKeeper config for the optional in-process ZK Quorum
servers. Parses the corresponding config options from the HBase XML configs and generates the
appropriate ZooKeeper properties.
@param conf Configuration to read from.
@return Properties holding mappings representing ZooKeeper config file.
hbase-common/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKConfig.java