Package org.apache.whirr

Examples of org.apache.whirr.Cluster


  @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).ports(MASTER_WEB_UI_PORT),
        Rule.create().destination(instance).ports(MASTER_PORT));
View Full Code Here


  }

  @Override
  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);
    Properties config = createClientSideProperties(masterPublicAddress, quorum);
    createClientSideHadoopSiteFile(clusterSpec, config);
    createProxyScript(clusterSpec, cluster);
    event.setCluster(new Cluster(cluster.getInstances(), config));
  }
View Full Code Here

    if (clusterSpec.getInstanceTemplates().size() == 0) {
        throw new IllegalArgumentException("No instance templates specified.");
    }
   
    Map<InstanceTemplate, ClusterActionEvent> eventMap = Maps.newHashMap();
    Cluster newCluster = cluster;
    for (InstanceTemplate instanceTemplate : clusterSpec.getInstanceTemplates()) {
      if (shouldIgnoreInstanceTemplate(instanceTemplate)) {
        continue; // skip execution if this group of instances is not in target
      }
      StatementBuilder statementBuilder = new StatementBuilder();
View Full Code Here

        continue; // skip if not in the target
      }



      Cluster cluster = entry.getValue().getCluster();
      StatementBuilder statementBuilder = entry.getValue().getStatementBuilder();
      if (statementBuilder.isEmpty()) {
        continue; // skip execution if we have an empty list
      }

      Set<Instance> instances = cluster.getInstancesMatching(Predicates.<Instance> and(onlyRolesIn(entry.getKey()
          .getRoles()), not(instanceIsNotInTarget())));
      LOG.info("Starting to run scripts on cluster for phase {} " + "on instances: {}", phaseName,
          asString(instances));

      for (Instance instance : instances) {
View Full Code Here

      "10.0.0.1",
      region + "/i-dummy",
      null
    ));

    manager = new FirewallManager(context, clusterSpec, new Cluster(instances));
  }
View Full Code Here

    }
  }

  public int run(InputStream in, PrintStream out, PrintStream err, ClusterSpec clusterSpec) throws Exception {
    ClusterController controller = createClusterController(clusterSpec.getServiceName());
    Cluster cluster = controller.launchCluster(clusterSpec);
    out.printf("Started cluster of %s instances\n",
      cluster.getInstances().size());
    out.println(cluster);

    Utils.printSSHConnectionDetails(out, clusterSpec, cluster, 20);

    out.println("To destroy cluster, run 'whirr destroy-cluster' with the same options used to launch it.");
View Full Code Here

  @Override
  protected void beforeConfigure(ClusterActionEvent event)
    throws IOException, InterruptedException {

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

    event.getFirewallManager().addRule(
      Rule.create().destination(role(ZOOKEEPER_ROLE)).port(CLIENT_PORT)
    );

    handleFirewallRules(event);

    // Pass list of all servers in ensemble to configure script.
    // Position is significant: i-th server has id i.

    Set<Instance> ensemble = cluster.getInstancesMatching(role(ZOOKEEPER_ROLE));
    String servers = Joiner.on(' ').join(getPrivateIps(ensemble));

    Configuration config = getConfiguration(clusterSpec);

    addStatement(event, call("retry_helpers"));
View Full Code Here

  }

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

    LOG.info("Completed configuration of {}", clusterSpec.getClusterName());
    String hosts = Joiner.on(',').join(getHosts(cluster.getInstancesMatching(
        role(ZOOKEEPER_ROLE))));
    LOG.info("Hosts: {}", hosts);
  }
View Full Code Here

  }

  @Override
  protected void afterStart(ClusterActionEvent event) throws IOException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();
    Configuration config = getConfiguration(clusterSpec, SOLR_DEFAULT_CONFIG);
    int jettyPort = config.getInt(SOLR_JETTY_PORT);
    LOG.info("Completed configuration of {}", clusterSpec.getClusterName());
    LOG.info("Solr Hosts: {}", getHosts(cluster.getInstancesMatching(role(SOLR_ROLE)), jettyPort));
  }
View Full Code Here

      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

TOP

Related Classes of org.apache.whirr.Cluster

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.