Package org.apache.whirr

Examples of org.apache.whirr.ClusterSpec


    Map<InstanceTemplate, Future<Set<? extends NodeMetadata>>> futures = Maps.newHashMap();
   
    // initialize startup processes per InstanceTemplates
    for (Entry<InstanceTemplate, ClusterActionEvent> entry : eventMap.entrySet()) {
      final InstanceTemplate instanceTemplate = entry.getKey();
      final ClusterSpec clusterSpec = entry.getValue().getClusterSpec();

      final int maxNumberOfRetries = clusterSpec.getMaxStartupRetries();
      StatementBuilder statementBuilder = entry.getValue().getStatementBuilder();

      ComputeServiceContext computeServiceContext = getCompute().apply(clusterSpec);
      final ComputeService computeService =
        computeServiceContext.getComputeService();

      final Template template = BootstrapTemplate.build(clusterSpec, computeService,
        statementBuilder, entry.getKey());

      Future<Set<? extends NodeMetadata>> nodesFuture = executorService.submit(
          new StartupProcess(
              clusterSpec.getClusterName(),
              instanceTemplate.getNumberOfInstances(),
              instanceTemplate.getMinNumberOfInstances(),
              maxNumberOfRetries,
              instanceTemplate.getRoles(),
              computeService, template, executorService, nodeStarterFactory));
View Full Code Here


  @Override
  protected Object doExecute() throws Exception {
    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
    LaunchClusterCommand command = new LaunchClusterCommand(clusterControllerFactory);
    ClusterSpec clusterSpec = getClusterSpec();
    if (clusterSpec != null) {
      command.run(System.in, System.out, System.err, clusterSpec);
    }
    return null;
  }
View Full Code Here

   
  }
 
  @Override
  protected void afterConfigure(ClusterActionEvent event) throws IOException {
    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());
    InetAddress namenodePublicAddress = HadoopCluster.getNamenodePublicAddress(cluster);
    InetAddress jobtrackerPublicAddress = HadoopCluster.getJobTrackerPublicAddress(cluster);

    LOG.info("Namenode web UI available at http://{}:{}",
      namenodePublicAddress.getHostName(), HadoopCluster.NAMENODE_WEB_UI_PORT);
View Full Code Here

  public void testDefaultConfigAwsEC2() throws Exception {
    Configuration baseConfig = new PropertiesConfiguration();
    baseConfig.addProperty("whirr.provider", "aws-ec2");
    baseConfig.addProperty("es.plugins", "lang-javascript, lang-python");

    ClusterSpec spec = ClusterSpec.withTemporaryKeys(baseConfig);
    Configuration config = ElasticSearchConfigurationBuilder.buildConfig(spec, null);

    assertThat(config.getStringArray("es.plugins"),
      is(new String[]{"lang-javascript", "lang-python", "elasticsearch/elasticsearch-cloud-aws/1.5.0"}));
    assertThat(config.getString("es.discovery.type"), is("ec2"));
View Full Code Here

  @Test
  public void testDefaultUnicastConfig() throws Exception {
    Configuration baseConfig = new PropertiesConfiguration();
    baseConfig.addProperty("whirr.provider", "cloudservers-us");

    ClusterSpec spec = ClusterSpec.withTemporaryKeys(baseConfig);
    Cluster cluster = mock(Cluster.class);

    Set<Cluster.Instance> instances = Sets.newLinkedHashSet();
    for(String host : Lists.newArrayList("10.0.0.1", "10.0.0.2")) {
      Cluster.Instance instance = mock(Cluster.Instance.class);
View Full Code Here

  public void testOverrideDefaults() throws Exception {
    Configuration baseConfig = new PropertiesConfiguration();
    baseConfig.addProperty("whirr.provider", "aws-ec2");
    baseConfig.addProperty("es.index.store.type", "fs");

    ClusterSpec spec = ClusterSpec.withTemporaryKeys(baseConfig);
    Configuration config = ElasticSearchConfigurationBuilder.buildConfig(spec, null);

    assertThat(config.getString("es.index.store.type"), is("fs"));
  }
View Full Code Here

  }
 
  @Override
  protected void beforeConfigure(ClusterActionEvent event) throws IOException,
      InterruptedException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Configuration conf = getConfiguration(clusterSpec);
    Cluster cluster = event.getCluster();
   
    Instance resourceManager = cluster.getInstanceMatching(role(ROLE));
    event.getFirewallManager().addRules(
View Full Code Here

    addStatement(event, call(getStartFunction(conf), "resourcemanager"));
  }
 
  @Override
  protected void afterConfigure(ClusterActionEvent event) throws IOException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();
    Instance resourceManager = cluster.getInstanceMatching(role(ROLE));
    LOG.info("Resource manager web UI available at http://{}:{}",
      resourceManager.getPublicHostName(), RESOURCE_MANAGER_WEB_UI_PORT);
   
View Full Code Here

    return getConfigureFunction(config, "hadoop", "configure_hadoop");
  }
 
  @Override
  protected void beforeBootstrap(ClusterActionEvent event) throws IOException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Configuration conf = getConfiguration(clusterSpec);

    addStatement(event, call("retry_helpers"));
    addStatement(event, call("configure_hostnames"));
    addStatement(event, call("install_tarball"));
View Full Code Here

  }
   
  @Override
  protected void beforeConfigure(ClusterActionEvent event)
      throws IOException, InterruptedException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();
   
    doBeforeConfigure(event);

    createHadoopConfigFiles(event, clusterSpec, cluster);

    addStatement(event, call("retry_helpers"));
    addStatement(event, call(
      getConfigureFunction(getConfiguration(clusterSpec)),
      Joiner.on(",").join(event.getInstanceTemplate().getRoles()),
      "-c", clusterSpec.getProvider())
    );
  }
View Full Code Here

TOP

Related Classes of org.apache.whirr.ClusterSpec

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.