Search in sources :

Example 16 with ClusterSpec

use of org.apache.whirr.ClusterSpec in project whirr by apache.

the class GangliaMetadClusterActionHandler method beforeBootstrap.

@Override
protected void beforeBootstrap(ClusterActionEvent event) throws IOException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Configuration config = getConfiguration(clusterSpec);
    addStatement(event, call("retry_helpers"));
    addStatement(event, call(getInstallFunction(config), "-r", GANGLIA_METAD_ROLE));
}
Also used : Configuration(org.apache.commons.configuration.Configuration) ClusterSpec(org.apache.whirr.ClusterSpec)

Example 17 with ClusterSpec

use of org.apache.whirr.ClusterSpec in project whirr by apache.

the class ElasticSearchHandler method beforeBootstrap.

@Override
protected void beforeBootstrap(ClusterActionEvent event) throws IOException {
    ClusterSpec spec = event.getClusterSpec();
    Configuration config = spec.getConfiguration();
    addStatement(event, call("retry_helpers"));
    addStatement(event, call("install_tarball"));
    addStatement(event, call(getInstallFunction(config, "java", "install_openjdk")));
    String tarurl = prepareRemoteFileUrl(event, config.getString("whirr.elasticsearch.tarball.url", ""));
    addStatement(event, call("install_elasticsearch", tarurl));
}
Also used : Configuration(org.apache.commons.configuration.Configuration) ClusterSpec(org.apache.whirr.ClusterSpec)

Example 18 with ClusterSpec

use of org.apache.whirr.ClusterSpec in project whirr by apache.

the class ElasticSearchConfigurationBuilderTest method testOverrideDefaults.

@Test
public void testOverrideDefaults() throws Exception {
    Configuration baseConfig = new PropertiesConfiguration();
    baseConfig.addProperty("whirr.provider", "aws-ec2");
    baseConfig.addProperty("es.index.store.type", "fs");
    ClusterSpec spec = ClusterSpec.withTemporaryKeys(baseConfig);
    Configuration config = ElasticSearchConfigurationBuilder.buildConfig(spec, null);
    assertThat(config.getString("es.index.store.type"), is("fs"));
}
Also used : Configuration(org.apache.commons.configuration.Configuration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) ClusterSpec(org.apache.whirr.ClusterSpec) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) Test(org.junit.Test)

Example 19 with ClusterSpec

use of org.apache.whirr.ClusterSpec in project whirr by apache.

the class ElasticSearchConfigurationBuilderTest method testDefaultUnicastConfig.

@Test
public void testDefaultUnicastConfig() throws Exception {
    Configuration baseConfig = new PropertiesConfiguration();
    baseConfig.addProperty("whirr.provider", "cloudservers-us");
    ClusterSpec spec = ClusterSpec.withTemporaryKeys(baseConfig);
    Cluster cluster = mock(Cluster.class);
    Set<Cluster.Instance> instances = Sets.newLinkedHashSet();
    for (String host : Lists.newArrayList("10.0.0.1", "10.0.0.2")) {
        Cluster.Instance instance = mock(Cluster.Instance.class);
        when(instance.getPrivateIp()).thenReturn(host);
        instances.add(instance);
    }
    when(cluster.getInstancesMatching((Predicate<Cluster.Instance>) any())).thenReturn(instances);
    Configuration config = ElasticSearchConfigurationBuilder.buildConfig(spec, cluster);
    String content = StringUtils.join(ElasticSearchConfigurationBuilder.asYamlLines(config.subset(ElasticSearchConfigurationBuilder.ES_PREFIX)), "\n");
    assertThat(content, is("index:\n" + "  store:\n" + "    type: memory\n" + "gateway:\n" + "  type: none\n" + "discovery:\n" + "  zen:\n" + "    ping:\n" + "      multicast:\n" + "        enabled: false\n" + "      unicast:\n" + "        hosts: [\"10.0.0.1:9300\", \"10.0.0.2:9300\"]"));
}
Also used : Configuration(org.apache.commons.configuration.Configuration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) Cluster(org.apache.whirr.Cluster) ClusterSpec(org.apache.whirr.ClusterSpec) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) Test(org.junit.Test)

Example 20 with ClusterSpec

use of org.apache.whirr.ClusterSpec in project whirr by apache.

the class HamaClusterActionHandler method beforeBootstrap.

protected void beforeBootstrap(ClusterActionEvent event) throws IOException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Configuration conf = getConfiguration(clusterSpec);
    addStatement(event, call("retry_helpers"));
    addStatement(event, call("configure_hostnames"));
    addStatement(event, call("install_tarball"));
    addStatement(event, call(getInstallFunction(conf, "java", "install_openjdk")));
    String hamaInstallFunction = conf.getString(HamaConstants.KEY_INSTALL_FUNCTION, HamaConstants.FUNCTION_INSTALL);
    String tarurl = prepareRemoteFileUrl(event, conf.getString(HamaConstants.KEY_TARBALL_URL));
    addStatement(event, call(hamaInstallFunction, HamaConstants.PARAM_TARBALL_URL, tarurl));
}
Also used : Configuration(org.apache.commons.configuration.Configuration) ClusterSpec(org.apache.whirr.ClusterSpec)

Aggregations

ClusterSpec (org.apache.whirr.ClusterSpec)98 Configuration (org.apache.commons.configuration.Configuration)39 Cluster (org.apache.whirr.Cluster)35 Test (org.junit.Test)34 PropertiesConfiguration (org.apache.commons.configuration.PropertiesConfiguration)16 Instance (org.apache.whirr.Cluster.Instance)14 ClusterController (org.apache.whirr.ClusterController)10 InetAddress (java.net.InetAddress)9 DryRun (org.apache.whirr.service.DryRunModule.DryRun)9 OptionSet (joptsimple.OptionSet)8 CompositeConfiguration (org.apache.commons.configuration.CompositeConfiguration)8 ZooKeeperCluster (org.apache.whirr.service.zookeeper.ZooKeeperCluster)8 IOException (java.io.IOException)7 ComputeService (org.jclouds.compute.ComputeService)7 File (java.io.File)6 ClusterControllerFactory (org.apache.whirr.ClusterControllerFactory)6 ComputeServiceContext (org.jclouds.compute.ComputeServiceContext)6 Set (java.util.Set)5 Stack (java.util.Stack)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5