Package org.apache.whirr

Examples of org.apache.whirr.ClusterSpec


    return ROLE;
  }

  @Override
  protected void beforeBootstrap(ClusterActionEvent event) throws IOException {
    ClusterSpec clusterSpec = event.getClusterSpec();   
    Configuration conf = getConfiguration(clusterSpec);

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


    );
  }

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

    LOG.info("Authorizing firewall");
    Instance instance = cluster.getInstanceMatching(role(ROLE));
View Full Code Here

    ));
  }

  @Override
  protected void afterConfigure(ClusterActionEvent event) throws IOException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();

    // TODO: wait for regionservers to come up?

    LOG.info("Completed configuration of {}", clusterSpec.getClusterName());
    Instance instance = cluster.getInstanceMatching(role(ROLE));
    InetAddress masterPublicAddress = instance.getPublicAddress();

    LOG.info("Web UI available at http://{}", masterPublicAddress.getHostName());
    String quorum = ZooKeeperCluster.getHosts(cluster);
View Full Code Here

    config.addConfiguration(optionsConfig);
    if (optionSet.has(configOption)) {
      Configuration defaults = new PropertiesConfiguration(optionSet.valueOf(configOption));
      config.addConfiguration(defaults);
    }
    ClusterSpec clusterSpec = new ClusterSpec(config);

    for (Property required : EnumSet.of(CLUSTER_NAME, PROVIDER, IDENTITY, CREDENTIAL,
        INSTANCE_TEMPLATES, PRIVATE_KEY_FILE)) {
      if (clusterSpec.getConfiguration().getString(required.getConfigName()) == null) {
        throw new IllegalArgumentException(String.format("Option '%s' not set.",
            required.getSimpleName()));
      }
    }
View Full Code Here

    return ClusterSpec.withTemporaryKeys(getTestConfiguration());
  }

  @Test(timeout = TestConstants.ITEST_TIMEOUT)
  public void testStoreAndLoadState() throws Exception {
    ClusterSpec spec = getTestClusterSpec();

    BlobStoreContext context = BlobStoreContextBuilder.build(spec);
    String container = generateRandomContainerName(context);
    try {
      spec.setStateStore("blob");
      spec.setStateStoreContainer(container);

      Cluster expected = createTestCluster(new String[]{"region/id1", "region/id2"},
          new String[]{"role1", "role2"});

      BlobClusterStateStore store = new BlobClusterStateStore(spec);
View Full Code Here

    }
  }

  @Test(expected = IllegalArgumentException.class, timeout = TestConstants.ITEST_TIMEOUT)
  public void testInvalidContainerName() throws Exception {
    ClusterSpec spec = getTestClusterSpec();

    /* underscores are not allowed and it should throw exception */
    spec.setStateStoreContainer("whirr_test");
  }
View Full Code Here

      throws InterruptedException, IOException {

    final String phaseName = getAction();
    final Collection<Future<ExecResponse>> futures = Sets.newHashSet();

    final ClusterSpec clusterSpec = eventMap.values().iterator().next().getClusterSpec();

    final RunScriptOptions options = overrideLoginCredentials(LoginCredentials.builder().user(clusterSpec.getClusterUser())
                                                              .privateKey(clusterSpec.getPrivateKey()).build());
    for (Map.Entry<InstanceTemplate, ClusterActionEvent> entry : eventMap.entrySet()) {
      if (shouldIgnoreInstanceTemplate(entry.getKey())) {
        continue; // skip if not in the target
      }
View Full Code Here

  }

  @Override
  protected void postRunScriptsActions(
      Map<InstanceTemplate, ClusterActionEvent> eventMap) throws IOException {
    ClusterSpec clusterSpec = eventMap.values().iterator().next()
        .getClusterSpec();
    LOG.info("Destroying " + clusterSpec.getClusterName() + " cluster");
    ComputeService computeService = getCompute().apply(clusterSpec)
        .getComputeService();
    computeService.destroyNodesMatching(inGroup(clusterSpec.getClusterName()));
    LOG.info("Cluster {} destroyed", clusterSpec.getClusterName());
  }
View Full Code Here

    int numberAllocated = 0;
    Set<Instance> allInstances = Sets.newLinkedHashSet();

    for (Entry<InstanceTemplate, ClusterActionEvent> entry : eventMap.entrySet()) {

      final ClusterSpec clusterSpec = entry.getValue().getClusterSpec();
      final StatementBuilder statementBuilder = entry.getValue().getStatementBuilder();
      if (statementBuilder.isEmpty()) {
        continue; // skip
      }

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

      LoginCredentials credentials = LoginCredentials.builder().user(clusterSpec.getClusterUser())
            .privateKey(clusterSpec.getPrivateKey()).build();
     
      final RunScriptOptions options = overrideLoginCredentials(credentials);

      if (numberAllocated == 0) {
        for (ComputeMetadata compute : computeService.listNodes()) {
View Full Code Here

   * Apply the firewall rules specified via configuration.
   */
  protected void eventSpecificActions(Entry<InstanceTemplate, ClusterActionEvent> entry)
      throws IOException {
    ClusterActionEvent event = entry.getValue();
    ClusterSpec clusterSpec = event.getClusterSpec();
   
    Map<String, List<String>> firewallRules = clusterSpec.getFirewallRules();
    for (String role: firewallRules.keySet()) {
      if (!roleIsInTarget(role)) {
        continue;   // skip execution for this role
      }
      Rule rule = Rule.create();
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.