use of org.apache.whirr.ClusterSpec in project whirr by apache.
the class BasicServerClusterActionHandler method beforeConfigure.
@Override
protected void beforeConfigure(ClusterActionEvent event) throws IOException, InterruptedException {
ClusterSpec clusterSpec = event.getClusterSpec();
Cluster cluster = event.getCluster();
int port = defaultPort;
if (configKeyPort != null) {
port = getConfiguration(clusterSpec).getInt(configKeyPort, defaultPort);
}
Cluster.Instance instance = cluster.getInstanceMatching(role(role));
InetAddress masterPublicAddress = instance.getPublicAddress();
event.getFirewallManager().addRule(Rule.create().destination(instance).port(port));
handleFirewallRules(event);
String master = masterPublicAddress.getHostName();
String quorum = ZooKeeperCluster.getHosts(cluster);
String tarurl = prepareRemoteFileUrl(event, getConfiguration(clusterSpec).getString(HBaseConstants.KEY_TARBALL_URL));
addStatement(event, call("retry_helpers"));
addStatement(event, call(getConfigureFunction(getConfiguration(clusterSpec)), role, HBaseConstants.PARAM_MASTER, master, HBaseConstants.PARAM_QUORUM, quorum, HBaseConstants.PARAM_PORT, Integer.toString(port), HBaseConstants.PARAM_TARBALL_URL, tarurl));
}
use of org.apache.whirr.ClusterSpec in project whirr by apache.
the class HBaseMasterClusterActionHandler method afterConfigure.
@Override
protected void afterConfigure(ClusterActionEvent event) throws IOException {
ClusterSpec clusterSpec = event.getClusterSpec();
Cluster cluster = event.getCluster();
// TODO: wait for regionservers to come up?
LOG.info("Completed configuration of {}", clusterSpec.getClusterName());
Instance instance = cluster.getInstanceMatching(role(ROLE));
InetAddress masterPublicAddress = instance.getPublicAddress();
LOG.info("Web UI available at http://{}", masterPublicAddress.getHostName());
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 HBaseMasterClusterActionHandler method beforeConfigure.
@Override
protected void beforeConfigure(ClusterActionEvent event) throws IOException, InterruptedException {
ClusterSpec clusterSpec = event.getClusterSpec();
Cluster cluster = event.getCluster();
Configuration conf = getConfiguration(clusterSpec);
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, MASTER_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 SolrClusterActionHandler method afterStart.
@Override
protected void afterStart(ClusterActionEvent event) throws IOException {
ClusterSpec clusterSpec = event.getClusterSpec();
Cluster cluster = event.getCluster();
Configuration config = getConfiguration(clusterSpec, SOLR_DEFAULT_CONFIG);
int jettyPort = config.getInt(SOLR_JETTY_PORT);
LOG.info("Completed configuration of {}", clusterSpec.getClusterName());
LOG.info("Solr Hosts: {}", getHosts(cluster.getInstancesMatching(role(SOLR_ROLE)), jettyPort));
}
use of org.apache.whirr.ClusterSpec in project whirr by apache.
the class SolrClusterActionHandler method beforeConfigure.
@Override
protected void beforeConfigure(ClusterActionEvent event) throws IOException {
LOG.info("Configure Solr");
ClusterSpec clusterSpec = event.getClusterSpec();
Configuration config = getConfiguration(clusterSpec, SOLR_DEFAULT_CONFIG);
int jettyPort = config.getInt(SOLR_JETTY_PORT);
// Open up Jetty port
event.getFirewallManager().addRule(Rule.create().destination(role(SOLR_ROLE)).port(jettyPort));
handleFirewallRules(event);
}
Aggregations