use of org.apache.whirr.Cluster in project whirr by apache.
the class YarnResourceManagerHandler method beforeConfigure.
@Override
protected void beforeConfigure(ClusterActionEvent event) throws IOException, InterruptedException {
ClusterSpec clusterSpec = event.getClusterSpec();
Configuration conf = getConfiguration(clusterSpec);
Cluster cluster = event.getCluster();
Instance resourceManager = cluster.getInstanceMatching(role(ROLE));
event.getFirewallManager().addRules(Rule.create().destination(resourceManager).ports(RESOURCE_MANAGER_RPC_PORT, RESOURCE_MANAGER_WEB_UI_PORT), Rule.create().source(resourceManager.getPublicIp()).destination(resourceManager).ports(RESOURCE_MANAGER_RPC_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), "resourcemanager"));
}
use of org.apache.whirr.Cluster in project whirr by apache.
the class ZooKeeperClusterActionHandler 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(ZOOKEEPER_ROLE)).port(CLIENT_PORT));
handleFirewallRules(event);
// Pass list of all servers in ensemble to configure script.
// Position is significant: i-th server has id i.
Set<Instance> ensemble = cluster.getInstancesMatching(role(ZOOKEEPER_ROLE));
String servers = Joiner.on(' ').join(getPrivateIps(ensemble));
Configuration config = getConfiguration(clusterSpec);
addStatement(event, call("retry_helpers"));
addStatement(event, call(getConfigureFunction(config), servers));
}
use of org.apache.whirr.Cluster in project whirr by apache.
the class VoldemortClusterActionHandler method afterConfigure.
@Override
protected void afterConfigure(ClusterActionEvent event) {
ClusterSpec clusterSpec = event.getClusterSpec();
Cluster cluster = event.getCluster();
String servers = Joiner.on(' ').join(getPrivateIps(cluster.getInstances()));
LOG.info("Completed setup of Voldemort {} with servers {}", clusterSpec.getClusterName(), servers);
}
use of org.apache.whirr.Cluster in project whirr by apache.
the class VoldemortClusterActionHandler method beforeConfigure.
@Override
protected void beforeConfigure(ClusterActionEvent event) throws IOException, InterruptedException {
Cluster cluster = event.getCluster();
LOG.info("Authorizing firewall");
event.getFirewallManager().addRule(Rule.create().destination(cluster.getInstancesMatching(role(ROLE))).ports(CLIENT_PORT, ADMIN_PORT, HTTP_PORT));
handleFirewallRules(event);
String servers = Joiner.on(' ').join(getPrivateIps(cluster.getInstances()));
Configuration config = event.getClusterSpec().getConfiguration();
int partitionsPerNode = config.getInt(PARAM_PARTITIONS_PER_NODE, 10);
addStatement(event, call("retry_helpers"));
addStatement(event, call(FUNCTION_CONFIGURE, PARAM_PARTITIONS_PER_NODE, Integer.toString(partitionsPerNode), servers));
}
use of org.apache.whirr.Cluster 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));
}
Aggregations