[转]关于安装hadoop中出现的的 $HADOOP_HOME is deprecated 的解决方法
当前用户的.bash_profile在/home/用户/下,系统的.bash_profile在/etc/skel目录下; 默认可能是隐藏的;有人会问了,隐藏的我怎么打开它,一个简单的办法,直接使用vi命令打开指定目录下的该文件就可以了;比如:vi /root/.bash_profile
说白了修改方法只有两步(针对root用户的命令):
1.修改配置文件:vi /root/.bash_profile 添加 export HADOOP_HOME_WARN_SUPPRESS=1
2.重新加载配置文件:source /root/.bash_profile
下面详细介绍原因及方案;资料来自:http://chenzhou123520.iteye.com/blog/1826002
启动Hadoop时报了一个警告信息,我安装的Hadoop版本是hadoop1.0.4,具体警告信息如下:
Shell代码
- [root@localhost hadoop- 1.0 . 4 ]# ./bin/start-all.sh
- Warning: $HADOOP_HOME is deprecated.
网上的说法是因为Hadoop本身对HADOOP_HOME做了判断,具体在bin/hadoop和bin/hadoop-config.sh里。在hadoop-config.sh里有如下的配置:
Shell代码
- if [ "$HADOOP_HOME_WARN_SUPPRESS" = "" ] && [ "$HADOOP_HOME" != "" ]; then
- echo "Warning: \$HADOOP_HOME is deprecated." 1 >& 2
- echo 1 >& 2
- fi
对于这个警告问题,解决方法如下:
1.注释掉hadoop-config.sh里的上面给出的这段if fi配置(不推荐)
2.在当前用户home/.bash_profile里增加一个环境变量:
export HADOOP_HOME_WARN_SUPPRESS=1
注:修改完.bash_profile后需要执行source操作使其生效
Shell代码
- [root@localhost ~]# source .bash_profile
执行完后我们可以检验一下配置是否成功,重新执行start-all.sh脚本:
Shell代码
- [root@localhost hadoop- 1.0 . 4 ]# ./bin/start-all.sh
- starting namenode, logging to /root/hadoop- 1.0 . 4 /libexec/../logs/hadoop-root-namenode-localhost.out
- localhost: starting datanode, logging to /root/hadoop- 1.0 . 4/libexec/../logs/hadoop-root-datanode-localhost.out
- localhost: starting secondarynamenode, logging to /root/hadoop- 1.0 . 4/libexec/../logs/hadoop-root-secondarynamenode-localhost.out
- starting jobtracker, logging to /root/hadoop- 1.0 . 4 /libexec/../logs/hadoop-root-jobtracker-localhost.out
- localhost: starting tasktracker, logging to /root/hadoop- 1.0 . 4/libexec/../logs/hadoop-root-tasktracker-localhost.out
没有出现Warning: $HADOOP_HOME is deprecated,说明问题已经解决。