org.apache.hama.zookeeper
Class QuorumPeer

java.lang.Object
  extended by org.apache.hama.zookeeper.QuorumPeer
All Implemented Interfaces:
Constants

public class QuorumPeer
extends Object
implements Constants

This class starts and runs the QuorumPeers


Field Summary
 
Fields inherited from interface org.apache.hama.Constants
CLUSTER_DISTRIBUTED, CLUSTER_IS_DISTRIBUTED, DEFAULT_GROOM_RPC_HOST, DEFAULT_GROOM_RPC_PORT, DEFAULT_PEER_HOST, DEFAULT_PEER_PORT, DEFAULT_ZOOKEEPER_PAUSE, DEFAULT_ZOOKEEPER_RETRIES, DEFAULT_ZOOKEEPER_ROOT, DEFAULT_ZOOKEEPER_SERVER_ADDR, DEFAULT_ZOOKEPER_CLIENT_PORT, EMPTY_BYTE_ARRAY, GROOM_RPC_HOST, GROOM_RPC_PORT, GROOM_SERVER_IMPL, PEER_HOST, PEER_ID, PEER_PORT, UTF8_ENCODING, ZOOKEEPER_CONFIG_NAME, ZOOKEEPER_PAUSE, ZOOKEEPER_QUORUM, ZOOKEEPER_RETRIES, ZOOKEEPER_ROOT, ZOOKEEPER_SERVER_ADDRS, ZOOKEPER_CLIENT_PORT
 
Constructor Summary
QuorumPeer()
           
 
Method Summary
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 Hama Configuration variables in.
static void run(org.apache.hadoop.conf.Configuration baseConf)
          Parse ZooKeeper configuration from Hama XML config and run a QuorumPeer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuorumPeer

public QuorumPeer()
Method Detail

run

public static void run(org.apache.hadoop.conf.Configuration baseConf)
Parse ZooKeeper configuration from Hama XML config and run a QuorumPeer.

Parameters:
baseConf - Hadoop Configuration.

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 Hama XML configs and generate the appropriate ZooKeeper properties.

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

parseZooCfg

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

Parameters:
conf - Configuration 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 © 2011 The Apache Software Foundation