Skip to content

Commit

Permalink
WHIRR-176. Set AWS credentials in the local site file for Hadoop S3 a…
Browse files Browse the repository at this point in the history
…ccess. Contributed by Lars George.

git-svn-id: https://svn.apache.org/repos/asf/incubator/whirr/trunk@1054520 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
tomwhite committed Jan 3, 2011
1 parent 82bc75f commit 1d40793
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.txt
Expand Up @@ -6,6 +6,9 @@ Trunk (unreleased changes)

WHIRR-117. Composable services. (tomwhite)

WHIRR-176. Set AWS credentials in the local site file for Hadoop S3 access.
(Lars George via tomwhite)

IMPROVEMENTS

WHIRR-87. Parallelize Hadoop cluster creation. (tomwhite)
Expand Down
Expand Up @@ -123,19 +123,26 @@ protected void afterConfigure(ClusterActionEvent event) throws IOException {

LOG.info("Web UI available at http://{}",
DnsUtil.resolveAddress(namenodePublicAddress.getHostAddress()));
Properties config = createClientSideProperties(namenodePublicAddress, jobtrackerPublicAddress);
Properties config = createClientSideProperties(clusterSpec, namenodePublicAddress, jobtrackerPublicAddress);
createClientSideHadoopSiteFile(clusterSpec, config);
createProxyScript(clusterSpec, cluster);
event.setCluster(new Cluster(cluster.getInstances(), config));
}

private Properties createClientSideProperties(InetAddress namenode, InetAddress jobtracker) throws IOException {

private Properties createClientSideProperties(ClusterSpec clusterSpec,
InetAddress namenode, InetAddress jobtracker) throws IOException {
Properties config = new Properties();
config.setProperty("hadoop.job.ugi", "root,root");
config.setProperty("fs.default.name", String.format("hdfs://%s:8020/", DnsUtil.resolveAddress(namenode.getHostAddress())));
config.setProperty("mapred.job.tracker", String.format("%s:8021", DnsUtil.resolveAddress(jobtracker.getHostAddress())));
config.setProperty("hadoop.socks.server", "localhost:6666");
config.setProperty("hadoop.rpc.socket.factory.class.default", "org.apache.hadoop.net.SocksSocketFactory");
if ("ec2".equals(clusterSpec.getProvider())) {
config.setProperty("fs.s3.awsAccessKeyId", clusterSpec.getIdentity());
config.setProperty("fs.s3.awsSecretAccessKey", clusterSpec.getCredential());
config.setProperty("fs.s3n.awsAccessKeyId", clusterSpec.getIdentity());
config.setProperty("fs.s3n.awsSecretAccessKey", clusterSpec.getCredential());
}
return config;
}

Expand Down

0 comments on commit 1d40793

Please sign in to comment.