在运行一段时间后,突然报出hadoop不识别指令的错误。因为曾正确使用过,观察所在目录已变化,考虑是环境变量JAVA_HOME的问题。
/etc/profile中JAVA_HOME变量已修改。
考虑到hadoop2.2.0官方文档提及其他变量,如下补充。
vim /etc/profile
在/etc/profile文件的末尾加上以下配置
04
05 export HADOOP_DEV_HOME=/home/wyp/Downloads/hadoop/hadoop-2.2.0
06 export PATH=$PATH:$HADOOP_DEV_HOME/bin
07 export PATH=$PATH:$HADOOP_DEV_HOME/sbin
08 export HADOOP_MAPARED_HOME=${HADOOP_DEV_HOME}
09 export HADOOP_COMMON_HOME=${HADOOP_DEV_HOME}
10 export HADOOP_HDFS_HOME=${HADOOP_DEV_HOME}
11 export YARN_HOME=${HADOOP_DEV_HOME}
12 export HADOOP_CONF_DIR=${HADOOP_DEV_HOME}/etc/hadoop
结束后输入hadoop,返回:
Usage: hadoop [--config confdir] COMMAND
where COMMAND is one of:
fs run a generic filesystem user client
version print the version
jar <jar> run a jar file
checknative [-a|-h] check native hadoop and compression libraries availability
distcp <srcurl> <desturl> copy file or directories recursively
archive -archiveName NAME -p <parent path> <src>* <dest> create a hadoop archive
classpath prints the class path needed to get the
Hadoop jar and the required libraries
daemonlog get/set the log level for each daemon
or
CLASSNAME run the class named CLASSNAME
Most commands print help when invoked w/o parameters.
原因:由于对前提准备hdfs安装,hadoop2.2.0未按照官方文档安装配置,出现很多隐藏问题