org.apache.hama.zookeeper
Class QuorumPeer

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

public class QuorumPeer
extends java.lang.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_CLIENT_PORT, DEFAULT_ZOOKEEPER_PAUSE, DEFAULT_ZOOKEEPER_RETRIES, DEFAULT_ZOOKEEPER_ROOT, DEFAULT_ZOOKEEPER_SERVER_ADDR, EMPTY_BYTE_ARRAY, GROOM_RPC_HOST, GROOM_RPC_PORT, GROOM_SERVER_IMPL, PEER_HOST, PEER_ID, PEER_PORT, UTF8_ENCODING, ZOOKEEPER_CLIENT_PORT, ZOOKEEPER_CONFIG_NAME, ZOOKEEPER_PAUSE, ZOOKEEPER_QUORUM, ZOOKEEPER_RETRIES, ZOOKEEPER_ROOT, ZOOKEEPER_SERVER_ADDRS, ZOOKEEPER_SESSION_TIMEOUT
 
Constructor Summary
QuorumPeer()
           
 
Method Summary
static java.lang.String getZKQuorumServersString(org.apache.hadoop.conf.Configuration conf)
          Return the ZK Quorum servers string given the specified configuration.
static java.lang.String getZKQuorumServersString(java.util.Properties properties)
          Return the ZK Quorum servers string given zk properties returned by makeZKProps
static java.util.Properties makeZKProps(org.apache.hadoop.conf.Configuration conf)
          Make a Properties object holding ZooKeeper config equivalent to zoo.cfg.
static java.util.Properties parseZooCfg(org.apache.hadoop.conf.Configuration conf, java.io.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 java.util.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 java.util.Properties parseZooCfg(org.apache.hadoop.conf.Configuration conf,
                                               java.io.InputStream inputStream)
                                        throws java.io.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:
java.io.IOException - if anything goes wrong parsing config

getZKQuorumServersString

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

Parameters:
properties -
Returns:
Quorum servers String

getZKQuorumServersString

public static java.lang.String getZKQuorumServersString(org.apache.hadoop.conf.Configuration conf)
Return the ZK Quorum servers string given the specified configuration.

Parameters:
conf -
Returns:
Quorum servers


Copyright © 2008-2011 The Apache Software Foundation. All Rights Reserved.