Hadoop正确地将HADOOP_HOME设置为bin / hadoop它会找不到命令

时间:2015-06-08 03:47:27

标签: hadoop

安装hadoop并将HADOOP_HOME设置为/ usr / local / hadoop / bin / hadoop后,只需在终端输入hadoop运行hadoop,就说我没有权限。然后我尝试用sudo运行它,然后它说,sudo:command not found

2 个答案:

答案 0 :(得分:2)

  1. HADOOP_HOME应指向/usr/local/hadoop

  2. 如果要在终端中键入hadoop,则必须将其添加到全局路径变量中。为此,请在/home/hadoopuser/.bashrc

    中添加这些行

    export HADOOP_HOME=/usr/local/hadoop

    export PATH=$PATH:$HADOOP_HOME/bin

  3.   

    注意:hadoopuser 是您的hadoop用户名。将其替换为您的用户名。

答案 1 :(得分:0)

如果使用的是Mac OS,请在〜/ .bash_profile中添加以下行;

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
export HADOOP_HOME=/Users/karanverma/Documents/backups/h/hadoop-2.6.4
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
export HADOOP_PREFIX=/Users/karanverma/Documents/backups/h/hadoop-2.6.4
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME

export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib"
export HADOOP_CLASSPATH=${JAVA_HOME}/lib/tools.jar

export JAVA_LIBRARY_PATH=$HADOOP_HOME/lib/native:$JAVA_LIBRARY_PATH

export PATH=/usr/local/mysql/bin:/Users/bng/Documents/mongodb/bin:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH