--->运行脚本start-all.sh
--->bin=`dirname "${BASH_SOURCE-$0}"`
--->bin=`cd "$bin"; pwd`
--->DEFAULT_LIBEXEC_DIR="$bin"/../libexec
--->HADOOP_LIBEXEC_DIR=${HADOOP_LIBEXEC_DIR:-$DEFAULT_LIBEXEC_DIR}
--->运行脚本$HADOOP_LIBEXEC_DIR/hadoop-config.sh
--->this="${BASH_SOURCE-$0}"
--->common_bin=$(cd -P -- "$(dirname -- "$this")" && pwd -P)
--->script="$(basename -- "$this")"
--->this="$common_bin/$script"
--->HADOOP_COMMON_DIR=${HADOOP_COMMON_DIR:-"share/hadoop/common"}
--->HADOOP_COMMON_LIB_JARS_DIR=${HADOOP_COMMON_LIB_JARS_DIR:-"share/hadoop/common/lib"}
--->HADOOP_COMMON_LIB_NATIVE_DIR=${HADOOP_COMMON_LIB_NATIVE_DIR:-"lib/native"}
--->HDFS_DIR=${HDFS_DIR:-"share/hadoop/hdfs"}
--->HDFS_LIB_JARS_DIR=${HDFS_LIB_JARS_DIR:-"share/hadoop/hdfs/lib"}
--->YARN_DIR=${YARN_DIR:-"share/hadoop/yarn"}
--->YARN_LIB_JARS_DIR=${YARN_LIB_JARS_DIR:-"share/hadoop/yarn/lib"}
--->MAPRED_DIR=${MAPRED_DIR:-"share/hadoop/mapreduce"}
--->MAPRED_LIB_JARS_DIR=${MAPRED_LIB_JARS_DIR:-"share/hadoop/mapreduce/lib"}
--->HADOOP_DEFAULT_PREFIX=$(cd -P -- "$common_bin"/.. && pwd -P)
--->HADOOP_PREFIX=${HADOOP_PREFIX:-$HADOOP_DEFAULT_PREFIX}
--->判断是否带参数,如果有且是--config则赋值给HADOOP_CONF_DIR
--->判断是否带参数,如果有且是--loglevel则赋值给HADOOP_LOGLEVEL
--->判断${HADOOP_PREFIX}/conf/hadoop-env.sh是否存在,且设置DEFAULT_CONF_DIR
--->export HADOOP_CONF_DIR="${HADOOP_CONF_DIR:-$HADOOP_PREFIX/$DEFAULT_CONF_DIR}"
--->判断是否带参数,如果有且是--hosts则赋值给HADOOP_SLAVES
--->判断是否带参数,如果有且是--hostnames则赋值给HADOOP_SLAVE_NAMES
--->运行脚本${HADOOP_CONF_DIR}/hadoop-env.sh
--->export JAVA_HOME=${JAVA_HOME}
--->export HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-"/etc/hadoop"}
--->export HADOOP_OPTS="$HADOOP_OPTS -Djava.net.preferIPv4Stack=true"
--->export HADOOP_NAMENODE_OPTS="-Dhadoop.security.logger=${HADOOP_SECURITY_LOGGER:-INFO,RFAS} -Dhdfs.audit.logger=${HDFS_AUDIT_LOGGER:-INFO,NullAppender} $HADOOP_NAMENODE_OPTS"
--->export HADOOP_DATANODE_OPTS="-Dhadoop.security.logger=ERROR,RFAS $HADOOP_DATANODE_OPTS"
--->export HADOOP_SECONDARYNAMENODE_OPTS="-Dhadoop.security.logger=${HADOOP_SECURITY_LOGGER:-INFO,RFAS} -Dhdfs.audit.logger=${HDFS_AUDIT_LOGGER:-INFO,NullAppender} $HADOOP_SECONDARYNAMENODE_OPTS"
--->export HADOOP_NFS3_OPTS="$HADOOP_NFS3_OPTS"
--->export HADOOP_PORTMAP_OPTS="-Xmx512m $HADOOP_PORTMAP_OPTS"
--->export HADOOP_CLIENT_OPTS="-Xmx512m $HADOOP_CLIENT_OPTS"
--->export HADOOP_SECURE_DN_USER=${HADOOP_SECURE_DN_USER}
--->export HADOOP_SECURE_DN_LOG_DIR=${HADOOP_LOG_DIR}/${HADOOP_HDFS_USER}
--->export HADOOP_PID_DIR=${HADOOP_PID_DIR}
--->export HADOOP_SECURE_DN_PID_DIR=${HADOOP_PID_DIR}
--->export HADOOP_IDENT_STRING=$USER
--->运行命令/sbin/sysctl -n net.ipv6.bindv6only,hadoop暂不支持ipv6
--->export MALLOC_ARENA_MAX=${MALLOC_ARENA_MAX:-4}
--->判断是否设置$JAVA_HOME,如果没有则设置默认
--->设置JAVA=$JAVA_HOME/bin/java
--->判断是否设置$HADOOP_HEAPSIZE,如果没有则设置默认JAVA_HEAP_MAX=-Xmx1000m
--->初始化并赋值CLASSPATH="${HADOOP_CONF_DIR}"
--->判断是否设置$HADOOP_COMMON_HOME,如果没有则设置默认HADOOP_COMMON_HOME=$HADOOP_PREFIX
--->赋值CLASSPATH=${CLASSPATH}:$HADOOP_COMMON_HOME/$HADOOP_COMMON_DIR
--->赋值CLASSPATH=${CLASSPATH}:$HADOOP_COMMON_HOME/$HADOOP_COMMON_LIB_JARS_DIR'/*'
--->赋值CLASSPATH=${CLASSPATH}:$HADOOP_COMMON_HOME/$HADOOP_COMMON_DIR'/*'
--->判断是否设置$HADOOP_LOG_DIR,如果没有则设置默认HADOOP_LOG_DIR="$HADOOP_PREFIX/logs"
--->判断是否设置$HADOOP_LOGFILE,如果没有则设置默认HADOOP_LOGFILE='hadoop.log'
--->判断是否设置$HADOOP_POLICYFILE,如果没有则设置默认HADOOP_POLICYFILE="hadoop-policy.xml"
--->JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:${HADOOP_PREFIX}/$HADOOP_COMMON_LIB_NATIVE_DIR
--->TOOL_PATH="${TOOL_PATH:-$HADOOP_PREFIX/share/hadoop/tools/lib/*}"
--->HADOOP_OPTS="$HADOOP_OPTS -Dhadoop.log.dir=$HADOOP_LOG_DIR"
--->HADOOP_OPTS="$HADOOP_OPTS -Dhadoop.log.file=$HADOOP_LOGFILE"
--->判断hadoop是否运行在windows的cygwin环境下,并设置HADOOP_OPTS="$HADOOP_OPTS -Dhadoop.home.dir