Package org.apache.whirr.service

Examples of org.apache.whirr.service.Cluster


  }

  @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://{}",
      DnsUtil.resolveAddress(masterPublicAddress.getHostAddress()));
    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


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

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

    ComputeServiceContext computeServiceContext =
      ComputeServiceContextBuilder.build(clusterSpec);
View Full Code Here

  @Override
  protected void beforeConfigure(ClusterActionEvent event)
      throws IOException, InterruptedException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();
    int port = defaultPort;
    if (configKeyPort != null) {
      port = clusterSpec.getConfiguration().getInt(configKeyPort, defaultPort);
    }

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

    ComputeServiceContext computeServiceContext =
      ComputeServiceContextBuilder.build(clusterSpec);
View Full Code Here

    for (ClusterActionHandler handler : clusterActionHandlerLoader) {
      handlerMap.put(handler.getRole(), handler);
    }

    Map<InstanceTemplate, ClusterActionEvent> eventMap = Maps.newHashMap();
    Cluster newCluster = cluster;
    for (InstanceTemplate instanceTemplate : clusterSpec.getInstanceTemplates()) {
      StatementBuilder statementBuilder = new StatementBuilder();
      statementBuilder.addStatement(Statements.call("installRunUrl"));
      ClusterActionEvent event = new ClusterActionEvent(getAction(),
          clusterSpec, newCluster, statementBuilder);
View Full Code Here

        throw new IOException(e);
      }
      Set<String> roles = entry.getKey().getRoles();
      instances.addAll(getInstances(roles, nodes));
    }
    Cluster cluster = new Cluster(instances);
    for (ClusterActionEvent event : eventMap.values()) {
      event.setCluster(cluster);
    }
  }
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 =
        ComputeServiceContextBuilder.build(clusterSpec);
      ComputeService computeService = computeServiceContext.getComputeService();
      Credentials credentials = new Credentials(
          Iterables.get(cluster.getInstances(), 0).getLoginCredentials().identity,
          clusterSpec.readPrivateKey());
      try {
        LOG.info("Running configuration script");
        Payload script = newStringPayload(statementBuilder.render(OsFamily.UNIX));
        LOG.debug("Running script:\n{}", script.getRawContent());
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");
    ComputeServiceContext computeServiceContext =
      ComputeServiceContextBuilder.build(clusterSpec);
    FirewallSettings.authorizeIngress(computeServiceContext,
        cluster.getInstances(), clusterSpec, CLIENT_PORT);
   
    // Pass list of all servers in ensemble to configure script.
    // Position is significant: i-th server has id i.
    String servers = Joiner.on(' ').join(getPrivateIps(cluster.getInstancesMatching(
      RolePredicates.role(ZooKeeperClusterActionHandler.ZOOKEEPER_ROLE))));
    addRunUrl(event, "apache/zookeeper/post-configure", "-c",
        clusterSpec.getProvider(),
        servers);
  }
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(
      RolePredicates.role(ZooKeeperClusterActionHandler.ZOOKEEPER_ROLE))));
    LOG.info("Hosts: {}", hosts);
  }
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");
    ComputeServiceContext computeServiceContext =
      ComputeServiceContextBuilder.build(clusterSpec);
    FirewallSettings.authorizeIngress(computeServiceContext,
        cluster.getInstances(), clusterSpec, CLIENT_PORT);
    FirewallSettings.authorizeIngress(computeServiceContext,
        cluster.getInstances(), clusterSpec, JMX_PORT);
   
    List<Instance> seeds = getSeeds(cluster.getInstances());
    String servers = Joiner.on(' ').join(getPrivateIps(seeds));
    addRunUrl(event, "apache/cassandra/post-configure",
        "-c", clusterSpec.getProvider(), servers);
  }
View Full Code Here

    }
   
    try {
      ClusterSpec clusterSpec = getClusterSpec(optionSet);
      Service service = createService(clusterSpec.getServiceName());
      Cluster cluster = service.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

TOP

Related Classes of org.apache.whirr.service.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.