use of org.apache.whirr.Cluster in project whirr by apache.
the class ElasticSearchTest method getHealthInfo.
private String getHealthInfo() throws Exception {
for (int i = 0; i < 20; i++) {
try {
Cluster.Instance instance = Iterables.get(cluster.getInstancesMatching(role(ElasticSearchHandler.ROLE)), 0);
String address = instance.getPublicAddress().getHostAddress();
URL url = new URL(String.format("http://%s:9200/_cluster/health", address));
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuilder builder = new StringBuilder();
String line;
while ((line = in.readLine()) != null) {
builder.append(line);
}
in.close();
return builder.toString();
} catch (IOException e) {
try {
Thread.sleep(5000);
} catch (InterruptedException e1) {
}
}
}
throw new Exception("Unable to get cluster health info.");
}
use of org.apache.whirr.Cluster in project whirr by apache.
the class GangliaMetadClusterActionHandler method beforeConfigure.
@Override
protected void beforeConfigure(ClusterActionEvent event) throws IOException, InterruptedException {
ClusterSpec clusterSpec = event.getClusterSpec();
Cluster cluster = event.getCluster();
// FIXME: the ganglia port is only opened so the ganglia xml dump can be checked in GangliaServiceTest
event.getFirewallManager().addRule(Rule.create().destination(role(GANGLIA_METAD_ROLE)).ports(HTTP_PORT, GANGLIA_META_PORT));
handleFirewallRules(event);
Configuration config = getConfiguration(clusterSpec);
String configureFunction = getConfigureFunction(config);
// Call the configure function.
String metadHost = cluster.getInstanceMatching(role(GANGLIA_METAD_ROLE)).getPrivateIp();
addStatement(event, call("retry_helpers"));
addStatement(event, call(configureFunction, "-m", metadHost));
}
use of org.apache.whirr.Cluster in project whirr by apache.
the class GangliaMonitorClusterActionHandler method beforeConfigure.
@Override
protected void beforeConfigure(ClusterActionEvent event) throws IOException, InterruptedException {
ClusterSpec clusterSpec = event.getClusterSpec();
Cluster cluster = event.getCluster();
event.getFirewallManager().addRule(Rule.create().destination(role(GANGLIA_MONITOR_ROLE)).port(GANGLIA_MONITOR_PORT));
handleFirewallRules(event);
Configuration config = getConfiguration(clusterSpec);
String configureFunction = getConfigureFunction(config);
// Call the configure function.
String metadHost = cluster.getInstanceMatching(role(GANGLIA_METAD_ROLE)).getPrivateIp();
addStatement(event, call("retry_helpers"));
addStatement(event, call(configureFunction, "-m", metadHost));
}
use of org.apache.whirr.Cluster in project whirr by apache.
the class GangliaMonitorClusterActionHandler method afterConfigure.
@Override
protected void afterConfigure(ClusterActionEvent event) {
ClusterSpec clusterSpec = event.getClusterSpec();
Cluster cluster = event.getCluster();
LOG.info("Completed configuration of {}", clusterSpec.getClusterName());
String hosts = Joiner.on(',').join(getHosts(cluster.getInstancesMatching(role(GANGLIA_MONITOR_ROLE))));
LOG.info("Monitors: {}", hosts);
}
use of org.apache.whirr.Cluster in project whirr by apache.
the class HadoopClusterActionHandler method beforeConfigure.
@Override
protected void beforeConfigure(ClusterActionEvent event) throws IOException, InterruptedException {
ClusterSpec clusterSpec = event.getClusterSpec();
Cluster cluster = event.getCluster();
doBeforeConfigure(event);
handleFirewallRules(event);
createHadoopConfigFiles(event, clusterSpec, cluster);
addStatement(event, call("retry_helpers"));
addStatement(event, call(getConfigureFunction(getConfiguration(clusterSpec)), Joiner.on(",").join(event.getInstanceTemplate().getRoles()), "-c", clusterSpec.getProvider()));
}
Aggregations