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));
}
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));
}
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));
}
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));
}
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"));
}
Aggregations