Search in sources :

Example 51 with ClusterSpec

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

the class HBaseRegionServerClusterActionHandler 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, 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 52 with ClusterSpec

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

the class HBaseRegionServerClusterActionHandler method beforeConfigure.

@Override
protected void beforeConfigure(ClusterActionEvent event) throws IOException, InterruptedException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();
    Configuration conf = getConfiguration(clusterSpec);
    Instance instance = cluster.getInstanceMatching(role(HBaseMasterClusterActionHandler.ROLE));
    InetAddress masterPublicAddress = instance.getPublicAddress();
    event.getFirewallManager().addRules(Rule.create().destination(instance).ports(REGIONSERVER_WEB_UI_PORT, REGIONSERVER_PORT));
    // Velocity is assuming flat classloaders or TCCL to load templates.
    // This doesn't work in OSGi unless we set the TCCL to the bundle classloader before invocation
    ClassLoader oldTccl = Thread.currentThread().getContextClassLoader();
    handleFirewallRules(event);
    try {
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
        event.getStatementBuilder().addStatements(buildHBaseSite("/tmp/hbase-site.xml", clusterSpec, cluster), buildHBaseEnv("/tmp/hbase-env.sh", clusterSpec, cluster), TemplateUtils.createFileFromTemplate("/tmp/hbase-hadoop-metrics.properties", event.getTemplateEngine(), getMetricsTemplate(event, clusterSpec, cluster), clusterSpec, cluster));
    } catch (ConfigurationException e) {
        throw new IOException(e);
    } finally {
        Thread.currentThread().setContextClassLoader(oldTccl);
    }
    String master = masterPublicAddress.getHostName();
    String quorum = ZooKeeperCluster.getHosts(cluster);
    String tarurl = prepareRemoteFileUrl(event, conf.getString(HBaseConstants.KEY_TARBALL_URL));
    addStatement(event, call("retry_helpers"));
    addStatement(event, call(getConfigureFunction(conf), ROLE, HBaseConstants.PARAM_MASTER, master, HBaseConstants.PARAM_QUORUM, quorum, HBaseConstants.PARAM_TARBALL_URL, tarurl));
}
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) ZooKeeperCluster(org.apache.whirr.service.zookeeper.ZooKeeperCluster) ClusterSpec(org.apache.whirr.ClusterSpec) IOException(java.io.IOException) InetAddress(java.net.InetAddress)

Example 53 with ClusterSpec

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

the class HamaMasterClusterActionHandler method beforeConfigure.

@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));
    handleFirewallRules(event);
    String hamaConfigureFunction = getConfiguration(clusterSpec).getString(HamaConstants.KEY_CONFIGURE_FUNCTION, HamaConstants.FUNCTION_POST_CONFIGURE);
    String master = masterPublicAddress.getHostName();
    String quorum = ZooKeeperCluster.getHosts(cluster);
    String tarurl = prepareRemoteFileUrl(event, getConfiguration(clusterSpec).getString(HamaConstants.KEY_TARBALL_URL));
    addStatement(event, call("retry_helpers"));
    addStatement(event, call(hamaConfigureFunction, ROLE, HamaConstants.PARAM_MASTER, master, HamaConstants.PARAM_QUORUM, quorum, HamaConstants.PARAM_TARBALL_URL, tarurl));
    String hamaStartFunction = getConfiguration(clusterSpec).getString(HamaConstants.KEY_START_FUNCTION, HamaConstants.FUNCTION_START);
    addStatement(event, call(hamaStartFunction, ROLE, HamaConstants.PARAM_TARBALL_URL, tarurl));
}
Also used : Instance(org.apache.whirr.Cluster.Instance) Cluster(org.apache.whirr.Cluster) ZooKeeperCluster(org.apache.whirr.service.zookeeper.ZooKeeperCluster) ClusterSpec(org.apache.whirr.ClusterSpec) InetAddress(java.net.InetAddress)

Example 54 with ClusterSpec

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

the class HamaMasterClusterActionHandler method afterConfigure.

@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));
}
Also used : Instance(org.apache.whirr.Cluster.Instance) Cluster(org.apache.whirr.Cluster) ZooKeeperCluster(org.apache.whirr.service.zookeeper.ZooKeeperCluster) ClusterSpec(org.apache.whirr.ClusterSpec) Properties(java.util.Properties) InetAddress(java.net.InetAddress)

Example 55 with ClusterSpec

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

the class MapReduceJobHistoryServerHandler method beforeConfigure.

@Override
protected void beforeConfigure(ClusterActionEvent event) throws IOException, InterruptedException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Configuration conf = getConfiguration(clusterSpec);
    handleFirewallRules(event);
    addStatement(event, call(getStartFunction(conf, "mr_jobhistory", "start_mr_jobhistory"), "historyserver"));
}
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