You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whirr.apache.org by as...@apache.org on 2012/05/13 21:09:51 UTC
svn commit: r1337968 - in /whirr/branches/branch-0.7: ./
core/src/main/java/org/apache/whirr/ core/src/main/java/org/apache/whirr/net/
services/hadoop/src/main/java/org/apache/whirr/service/hadoop/
Author: asavu
Date: Sun May 13 19:09:51 2012
New Revision: 1337968
URL: http://svn.apache.org/viewvc?rev=1337968&view=rev
Log:
WHIRR-459. DNS Failure when trying to spawn HBase cluster (Alex Heneveld via asavu)
Modified:
whirr/branches/branch-0.7/CHANGES.txt
whirr/branches/branch-0.7/core/src/main/java/org/apache/whirr/Cluster.java
whirr/branches/branch-0.7/core/src/main/java/org/apache/whirr/net/FastDnsResolver.java
whirr/branches/branch-0.7/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopConfigurationBuilder.java
Modified: whirr/branches/branch-0.7/CHANGES.txt
URL: http://svn.apache.org/viewvc/whirr/branches/branch-0.7/CHANGES.txt?rev=1337968&r1=1337967&r2=1337968&view=diff
==============================================================================
--- whirr/branches/branch-0.7/CHANGES.txt (original)
+++ whirr/branches/branch-0.7/CHANGES.txt Sun May 13 19:09:51 2012
@@ -46,6 +46,8 @@ Release 0.7.2
WHIRR-590. ssh port timeout fails the whole cluster (Doug Daniels via asavu)
+ WHIRR-459. DNS Failure when trying to spawn HBase cluster (Alex Heneveld via asavu)
+
Release 0.7.1 - 2012-02-23
IMPROVEMENTS
Modified: whirr/branches/branch-0.7/core/src/main/java/org/apache/whirr/Cluster.java
URL: http://svn.apache.org/viewvc/whirr/branches/branch-0.7/core/src/main/java/org/apache/whirr/Cluster.java?rev=1337968&r1=1337967&r2=1337968&view=diff
==============================================================================
--- whirr/branches/branch-0.7/core/src/main/java/org/apache/whirr/Cluster.java (original)
+++ whirr/branches/branch-0.7/core/src/main/java/org/apache/whirr/Cluster.java Sun May 13 19:09:51 2012
@@ -28,6 +28,8 @@ import org.apache.whirr.net.DnsResolver;
import org.apache.whirr.net.FastDnsResolver;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.domain.Credentials;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.InetAddress;
@@ -43,6 +45,8 @@ import static com.google.common.base.Pre
*/
public class Cluster {
+ private static final Logger LOG = LoggerFactory.getLogger(Cluster.class);
+
/**
* This class represents a real node running in a cluster. An instance has
* one or more roles.
@@ -80,6 +84,9 @@ public class Cluster {
this.id = checkNotNull(id, "id");
this.nodeMetadata = nodeMetadata;
this.dnsResolver = dnsResolver;
+
+ LOG.debug("constructed instance {} with IP public {}, private {}, and DNS resolver {}",
+ new Object[] { this, publicIp, privateIp, dnsResolver });
}
public Credentials getLoginCredentials() {
@@ -109,7 +116,13 @@ public class Cluster {
public synchronized String getPublicHostName() throws IOException {
if (publicHostName == null) {
+ LOG.debug("resolving public hostname of {} (public {}, private {})", new Object[] { this, publicIp, privateIp });
publicHostName = dnsResolver.apply(publicIp);
+ LOG.debug("resolved public hostname of {} as {}", this, publicHostName);
+ if (publicHostName.matches("[0-9\\.]+") && nodeMetadata.getHostname()!=null && !nodeMetadata.getHostname().isEmpty()) {
+ LOG.debug("overriding public hostname of {} from {} (unresolved) to {}", new Object[] { this, publicHostName, nodeMetadata.getHostname() });
+ publicHostName = nodeMetadata.getHostname();
+ }
}
return publicHostName;
}
@@ -120,7 +133,9 @@ public class Cluster {
public synchronized String getPrivateHostName() throws IOException {
if (privateHostName == null) {
+ LOG.debug("resolving private hostname of {} (public {}, private {})", new Object[] { this, publicIp, privateIp });
privateHostName = dnsResolver.apply(privateIp);
+ LOG.debug("resolved private hostname of {} as {}", this, privateHostName);
}
return privateHostName;
}
Modified: whirr/branches/branch-0.7/core/src/main/java/org/apache/whirr/net/FastDnsResolver.java
URL: http://svn.apache.org/viewvc/whirr/branches/branch-0.7/core/src/main/java/org/apache/whirr/net/FastDnsResolver.java?rev=1337968&r1=1337967&r2=1337968&view=diff
==============================================================================
--- whirr/branches/branch-0.7/core/src/main/java/org/apache/whirr/net/FastDnsResolver.java (original)
+++ whirr/branches/branch-0.7/core/src/main/java/org/apache/whirr/net/FastDnsResolver.java Sun May 13 19:09:51 2012
@@ -22,6 +22,8 @@ import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketTimeoutException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.xbill.DNS.DClass;
import org.xbill.DNS.ExtendedResolver;
import org.xbill.DNS.Message;
@@ -39,6 +41,9 @@ import static org.xbill.DNS.Message.newQ
*/
public class FastDnsResolver implements DnsResolver {
+ private static final Logger LOG = LoggerFactory
+ .getLogger(FastDnsResolver.class);
+
private int timeoutInSeconds;
public FastDnsResolver() {
@@ -51,7 +56,7 @@ public class FastDnsResolver implements
/**
* Resolve the reverse dns name for the given IP address
- *
+ *
* @param hostIp
* host IP address
* @return
@@ -70,8 +75,8 @@ public class FastDnsResolver implements
Record[] answers = response.getSectionArray(Section.ANSWER);
if (answers.length == 0) {
+ LOG.warn("no answer to DNS resolution attempt for "+hostIp+"; using fallback");
return fallback(hostIp);
-
} else {
String reverseAddress = answers[0].rdataToString();
return reverseAddress.endsWith(".") ? reverseAddress.substring(0, reverseAddress.length() - 1) : reverseAddress;
@@ -80,7 +85,9 @@ public class FastDnsResolver implements
return hostIp; /* same response as standard Java on timeout */
} catch(IOException e) {
- throw new DnsException(e);
+ // suggests eg firewall block DNS lookup or similar
+ LOG.warn("error in DNS resolution attempt for "+hostIp+" ("+e+"); using fallback");
+ return fallback(hostIp);
}
}
Modified: whirr/branches/branch-0.7/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/whirr/branches/branch-0.7/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopConfigurationBuilder.java?rev=1337968&r1=1337967&r2=1337968&view=diff
==============================================================================
--- whirr/branches/branch-0.7/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopConfigurationBuilder.java (original)
+++ whirr/branches/branch-0.7/services/hadoop/src/main/java/org/apache/whirr/service/hadoop/HadoopConfigurationBuilder.java Sun May 13 19:09:51 2012
@@ -36,9 +36,13 @@ import org.apache.whirr.ClusterSpec;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Processor;
import org.jclouds.scriptbuilder.domain.Statement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class HadoopConfigurationBuilder {
-
+
+ private static final Logger LOG = LoggerFactory.getLogger(HadoopConfigurationBuilder.class);
+
private static final String WHIRR_HADOOP_DEFAULT_PROPERTIES =
"whirr-hadoop-default.properties";
@@ -88,6 +92,7 @@ public class HadoopConfigurationBuilder
Instance namenode = cluster
.getInstanceMatching(role(HadoopNameNodeClusterActionHandler.ROLE));
+ LOG.debug("hadoop building common configuration, with hostname "+namenode.getPublicHostName());
config.setProperty("fs.default.name", String.format("hdfs://%s:8020/",
namenode.getPublicHostName()));
return config;