如何hdfs shell脚本句柄--config选项

时间:2016-06-29 05:28:56

标签: bash shell hadoop

当我运行${HADOOP_HDFS_HOME}/bin/hdfs --config ${HADOOP_CONF_DIR} dfs -ls /时,hdfs shell脚本如何处理--config选项?

虽然COMMAND为"COMMAND" = "--config"

,但脚本不会与COMMAND=$1进行比较

hdfs shell script is here

COMMAND=$1

1 个答案:

答案 0 :(得分:0)

选项--confighadoop-config.sh脚本处理,由hdfs-config.sh脚本调用,该脚本由hdfs依次调用:

#check to see if the conf dir is given as an optional argument
if [ $# -gt 1 ]
then
    if [ "--config" = "$1" ]
          then
              shift
              confdir=$1
              if [ ! -d "$confdir" ]; then
                echo "Error: Cannot find configuration directory: $confdir"
                exit 1
             fi
              shift
              HADOOP_CONF_DIR=$confdir
    fi
fi

你只需要深入了解脚本链。