Search in sources :

Example 36 with ClusterSpec

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

the class SolrClusterActionHandler method beforeStop.

@Override
protected void beforeStop(ClusterActionEvent event) throws IOException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Configuration config = getConfiguration(clusterSpec, SOLR_DEFAULT_CONFIG);
    int jettyStopPort = config.getInt(SOLR_JETTY_STOP_PORT);
    String stopFunc = getStopFunction(config, getRole(), "stop_" + getRole());
    LOG.info("Stopping Solr");
    addStatement(event, call(stopFunc, SOLR_HOME, String.valueOf(jettyStopPort), safeSecretString(config.getString(SOLR_JETTY_STOP_SECRET)), SOLR_HOME + "/example/start.jar"));
}
Also used : Configuration(org.apache.commons.configuration.Configuration) ClusterSpec(org.apache.whirr.ClusterSpec)

Example 37 with ClusterSpec

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

the class YarnNodeManagerHandler method beforeConfigure.

@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).ports(NODE_MANAGER_WEB_UI_PORT));
        }
    }
    handleFirewallRules(event);
    try {
        event.getStatementBuilder().addStatements(build("/tmp/yarn-site.xml", clusterSpec, cluster, ROLE));
    } catch (ConfigurationException e) {
        throw new IOException(e);
    }
    addStatement(event, call(getConfigureFunction(conf)));
    addStatement(event, call(getStartFunction(conf), "nodemanager"));
}
Also used : Configuration(org.apache.commons.configuration.Configuration) Instance(org.apache.whirr.Cluster.Instance) ConfigurationException(org.apache.commons.configuration.ConfigurationException) Cluster(org.apache.whirr.Cluster) ClusterSpec(org.apache.whirr.ClusterSpec) IOException(java.io.IOException)

Example 38 with ClusterSpec

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

the class YarnResourceManagerHandler method afterConfigure.

@Override
protected void afterConfigure(ClusterActionEvent event) throws IOException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();
    Instance resourceManager = cluster.getInstanceMatching(role(ROLE));
    LOG.info("Resource manager web UI available at http://{}:{}", resourceManager.getPublicHostName(), RESOURCE_MANAGER_WEB_UI_PORT);
    Properties mrConfig = createClientSideMapReduceProperties(clusterSpec);
    createClientSideMapReduceSiteFile(clusterSpec, mrConfig);
    Properties yarnConfig = createClientSideYarnProperties(clusterSpec, resourceManager);
    createClientSideYarnSiteFile(clusterSpec, yarnConfig);
    Properties combined = new Properties();
    combined.putAll(cluster.getConfiguration());
    combined.putAll(mrConfig);
    combined.putAll(yarnConfig);
    event.setCluster(new Cluster(cluster.getInstances(), combined));
}
Also used : Instance(org.apache.whirr.Cluster.Instance) Cluster(org.apache.whirr.Cluster) ClusterSpec(org.apache.whirr.ClusterSpec) Properties(java.util.Properties)

Example 39 with ClusterSpec

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

the class HBaseMasterClusterActionHandler method beforeBootstrap.

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

Example 40 with ClusterSpec

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

the class BasicServerClusterActionHandler method beforeBootstrap.

@Override
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 tarurl = prepareRemoteFileUrl(event, conf.getString(HBaseConstants.KEY_TARBALL_URL));
    addStatement(event, call(getInstallFunction(conf), HBaseConstants.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