MAPREDUCE-3190. Ensure bin/yarn fails early with a clear error message when HADOOP_COMMON_HOME or HADOOP_HDFS_HOME are not set. Contributed by todd & acmurthy.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1184975 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Arun Murthy 2011-10-17 02:14:10 +00:00
parent 94b3bf9f75
commit 4872615441
2 changed files with 21 additions and 10 deletions

View File

@ -1632,6 +1632,10 @@ Release 0.23.0 - Unreleased
MAPREDUCE-2840. mr279 TestUberAM.testSleepJob test fails. (jonathan eagles
via mahadev)
MAPREDUCE-3190. Ensure bin/yarn fails early with a clear error message
when HADOOP_COMMON_HOME or HADOOP_HDFS_HOME are not set. (todd & acmurthy
via acmurthy)
Release 0.22.0 - Unreleased
INCOMPATIBLE CHANGES

View File

@ -24,12 +24,6 @@
#
# YARN_CLASSPATH Extra Java CLASSPATH entries.
#
# YARN_USER_CLASSPATH_FIRST When defined, the YARN_CLASSPATH is
# added in the beginning of the global
# classpath. Can be defined, for example,
# by doing
# export YARN_USER_CLASSPATH_FIRST=true
#
# YARN_HEAPSIZE The maximum amount of heap to use, in MB.
# Default is 1000.
#
@ -107,10 +101,14 @@ if [ "$YARN_HEAPSIZE" != "" ]; then
fi
# CLASSPATH initially contains $HADOOP_CONF_DIR & $YARN_CONF_DIR
CLASSPATH="${HADOOP_CONF_DIR}:${YARN_CONF_DIR}"
if [ "$YARN_USER_CLASSPATH_FIRST" != "" ] && [ "$YARN_CLASSPATH" != "" ] ; then
CLASSPATH=${CLASSPATH}:${YARN_CLASSPATH}
if [ ! -d "$HADOOP_CONF_DIR" ]; then
echo No HADOOP_CONF_DIR set.
echo Please specify it either in yarn-env.sh or in the environment.
exit 1
fi
CLASSPATH="${HADOOP_CONF_DIR}:${YARN_CONF_DIR}"
CLASSPATH=${CLASSPATH}:${YARN_CLASSPATH}
CLASSPATH=${CLASSPATH}:$JAVA_HOME/lib/tools.jar
# for developers, add Hadoop classes to CLASSPATH
@ -147,12 +145,21 @@ fi
IFS=
# add hadoop-common libs to CLASSPATH
if [ ! -d "$HADOOP_COMMON_HOME" ]; then
echo No HADOOP_COMMON_HOME set.
echo Please specify it either in yarn-env.sh or in the environment.
exit 1
fi
CLASSPATH=${CLASSPATH}:$HADOOP_COMMON_HOME/share/hadoop/common'/*'
CLASSPATH=${CLASSPATH}:$HADOOP_COMMON_HOME/share/hadoop/common/lib'/*'
# add hadoop-hdfs libs to CLASSPATH
if [ ! -d "$HADOOP_HDFS_HOME" ]; then
echo No HADOOP_HDFS_HOME set.
echo Please specify it either in yarn-env.sh or in the environment.
exit 1
fi
CLASSPATH=${CLASSPATH}:$HADOOP_HDFS_HOME/share/hadoop/hdfs'/*'
CLASSPATH=${CLASSPATH}:$HADOOP_HDFS_HOME/share/hadoop/hdfs/lib'/*'