From 37025ec47915a9857be74c5de26b4ec7d1a18547 Mon Sep 17 00:00:00 2001 From: Konstantin Shvachko Date: Sun, 23 Jan 2011 22:08:34 +0000 Subject: [PATCH] HADOOP-6056. Use java.net.preferIPv4Stack to force IPv4. Contributed by Michele Catasta. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1062543 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ bin/hadoop-config.sh | 12 ++++++++++++ conf/hadoop-env.sh.template | 3 +++ 3 files changed, 18 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index ea48f338f1..22bdb94c2b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -263,6 +263,9 @@ Release 0.22.0 - Unreleased HADOOP-7104. Remove unnecessary DNS reverse lookups from RPC layer (Kan Zhang via todd) + HADOOP-6056. Use java.net.preferIPv4Stack to force IPv4. + (Michele Catasta via shv) + OPTIMIZATIONS HADOOP-6884. Add LOG.isDebugEnabled() guard for each LOG.debug(..). diff --git a/bin/hadoop-config.sh b/bin/hadoop-config.sh index 025dbc0a29..f9acdd87db 100644 --- a/bin/hadoop-config.sh +++ b/bin/hadoop-config.sh @@ -69,6 +69,15 @@ if [ -f "${HADOOP_CONF_DIR}/hadoop-env.sh" ]; then . "${HADOOP_CONF_DIR}/hadoop-env.sh" fi +# check if net.ipv6.bindv6only is set to 1 +bindv6only=$(/sbin/sysctl -n net.ipv6.bindv6only 2> /dev/null) +if [ -n "$bindv6only" ] && [ "$bindv6only" -eq "1" ] && [ "$HADOOP_ALLOW_IPV6" != "yes" ] +then + echo "Error: \"net.ipv6.bindv6only\" is set to 1 - Java networking could be broken" + echo "For more info: http://wiki.apache.org/hadoop/HadoopIPv6" + exit 1 +fi + # some Java parameters if [ "$JAVA_HOME" != "" ]; then #echo "run java in $JAVA_HOME" @@ -211,6 +220,9 @@ if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then fi HADOOP_OPTS="$HADOOP_OPTS -Dhadoop.policy.file=$HADOOP_POLICYFILE" +# Disable ipv6 as it can cause issues +HADOOP_OPTS="$HADOOP_OPTS -Djava.net.preferIPv4Stack=true" + # put hdfs in classpath if present if [ "$HADOOP_HDFS_HOME" = "" ]; then if [ -d "${HADOOP_HOME}/hdfs" ]; then diff --git a/conf/hadoop-env.sh.template b/conf/hadoop-env.sh.template index ce7ccc8909..fb8bc97ca1 100644 --- a/conf/hadoop-env.sh.template +++ b/conf/hadoop-env.sh.template @@ -52,3 +52,6 @@ export HADOOP_JOBTRACKER_OPTS="-Dcom.sun.management.jmxremote $HADOOP_JOBTRACKER # The scheduling priority for daemon processes. See 'man nice'. # export HADOOP_NICENESS=10 + +# Allow Hadoop to run with sysctl net.ipv6.bindv6only = 1 +# export HADOOP_ALLOW_IPV6=yes