Package org.apache.whirr.Cluster

Examples of org.apache.whirr.Cluster.Instance


    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);
View Full Code Here


import org.junit.Test;

public class CassandraClusterActionHandlerTest {

  private Instance getInstance(String id) throws UnknownHostException {
    return new Instance(new Credentials("", ""), Sets.newHashSet(""),
        "127.0.0.1", "127.0.0.1", id, null);
  }
View Full Code Here

        "127.0.0.1", "127.0.0.1", id, null);
  }
 
  @Test()
  public void testGetSeeds() throws UnknownHostException {
    Instance one = getInstance("1");
    Instance two = getInstance("2");
   
    Set<Instance> instances = Sets.newLinkedHashSet();
    instances.add(one);
   
    CassandraClusterActionHandler handler = new CassandraClusterActionHandler();
View Full Code Here

    return ImmutableSet.copyOf(transform(nodes,
        new Function<NodeMetadata, Instance>() {
          @Override
          public Instance apply(NodeMetadata node) {
            String publicIp = get(node.getPublicAddresses().size() > 0 ? node.getPublicAddresses() : node.getPrivateAddresses(), 0);
            return new Instance(
                credentials, roles, publicIp, publicIp, node.getId(), node
            );
          }
        }
    ));
View Full Code Here

      Set<? extends NodeMetadata> nodes) {
    return Sets.newLinkedHashSet(Collections2.transform(Sets.newLinkedHashSet(nodes),
        new Function<NodeMetadata, Instance>() {
      @Override
      public Instance apply(NodeMetadata node) {
        return new Instance(node.getCredentials(), roles,
                            Iterables.get(node.getPublicAddresses().size() > 0 ? node.getPublicAddresses() : node.getPrivateAddresses(), 0),
                            Iterables.get(node.getPrivateAddresses().size() > 0 ? node.getPrivateAddresses() : node.getPublicAddresses(), 0),
            node.getId(), node);
      }
    }));
View Full Code Here

 
  @Override
  protected void doBeforeConfigure(ClusterActionEvent event) throws IOException {
    Cluster cluster = event.getCluster();
   
    Instance namenode = cluster.getInstanceMatching(role(ROLE));
    event.getFirewallManager().addRules(
        Rule.create()
          .destination(namenode)
          .ports(HadoopCluster.NAMENODE_WEB_UI_PORT),
        Rule.create()
          .source(namenode.getPublicAddress().getHostAddress())
          .destination(namenode)
          .ports(HadoopCluster.NAMENODE_PORT, HadoopCluster.JOBTRACKER_PORT)
    );
   
  }
View Full Code Here

    cluster = controller.launchCluster(clusterSpec);
  }
 
  @Test(timeout = TestConstants.ITEST_TIMEOUT)
  public void test() throws Exception {
    Instance metad = cluster.getInstanceMatching(RolePredicates.role(GangliaMetadClusterActionHandler.GANGLIA_METAD_ROLE));
    String metadHostname = metad.getPublicHostName();

    assertNotNull(metadHostname);
    HttpClient client = new HttpClient();
    GetMethod getIndex = new GetMethod(String.format("http://%s/ganglia/", metadHostname));
    int statusCode = client.executeMethod(getIndex);
View Full Code Here

      return null;
    }
    return Iterables.getOnlyElement(jobtracker);
  }
  public static InetAddress getJobTrackerPublicAddress(Cluster cluster) throws IOException {
    Instance jt = getJobTracker(cluster);
    return jt == null ? null : jt.getPublicAddress();
  }
View Full Code Here

  public static InetAddress getJobTrackerPublicAddress(Cluster cluster) throws IOException {
    Instance jt = getJobTracker(cluster);
    return jt == null ? null : jt.getPublicAddress();
  }
  public static InetAddress getJobTrackerPrivateAddress(Cluster cluster) throws IOException {
    Instance jt = getJobTracker(cluster);
    return jt == null ? null : jt.getPrivateAddress();
  }
View Full Code Here

      InterruptedException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Configuration conf = getConfiguration(clusterSpec);
    Cluster cluster = event.getCluster();
   
    Instance resourceManager = cluster.getInstanceMatching(role(ROLE));
    event.getFirewallManager().addRules(
        Rule.create()
          .destination(resourceManager)
          .ports(RESOURCE_MANAGER_RPC_PORT, RESOURCE_MANAGER_WEB_UI_PORT),
        Rule.create()
          .source(resourceManager.getPublicIp())
          .destination(resourceManager)
          .ports(RESOURCE_MANAGER_RPC_PORT)
    );
   
    try {
View Full Code Here

TOP

Related Classes of org.apache.whirr.Cluster.Instance

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.