Package org.apache.whirr.Cluster

Examples of org.apache.whirr.Cluster.Instance


  @Override
  protected void doBeforeConfigure(ClusterActionEvent event) throws IOException {
    Cluster cluster = event.getCluster();
   
    Instance jobtracker = cluster.getInstanceMatching(role(HadoopJobTrackerClusterActionHandler.ROLE));
    event.getFirewallManager().addRules(
        Rule.create()
          .destination(jobtracker)
          .ports(HadoopCluster.JOBTRACKER_WEB_UI_PORT),
        Rule.create()
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.getPublicHostName()));
    return config;
  }
View Full Code Here

        setIfAbsent(config, "mapred.reduce.tasks", clusterReduceSlots + "");

      }
    }

    Instance jobtracker = cluster
        .getInstanceMatching(role(HadoopJobTrackerClusterActionHandler.ROLE));
    config.setProperty("mapred.job.tracker", String.format("%s:8021",
        jobtracker.getPublicHostName()));
    return config;
  }
View Full Code Here

 
  @Override
  protected void doBeforeConfigure(ClusterActionEvent event) throws IOException {
    Cluster cluster = event.getCluster();
   
    Instance jobtracker = cluster.getInstanceMatching(role(ROLE));
    event.getFirewallManager().addRules(
        Rule.create()
          .destination(jobtracker)
          .ports(HadoopCluster.JOBTRACKER_WEB_UI_PORT),
        Rule.create()
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

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

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

    event.getFirewallManager().addRules(
        Rule.create().destination(instance).ports(61000, GROOMSERVER_PORT));

    String hamaConfigureFunction = getConfiguration(clusterSpec).getString(
View Full Code Here

    addStatement(event, call("install_kerberos_client"));
  }

  @Override
  protected void beforeConfigure(ClusterActionEvent event) throws IOException {
    Instance kerberosServerInstance = null;
    try {
      kerberosServerInstance = event.getCluster().getInstanceMatching(role(KerberosServerHandler.ROLE));
    } catch (NoSuchElementException noSuchElementException) {
      // ignore exception which a indicates client role has been configured
      // without a cluster KDC role, but ensure the configure client script is
      // not executed, which depends on the KDC hostname
    }
    if (kerberosServerInstance != null) {
      addStatement(event, call("configure_kerberos_client", "-h", kerberosServerInstance.getPublicHostName()));
    }
  }
View Full Code Here

                                      Set<Instance> instances, final ClusterSpec clusterSpec, List<String> cidrs, int... ports) {

    try {
      if (computeServiceContext.getComputeService().getSecurityGroupExtension().isPresent()) {
        SecurityGroupExtension securityGroupExtension = computeServiceContext.getComputeService().getSecurityGroupExtension().get();
        Instance instance = Iterables.getFirst(instances, null);
        if (instance != null) {
          SecurityGroup group = Iterables.find(securityGroupExtension.listSecurityGroupsForNode(instance.getNodeMetadata().getId()),
              new Predicate<SecurityGroup>() {
                @Override
                public boolean apply(SecurityGroup input) {
                  if (input.getName().contains(clusterSpec.getClusterName()) ||
                      input.getId().contains(clusterSpec.getClusterName())) {
                    return true;
                  }
                  return false//To change body of implemented methods use File | Settings | File Templates.
                }
              });

          if (group == null) {
            group = securityGroupExtension.createSecurityGroup(clusterSpec.getClusterName(),
                instance.getNodeMetadata().getLocation());
          }

          for (int port : ports) {
            IpPermission.Builder builder = IpPermission.builder();
            builder.cidrBlocks(cidrs);
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

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.