Package org.apache.whirr

Examples of org.apache.whirr.ClusterController


    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-zookeeper-test.properties"));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
   
    cluster = controller.launchCluster(clusterSpec);
    hosts = ZooKeeperCluster.getHosts(cluster);
  }
View Full Code Here


    /**
     * Create an instance of the generic cluster controller
     */
    ClusterControllerFactory factory = new ClusterControllerFactory();
    ClusterController controller = factory.create(spec.getServiceName());

    /**
     * Start the cluster as defined in the configuration file
     */
    HadoopProxy proxy = null;
    try {
      LOG.info("Starting cluster {}", spec.getClusterName());
      Cluster cluster = controller.launchCluster(spec);

      LOG.info("Starting local SOCKS proxy");
      proxy = new HadoopProxy(spec, cluster);
      proxy.start();

      /**
       * Obtain a Hadoop configuration object and wait for services to start
       */
      Configuration config = getHadoopConfiguration(cluster);
      JobConf job = new JobConf(config, HadoopClusterExample.class);
      JobClient client = new JobClient(job);

      waitToExitSafeMode(client);
      waitForTaskTrackers(client);

      /**
       * Run a simple job to show that the cluster is available for work.
       */

      runWordCountingJob(config);

    } finally {
      /**
       * Stop the proxy and terminate all the cluster instances.
       */
      if (proxy != null) {
        proxy.stop();
      }
      controller.destroyCluster(spec);
      return 0;
    }
  }
View Full Code Here

    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(configuration);
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
   
    cluster = controller.launchCluster(clusterSpec);
    proxy = new HadoopProxy(clusterSpec, cluster);
    proxy.start();
   
View Full Code Here

      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-puppet-test.properties"));

    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
    cluster = controller.launchCluster(clusterSpec);
    socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 60, 1, TimeUnit.SECONDS);

  }
View Full Code Here

    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-hama-test.properties"));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
   
    cluster = controller.launchCluster(clusterSpec);
    proxy = new HadoopProxy(clusterSpec, cluster);
    proxy.start();
View Full Code Here

  private ClusterController launchWithConfig(Configuration config)
      throws IOException, InterruptedException, ConfigurationException,
      JSchException {
    ClusterSpec clusterSpec = ClusterSpec.withTemporaryKeys(config);
    ClusterController controller = new ClusterController();
    controller.launchCluster(clusterSpec);
    return controller;
  }
View Full Code Here

          .getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration(
        "whirr-chef-test.properties"));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
    controller.launchCluster(clusterSpec);
  }
View Full Code Here

    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration(getPropertiesFilename()));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
   
    cluster = controller.launchCluster(clusterSpec);
    proxy = new HadoopProxy(clusterSpec, cluster);
    proxy.start();
  }
View Full Code Here

      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-voldemort-test.properties"));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);

    controller = new ClusterController();
    cluster = controller.launchCluster(clusterSpec);

    waitForBootstrap();
  }
View Full Code Here

  @Test
  public void testAllOptions() throws Exception {

    ClusterControllerFactory factory = mock(ClusterControllerFactory.class);
    ClusterController controller = mock(ClusterController.class);
    when(factory.create((String) any())).thenReturn(controller);

    NodeMetadata node1 = new NodeMetadataBuilder().name("name1").ids("id1")
        .location(new LocationBuilder().scope(LocationScope.PROVIDER)
          .id("location-id1").description("location-desc1").build())
        .imageId("image-id").state(NodeState.RUNNING)
        .publicAddresses(Lists.newArrayList("127.0.0.1"))
        .privateAddresses(Lists.newArrayList("127.0.0.1")).build();

    NodeMetadata node2 = new NodeMetadataBuilder().name("name2").ids("id2")
        .location(new LocationBuilder().scope(LocationScope.PROVIDER)
          .id("location-id2").description("location-desc2").build())
        .imageId("image-id").state(NodeState.RUNNING)
        .publicAddresses(Lists.newArrayList("127.0.0.2"))
        .privateAddresses(Lists.newArrayList("127.0.0.2")).build();

    when(controller.getNodes((ClusterSpec) any())).thenReturn(
        (Set) Sets.newLinkedHashSet(Lists.newArrayList(node1, node2)));
    when(controller.getInstances((ClusterSpec)any(), (ClusterStateStore)any()))
        .thenCallRealMethod();

    ClusterStateStore memStore = new MemoryClusterStateStore();
    memStore.save(createTestCluster(
      new String[]{"id1", "id2"}, new String[]{"role1", "role2"}));
View Full Code Here

TOP

Related Classes of org.apache.whirr.ClusterController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.