Package org.apache.whirr.Cluster

Examples of org.apache.whirr.Cluster.Instance


      throws IOException, InterruptedException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();
    Configuration conf = getConfiguration(clusterSpec);

    Instance instance = cluster.getInstanceMatching(
      role(HBaseMasterClusterActionHandler.ROLE));
    InetAddress masterPublicAddress = instance.getPublicAddress();

    event.getFirewallManager().addRules(
      Rule.create()
        .destination(instance)
        .ports(REGIONSERVER_WEB_UI_PORT, REGIONSERVER_PORT)
View Full Code Here


      InterruptedException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();

    LOG.info("Authorizing firewall");
    Instance instance = cluster.getInstanceMatching(role(ROLE));
    InetAddress masterPublicAddress = instance.getPublicAddress();

    event.getFirewallManager().addRules(
        Rule.create().destination(instance).ports(MASTER_WEB_UI_PORT),
        Rule.create().destination(instance).ports(MASTER_PORT));
View Full Code Here

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

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

    LOG.info("BSPMaster web UI available at http://{}:{}",
        masterPublicAddress.getHostName(), MASTER_WEB_UI_PORT);
   
    String quorum = ZooKeeperCluster.getHosts(cluster);
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

  public static final String EXPECTED_SSH_COMMAND = "You can log into instances using the following ssh commands:\n"
      + "'ssh -i /test/key/path -o \"UserKnownHostsFile /dev/null\" -o StrictHostKeyChecking=no test-identity@test-public-ip'\n";

  @Test
  public void testPrintAccess() {
    final Instance instance = mock(Instance.class);

    when(instance.getPublicIp()).thenReturn("test-public-ip");

    Cluster cluster = mock(Cluster.class);

    when(cluster.getInstances()).thenReturn(new HashSet<Cluster.Instance>() {
      {
View Full Code Here

    return Sets.newLinkedHashSet(Collections2.transform(Sets.newLinkedHashSet(nodes),
        new Function<NodeMetadata, Instance>() {
          @Override
          public Instance apply(NodeMetadata node) {
            String publicIp = Iterables.get(node.getPublicAddresses(), 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(), 0),
            Iterables.get(node.getPrivateAddresses(), 0),
            node.getId(), node);
      }
    }));
View Full Code Here

      throws IOException, InterruptedException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();
    Configuration conf = getConfiguration(clusterSpec);

    Instance instance = cluster.getInstanceMatching(
      role(HBaseMasterClusterActionHandler.ROLE));
    InetAddress masterPublicAddress = instance.getPublicAddress();

    event.getFirewallManager().addRules(
      Rule.create()
        .destination(instance)
        .ports(REGIONSERVER_WEB_UI_PORT, REGIONSERVER_PORT)
View Full Code Here

        ImmutableMap.<String,String>of(), ImmutableSet.<String>of(), processors,
        1024, ImmutableList.<Volume>of(), null);
    when(node.getHardware()).thenReturn(hardware);
   
    Builder<Instance> instances = ImmutableSet.<Instance>builder();
    Instance master = new Instance(new Credentials("", ""),
        ImmutableSet.of(HadoopNameNodeClusterActionHandler.ROLE,
            HadoopJobTrackerClusterActionHandler.ROLE),
            "10.0.0.1", "10.0.0.1", "1", node, fakeDnsResolver);
    instances.add(master);
    for (int i = 0; i < numberOfWorkers; i++) {
      int id = i + 2;
      instances.add(new Instance(new Credentials("", ""),
        ImmutableSet.of(HadoopDataNodeClusterActionHandler.ROLE,
              HadoopTaskTrackerClusterActionHandler.ROLE),
              "10.0.0." + id, "10.0.0." + id, id + "", node, fakeDnsResolver));
    }
    return new Cluster(instances.build());
View Full Code Here

    cluster = controller.launchCluster(clusterSpec);
  }
 
  @Test
  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

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.