Package org.apache.whirr

Examples of org.apache.whirr.Cluster


  }

  @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));
    InetAddress masterPublicAddress = instance.getPublicAddress();

    event.getFirewallManager().addRules(
      Rule.create()
        .destination(instance)
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);
    Properties config = createClientSideProperties(masterPublicAddress, quorum);
    createClientSideHadoopSiteFile(clusterSpec, config);
    createProxyScript(clusterSpec, cluster);
    event.setCluster(new Cluster(cluster.getInstances(), config));
  }
View Full Code Here

      instances.add(new Cluster.Instance(credentials, roles,
        publicIPAddress, privateIPAddress, id, null));
    }

    return new Cluster(instances);
  }
View Full Code Here

  /**
   * Get the cluster instance together with NodeMetadata (through API calls)
   */
  protected Cluster getCluster(ClusterSpec clusterSpec, ClusterController controller)
      throws IOException, InterruptedException {
    return new Cluster(controller.getInstances(
        clusterSpec, createClusterStateStore(clusterSpec)));
  }
View Full Code Here

    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);
      store.save(expected);

      /* load and check the stored state */
      Cluster stored = store.load();
      Cluster.Instance first = Iterables.getFirst(stored.getInstances(), null);
      assertNotNull(first);

      assertThat(first.getId(), is("region/id1"));
      assertThat(first.getRoles().contains("role1"), is(true));
      assertThat(stored.getInstances().size(), is(2));

      /* destroy stored state and check it no longer exists */
      store.destroy();
      expected = store.load();
      assertNull(expected);
View Full Code Here

      String ip = "127.0.0." + (i + 1);
      instances.add(new Cluster.Instance(credentials,
        Sets.newHashSet(roles[i]), ip, ip, ids[i], null));
    }

    return new Cluster(instances);
  }
View Full Code Here

  public Cluster execute(ClusterSpec clusterSpec, Cluster cluster)
      throws IOException, InterruptedException {

    Map<InstanceTemplate, ClusterActionEvent> eventMap = Maps.newHashMap();
    Cluster newCluster = cluster;
    for (InstanceTemplate instanceTemplate : clusterSpec.getInstanceTemplates()) {
      if (shouldIgnoreInstanceTemplate(instanceTemplate)) {
        continue; // skip execution if this group of instances is not in target
      }
      StatementBuilder statementBuilder = new StatementBuilder();
View Full Code Here

        continue; // skip if not in the target
      }

      eventSpecificActions(entry);

      Cluster cluster = entry.getValue().getCluster();
      StatementBuilder statementBuilder = entry.getValue().getStatementBuilder();
      if (statementBuilder.isEmpty()) {
        continue; // skip execution if we have an empty list
      }

      Set<Instance> instances = cluster.getInstancesMatching(Predicates.<Instance> and(onlyRolesIn(entry.getKey()
          .getRoles()), not(instanceIsNotInTarget())));
      LOG.info("Starting to run scripts on cluster for phase {} " + "on instances: {}", phaseName,
          asString(instances));

      for (Instance instance : instances) {
View Full Code Here

        throw new IOException(e.getCause());
      }
    }
     
    if (action.equals(ClusterActionHandler.BOOTSTRAP_ACTION)) {
      Cluster cluster = new Cluster(allInstances);
      for (ClusterActionEvent event : eventMap.values()) {
        event.setCluster(cluster);
      }
    }
  }
View Full Code Here

        }
    }
  }

  private Cluster.Instance findMahoutInstance() throws IOException {
      Cluster cluster = new ClusterStateStoreFactory().create(clusterSpec).load();
      return cluster.getInstanceMatching(anyRoleIn(newHashSet(MAHOUT_CLIENT_ROLE)));
  }
View Full Code Here

TOP

Related Classes of org.apache.whirr.Cluster

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.