org.apache.hadoop.hbase.zookeeper
Class HQuorumPeer

java.lang.Object
  extended by org.apache.hadoop.hbase.zookeeper.HQuorumPeer

public class HQuorumPeer
extends Object

HBase's version of ZooKeeper's QuorumPeer. When HBase is set to manage ZooKeeper, this class is used to start up QuorumPeer instances. By doing things in here rather than directly calling to ZooKeeper, we have more control over the process. Currently, this class allows us to parse the zoo.cfg and inject variables from HBase's site.xml configuration in.


Constructor Summary
HQuorumPeer()
           
 
Method Summary
static String getZKQuorumServersString(Properties properties)
          Return the ZK Quorum servers string given zk properties returned by makeZKProps
static void main(String[] args)
          Parse ZooKeeper configuration from HBase XML config and run a QuorumPeer.
static Properties makeZKProps(org.apache.hadoop.conf.Configuration conf)
          Make a Properties object holding ZooKeeper config equivalent to zoo.cfg.
static Properties parseZooCfg(org.apache.hadoop.conf.Configuration conf, InputStream inputStream)
          Parse ZooKeeper's zoo.cfg, injecting HBase Configuration variables in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HQuorumPeer

public HQuorumPeer()
Method Detail

main

public static void main(String[] args)
Parse ZooKeeper configuration from HBase XML config and run a QuorumPeer.

Parameters:
args - String[] of command line arguments. Not used.

makeZKProps

public static Properties makeZKProps(org.apache.hadoop.conf.Configuration conf)
Make a Properties object holding ZooKeeper config equivalent to zoo.cfg. If there is a zoo.cfg in the classpath, simply read it in. Otherwise parse the corresponding config options from the HBase XML configs and generate the appropriate ZooKeeper properties.

Parameters:
conf - Configuration to read from.
Returns:
Properties holding mappings representing ZooKeeper zoo.cfg file.

getZKQuorumServersString

public static String getZKQuorumServersString(Properties properties)
Return the ZK Quorum servers string given zk properties returned by makeZKProps

Parameters:
properties -
Returns:

parseZooCfg

public static Properties parseZooCfg(org.apache.hadoop.conf.Configuration conf,
                                     InputStream inputStream)
                              throws IOException
Parse ZooKeeper's zoo.cfg, injecting HBase Configuration variables in. This method is used for testing so we can pass our own InputStream.

Parameters:
conf - HBaseConfiguration to use for injecting variables.
inputStream - InputStream to read from.
Returns:
Properties parsed from config stream with variables substituted.
Throws:
IOException - if anything goes wrong parsing config


Copyright © 2010 Apache Software Foundation. All Rights Reserved.