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


      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

      public boolean apply(NodeMetadata nodeMetadata) {
        // Check it's the correct cluster
        if (!clusterSpec.getClusterName().equals(nodeMetadata.getGroup())) {
          return false;
        }
        Instance instance = nodeIdToInstanceMap.get(nodeMetadata.getId());
        if (instance == null) {
          LOG.debug("No instance for {} found in map", nodeMetadata);
          return false;
        }
        return RolePredicates.onlyRolesIn(roles).apply(instance);
View Full Code Here

        Maps.<String,String>newHashMap(), processors, 1024,
        Lists.<Volume>newArrayList(), null);
    when(node.getHardware()).thenReturn(hardware);
   
    Set<Instance> instances = Sets.newLinkedHashSet();
    Instance master = new Instance(new Credentials("", ""),
        Sets.newHashSet(HadoopNameNodeClusterActionHandler.ROLE,
            HadoopJobTrackerClusterActionHandler.ROLE),
            "10.0.0.1", "10.0.0.1", "1", node);
    instances.add(master);
    for (int i = 0; i < numberOfWorkers; i++) {
      int id = i + 2;
      instances.add(new Instance(new Credentials("", ""),
          Sets.newHashSet(HadoopDataNodeClusterActionHandler.ROLE,
              HadoopTaskTrackerClusterActionHandler.ROLE),
              "10.0.0." + id, "10.0.0." + id, id + "", node));
    }
    return new Cluster(instances);
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(), null);
      }
    }));
  }
View Full Code Here

  static Configuration buildCommonConfiguration(ClusterSpec clusterSpec,
      Cluster cluster, Configuration defaults) throws ConfigurationException, IOException {
    Configuration config = build(clusterSpec, cluster, defaults,
        "hadoop-common");

    Instance namenode = cluster
        .getInstanceMatching(role(HadoopNameNodeClusterActionHandler.ROLE));
    config.setProperty("fs.default.name", String.format("hdfs://%s:8020/",
        namenode.getPublicAddress().getHostName()));
    return config;
  }
View Full Code Here

      int clusterReduceSlots = taskTrackers.size() * reduceTasksPerNode;
      setIfAbsent(config, "mapred.reduce.tasks", clusterReduceSlots + "");
     
    }

    Instance jobtracker = cluster
        .getInstanceMatching(role(HadoopJobTrackerClusterActionHandler.ROLE));
    config.setProperty("mapred.job.tracker", String.format("%s:8021",
        jobtracker.getPublicAddress().getHostName()));
    return config;
  }
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

  @Override
  protected void beforeConfigure(ClusterActionEvent event) throws IOException, InterruptedException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();
   
    Instance namenode = cluster.getInstanceMatching(role(ROLE));
    event.getFirewallManager().addRules(
        Rule.create()
          .destination(namenode)
          .ports(NAMENODE_WEB_UI_PORT, JOBTRACKER_WEB_UI_PORT),
        Rule.create()
          .source(namenode.getPublicAddress().getHostAddress())
          .destination(namenode)
          .ports(NAMENODE_PORT, JOBTRACKER_PORT)
    );
   
    try {
View Full Code Here

    Cluster cluster = event.getCluster();
   
    // TODO: wait for TTs to come up (done in test for the moment)
   
    LOG.info("Completed configuration of {}", clusterSpec.getClusterName());
    Instance instance = cluster.getInstanceMatching(role(ROLE));
    InetAddress namenodePublicAddress = instance.getPublicAddress();
    InetAddress jobtrackerPublicAddress = namenodePublicAddress;

    LOG.info("Namenode web UI available at http://{}:{}",
      namenodePublicAddress.getHostName(), NAMENODE_WEB_UI_PORT);
    LOG.info("Jobtracker web UI available at http://{}:{}",
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.