org.apache.hadoop.hbase.zookeeper
Class HQuorumPeer

java.lang.Object
  extended by org.apache.hadoop.hbase.zookeeper.HQuorumPeer
All Implemented Interfaces:
HConstants

public class HQuorumPeer
extends Object
implements HConstants

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.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.HConstants
HConstants.Modify
 
Field Summary
 
Fields inherited from interface org.apache.hadoop.hbase.HConstants
ALL_VERSIONS, CATALOG_FAMILY, CATALOG_FAMILY_STR, CATALOG_HISTORIAN_FAMILY, CLUSTER_DISTRIBUTED, CLUSTER_IS_DISTRIBUTED, CLUSTER_IS_LOCAL, DEFAULT_HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE, DEFAULT_HOST, DEFAULT_MASTER_INFOPORT, DEFAULT_MASTER_PORT, DEFAULT_MAX_FILE_SIZE, DEFAULT_REGION_SERVER_CLASS, DEFAULT_REGIONSERVER_INFOPORT, DEFAULT_REGIONSERVER_PORT, DEFAULT_SIZE_RESERVATION_BLOCK, DEFAULT_ZOOKEEPER_PAUSE, DEFAULT_ZOOKEEPER_RETRIES, EMPTY_BYTE_ARRAY, EMPTY_END_ROW, EMPTY_START_ROW, FILE_SYSTEM_VERSION, FOREVER, HBASE_CLIENT_RETRIES_NUMBER_KEY, HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY, HBASE_DIR, HREGION_COMPACTIONDIR_NAME, HREGION_LOGDIR_NAME, HREGION_OLDLOGFILE_NAME, IN_MEMORY, LAST_ROW, LATEST_TIMESTAMP, LATEST_TIMESTAMP_BYTES, MAJOR_COMPACTION_PERIOD, MASTER_PORT, MAX_ROW_LENGTH, MAXIMUM_VALUE_LENGTH, META_ROW_DELIMITER, META_TABLE_NAME, NAME, NINES, REGION_IMPL, REGION_SERVER_CLASS, REGION_SERVER_IMPL, REGIONINFO_QUALIFIER, REGIONSERVER_PORT, RETRY_BACKOFF, ROOT_TABLE_NAME, SERVER_QUALIFIER, SPLITA_QUALIFIER, SPLITB_QUALIFIER, STARTCODE_QUALIFIER, THREAD_WAKE_FREQUENCY, UTF8_ENCODING, VERSION_FILE_NAME, VERSIONS, WEEK_IN_SECONDS, ZERO_L, ZEROES, ZOOKEEPER_CONFIG_NAME, ZOOKEEPER_PAUSE, ZOOKEEPER_QUORUM, ZOOKEEPER_RETRIES
 
Constructor Summary
HQuorumPeer()
           
 
Method Summary
static void main(String[] args)
          Parse ZooKeeper configuration from HBase XML config and run a QuorumPeer.
static Properties makeZKProps(HBaseConfiguration conf)
          Make a Properties object holding ZooKeeper config equivalent to zoo.cfg.
static Properties parseZooCfg(HBaseConfiguration 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(HBaseConfiguration 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 - HBaseConfiguration to read from.
Returns:
Properties holding mappings representing ZooKeeper zoo.cfg file.

parseZooCfg

public static Properties parseZooCfg(HBaseConfiguration 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 The Apache Software Foundation