Package org.apache.whirr

Examples of org.apache.whirr.Cluster$Instance


      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


  }

  @Override
  protected void beforeConfigure(ClusterActionEvent event) throws IOException, 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)
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

    } else if(optionSet.has(rolesOption)) {
      String[] roles = optionSet.valueOf(rolesOption).split(",");
      List<String> ids = Lists.newArrayList();

      Cluster cluster = createClusterStateStore(spec).load();
      for (Cluster.Instance instance : cluster.getInstancesMatching(
        anyRoleIn(Sets.<String>newHashSet(roles)))) {
        ids.add(instance.getId().split("\\/")[1]);
      }

      condition = Predicates.and(condition,
View Full Code Here

    }
   
    try {
      ClusterSpec clusterSpec = getClusterSpec(optionSet);
      ClusterController controller = createClusterController(clusterSpec.getServiceName());
      Cluster cluster = controller.launchCluster(clusterSpec);
      out.printf("Started cluster of %s instances\n",
          cluster.getInstances().size());
      out.println(cluster);
      return 0;
    } catch (IllegalArgumentException e) {
      err.println(e.getMessage());
      printUsage(parser, err);
View Full Code Here

            throws IOException, GFacHandlerException, ConfigurationException, InterruptedException, TransformerException, ParserConfigurationException {
        ClusterSpec hadoopClusterSpec =
                whirrConfigurationToClusterSpec(hostDescription, workingDirectory);
        ClusterController hadoopClusterController =
                createClusterController(hadoopClusterSpec.getServiceName());
        Cluster hadoopCluster =  hadoopClusterController.launchCluster(hadoopClusterSpec);

        logger.info(String.format("Started cluster of %s instances.\n",
                hadoopCluster.getInstances().size()));

        File siteXML = new File(workingDirectory, "hadoop-site.xml");
        clusterPropertiesToHadoopSiteXml(hadoopCluster.getConfiguration(), siteXML);

        return siteXML;
    }
View Full Code Here

      instances.add(new Cluster.Instance(credentials, roles,
        InetAddress.getByName(publicAddress).getHostAddress(),
        privateAddress, id, null));
    }

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

  protected void doAction(Map<InstanceTemplate, ClusterActionEvent> eventMap)
      throws IOException {
   
    for (Entry<InstanceTemplate, ClusterActionEvent> entry : eventMap.entrySet()) {
      ClusterSpec clusterSpec = entry.getValue().getClusterSpec();
      Cluster cluster = entry.getValue().getCluster();

      StatementBuilder statementBuilder = entry.getValue().getStatementBuilder();

      ComputeServiceContext computeServiceContext = getCompute().apply(clusterSpec);
      ComputeService computeService = computeServiceContext.getComputeService();
View Full Code Here

      throws IOException, InterruptedException;

  public Cluster execute(ClusterSpec clusterSpec, Cluster cluster) throws IOException, InterruptedException {
   
    Map<InstanceTemplate, ClusterActionEvent> eventMap = Maps.newHashMap();
    Cluster newCluster = cluster;
    for (InstanceTemplate instanceTemplate : clusterSpec.getInstanceTemplates()) {
      StatementBuilder statementBuilder = new StatementBuilder();

      ComputeServiceContext computServiceContext = getCompute().apply(clusterSpec);
      FirewallManager firewallManager = new FirewallManager(computServiceContext,
View Full Code Here

        throw new IOException(e.getCause());
      }
    }
     
    if (action.equals(ClusterActionHandler.BOOTSTRAP_ACTION)) {
      Cluster cluster = new Cluster(instances);
      for (ClusterActionEvent event : eventMap.values()) {
        event.setCluster(cluster);
      }
    }
  }
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.