Search in sources :

Example 51 with Cluster

use of org.apache.whirr.Cluster in project whirr by apache.

the class HadoopConfigurationBuilderTest method newCluster.

private Cluster newCluster(int numberOfWorkers) {
    DnsResolver fakeDnsResolver = new FakeDnsResolver();
    NodeMetadata node = mock(NodeMetadata.class);
    List<Processor> processors = ImmutableList.of(new Processor(4, 1.0));
    Hardware hardware = new HardwareImpl(null, null, "id", null, null, ImmutableMap.<String, String>of(), ImmutableSet.<String>of(), processors, 1024, ImmutableList.<Volume>of(), null, "xen");
    when(node.getHardware()).thenReturn(hardware);
    Builder<Instance> instances = ImmutableSet.<Instance>builder();
    Instance master = new Instance(new Credentials("", ""), ImmutableSet.of(HadoopNameNodeClusterActionHandler.ROLE, HadoopJobTrackerClusterActionHandler.ROLE), "10.0.0.1", "10.0.0.1", "1", node, fakeDnsResolver);
    instances.add(master);
    for (int i = 0; i < numberOfWorkers; i++) {
        int id = i + 2;
        instances.add(new Instance(new Credentials("", ""), ImmutableSet.of(HadoopDataNodeClusterActionHandler.ROLE, HadoopTaskTrackerClusterActionHandler.ROLE), "10.0.0." + id, "10.0.0." + id, id + "", node, fakeDnsResolver));
    }
    return new Cluster(instances.build());
}
Also used : NodeMetadata(org.jclouds.compute.domain.NodeMetadata) FakeDnsResolver(org.apache.whirr.net.FakeDnsResolver) DnsResolver(org.apache.whirr.net.DnsResolver) Processor(org.jclouds.compute.domain.Processor) Instance(org.apache.whirr.Cluster.Instance) HardwareImpl(org.jclouds.compute.domain.internal.HardwareImpl) Cluster(org.apache.whirr.Cluster) FakeDnsResolver(org.apache.whirr.net.FakeDnsResolver) Hardware(org.jclouds.compute.domain.Hardware) Credentials(org.jclouds.domain.Credentials)

Example 52 with Cluster

use of org.apache.whirr.Cluster in project whirr by apache.

the class HadoopDataNodeClusterActionHandler method afterConfigure.

@Override
protected void afterConfigure(ClusterActionEvent event) throws IOException, InterruptedException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();
    // TODO: wait for TTs to come up (done in test for the moment)
    LOG.info("Completed configuration of {} role {}", clusterSpec.getClusterName(), getRole());
// TODO: List data nodes + url to their WEB UI?
}
Also used : Cluster(org.apache.whirr.Cluster) ClusterSpec(org.apache.whirr.ClusterSpec)

Aggregations

Cluster (org.apache.whirr.Cluster)52 ClusterSpec (org.apache.whirr.ClusterSpec)35 Instance (org.apache.whirr.Cluster.Instance)19 Configuration (org.apache.commons.configuration.Configuration)16 IOException (java.io.IOException)9 InetAddress (java.net.InetAddress)9 ZooKeeperCluster (org.apache.whirr.service.zookeeper.ZooKeeperCluster)9 Test (org.junit.Test)8 PropertiesConfiguration (org.apache.commons.configuration.PropertiesConfiguration)7 Credentials (org.jclouds.domain.Credentials)7 ClusterController (org.apache.whirr.ClusterController)5 Properties (java.util.Properties)4 ConfigurationException (org.apache.commons.configuration.ConfigurationException)4 InstanceTemplate (org.apache.whirr.InstanceTemplate)4 ClusterActionEvent (org.apache.whirr.service.ClusterActionEvent)4 StatementBuilder (org.apache.whirr.service.jclouds.StatementBuilder)4 Matchers.containsString (org.hamcrest.Matchers.containsString)4 File (java.io.File)3 ExecutionException (java.util.concurrent.ExecutionException)3 Future (java.util.concurrent.Future)3