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
This commit is contained in:
Konstantin Shvachko 2011-01-23 22:08:34 +00:00
parent 99e6ed0fdd
commit 37025ec479
3 changed files with 18 additions and 0 deletions

View File

@ -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(..).

View File

@ -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

View File

@ -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