use of org.apache.whirr.Cluster.Instance in project whirr by apache.
the class VoldemortServiceTest method testInstances.
@Test(timeout = TestConstants.ITEST_TIMEOUT)
public void testInstances() throws Exception {
Set<Instance> instances = cluster.getInstances();
String url = "tcp://" + instances.iterator().next().getPublicAddress().getHostAddress() + ":" + ADMIN_PORT;
AdminClient client = new AdminClient(url, new AdminClientConfig());
voldemort.cluster.Cluster c = client.getAdminClientCluster();
List<String> voldemortBasedHosts = new ArrayList<String>();
for (Node node : c.getNodes()) voldemortBasedHosts.add(node.getHost());
List<String> whirrBasedHosts = new ArrayList<String>();
for (Instance instance : instances) whirrBasedHosts.add(instance.getPrivateAddress().getHostAddress());
Collections.sort(voldemortBasedHosts);
Collections.sort(whirrBasedHosts);
Assert.assertEquals(whirrBasedHosts, voldemortBasedHosts);
}
use of org.apache.whirr.Cluster.Instance in project whirr by apache.
the class VoldemortServiceTest method waitForBootstrap.
private void waitForBootstrap() {
for (Instance instance : cluster.getInstances()) {
while (true) {
try {
String url = "tcp://" + instance.getPublicAddress().getHostAddress() + ":" + ADMIN_PORT;
AdminClient client = new AdminClient(url, new AdminClientConfig());
client.getAdminClientCluster();
break;
} catch (Exception e) {
System.out.print(".");
try {
Thread.sleep(1000);
} catch (InterruptedException e1) {
break;
}
}
}
}
}
use of org.apache.whirr.Cluster.Instance 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"));
}
use of org.apache.whirr.Cluster.Instance 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));
}
use of org.apache.whirr.Cluster.Instance 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));
}
Aggregations