Package org.apache.whirr

Examples of org.apache.whirr.Cluster$Instance


        is("/data0/hadoop/hdfs/data,/data1/hadoop/hdfs/data"));
  }

  @Test
  public void testMapReduce() throws Exception {
    Cluster cluster = newCluster(5);
    Configuration conf = HadoopConfigurationBuilder
      .buildMapReduceConfiguration(clusterSpec, cluster, defaults,
          Sets.newLinkedHashSet(Lists.newArrayList("/data0", "/data1")));
    assertThat(conf.getString("p1"), is("mapred1"));
    assertThat(conf.getString("mapred.job.tracker"), matches(".+:8021"));
View Full Code Here


  public void testPrintAccess() {
    final Instance instance = mock(Instance.class);

    when(instance.getPublicIp()).thenReturn("test-public-ip");

    Cluster cluster = mock(Cluster.class);

    when(cluster.getInstances()).thenReturn(ImmutableSet.<Cluster.Instance>of(instance));

    ClusterSpec spec = mock(ClusterSpec.class);
    when(spec.getClusterUser()).thenReturn("test-identity");
    when(spec.getPrivateKeyFile()).thenReturn(new File("/test/key/path"));
View Full Code Here

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

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

    Credentials credentials = new Credentials("dummy", "dummy");
    Cluster.Instance instance = new Cluster.Instance(credentials,
        Sets.newHashSet("foo"), "127.0.0.1", "127.0.0.1", "id-0", null);

    ClusterSpec clusterSpec = ClusterSpec.withTemporaryKeys(new PropertiesConfiguration("whirr-core-test.properties"));
    Cluster cluster = new Cluster(Sets.newHashSet(instance));
    VelocityEngine ve = TemplateUtils.newVelocityEngine();

    String result = TemplateUtils.processTemplate(ve, "template-test.txt.vm", clusterSpec, cluster);
   
    Assert.assertEquals("instance ip: 127.0.0.1", result);
View Full Code Here

  @Override
  protected void beforeConfigure(ClusterActionEvent event) throws IOException,
      InterruptedException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Configuration conf = getConfiguration(clusterSpec);
    Cluster cluster = event.getCluster();
   
    Set<Instance> nodeManagers = cluster.getInstancesMatching(role(ROLE));
    if (!nodeManagers.isEmpty()) {
        for(Instance nodeManager : nodeManagers) {
            event.getFirewallManager().addRules(
                    Rule.create()
                      .destination(nodeManager)
View Full Code Here

    addStatement(event, call(FUNCTION_INSTALL, optArgs.toArray(new String[optArgs.size()])));
  }

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

    LOG.info("Authorizing firewall");
    event.getFirewallManager().addRule(
      Rule.create()
        .destination(cluster.getInstancesMatching(role(ROLE)))
        .ports(CLIENT_PORT, ADMIN_PORT, HTTP_PORT)
    );

    String servers = Joiner.on(' ').join(getPrivateIps(cluster.getInstances()));

    Configuration config = event.getClusterSpec().getConfiguration();
    int partitionsPerNode = config.getInt(PARAM_PARTITIONS_PER_NODE, 10);

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

  }

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

    String servers = Joiner.on(' ').join(getPrivateIps(cluster.getInstances()));

    LOG.info("Completed setup of Voldemort {} with servers {}",
        clusterSpec.getClusterName(), servers);
  }
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)
    );

    // 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 beforeConfigure(final ClusterActionEvent event)
    throws IOException, InterruptedException {
    Cluster cluster = event.getCluster();
    Set<Instance> instances = cluster.getInstancesMatching(role(CASSANDRA_ROLE));

    event.getFirewallManager().addRule(
      Rule.create()
        .destination(instances)
        .ports(CLIENT_PORT, JMX_PORT)
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.