Spring for Apache Hadoop

org.springframework.data.hadoop.test.support
Class StandaloneHadoopCluster

java.lang.Object
  extended by org.springframework.data.hadoop.test.support.StandaloneHadoopCluster
All Implemented Interfaces:
HadoopCluster

public class StandaloneHadoopCluster
extends java.lang.Object
implements HadoopCluster

Standalone simple mini cluster having MR and Hdfs nodes.

Author:
Janne Valkealahti

Constructor Summary
StandaloneHadoopCluster(java.lang.String clusterName)
          Instantiates a mini cluster with default cluster node count.
StandaloneHadoopCluster(java.lang.String clusterName, int nodes)
          Instantiates a mini cluster with given cluster node count.
 
Method Summary
 org.apache.hadoop.conf.Configuration getConfiguration()
          Gets the Configuration for the cluster.
 org.apache.hadoop.fs.FileSystem getFileSystem()
          Gets the configured FileSystem managed by HadoopCluster.
 void setNodes(int nodes)
          Sets a number of nodes for cluster.
 void start()
          Starts the cluster.
 void stop()
          Stops the cluster.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandaloneHadoopCluster

public StandaloneHadoopCluster(java.lang.String clusterName)
Instantiates a mini cluster with default cluster node count.

Parameters:
clusterName - the unique cluster name

StandaloneHadoopCluster

public StandaloneHadoopCluster(java.lang.String clusterName,
                               int nodes)
Instantiates a mini cluster with given cluster node count.

Parameters:
clusterName - the unique cluster name
nodes - the node count
Method Detail

getConfiguration

public org.apache.hadoop.conf.Configuration getConfiguration()
Description copied from interface: HadoopCluster
Gets the Configuration for the cluster. As most of the configuration parameters are not known until after cluster has been started, this configuration should be configured by the cluster itself.

Specified by:
getConfiguration in interface HadoopCluster
Returns:
the Cluster configured Configuration

start

public void start()
           throws java.io.IOException
Description copied from interface: HadoopCluster
Starts the cluster.

Specified by:
start in interface HadoopCluster
Throws:
java.io.IOException

stop

public void stop()
Description copied from interface: HadoopCluster
Stops the cluster.

Specified by:
stop in interface HadoopCluster

getFileSystem

public org.apache.hadoop.fs.FileSystem getFileSystem()
                                              throws java.io.IOException
Description copied from interface: HadoopCluster
Gets the configured FileSystem managed by HadoopCluster.

Specified by:
getFileSystem in interface HadoopCluster
Returns:
file system managed by cluster
Throws:
java.io.IOException - if error occured

setNodes

public void setNodes(int nodes)
Sets a number of nodes for cluster. Every node will act as mr and dfs role. Default is one node.

Parameters:
nodes - the number of nodes

Spring for Apache Hadoop