执行 hadoop dfsadmin -safemode leave 命令时,遇到下面的问题:
[root@Slave1 bin]# hadoop dfsadmin -safemode leave
bash: hadoop: command not found
原因是/etc/profile里面没有进行hadoop的相关配置
对该文件进行修改并使其生效:
[root@Slave1 hadoop]# vim /etc/profile
[root@Slave1 hadoop]# source /etc/profile
增加内容如下:
# set hadoop environment
export HADOOP_HOME=/usr/local/hadoop
export PATH=$PATH:$HADOOP_HOME/bin
再次执行命令时,成功:
[root@Slave1 hadoop]# hadoop dfsadmin -safemode leave
DEPRECATED: Use of this script to execute hdfs command is deprecated.
Instead use the hdfs command for it.
16/01/17 17:12:58 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Safe mode is OFF
[root@Slave1 hadoop]#