hadoop启动时,如果没有配置ssh免秘钥登录的话,会提示要求输入password:
[xxx@*** /home/q/www/hadoop-2.6.4]$ sudo -u tomcat sbin/start-all.sh
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
16/12/27 16:41:36 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting namenodes on [localhost]
tomcat@localhost's password:
tomcat@localhost's password: localhost: Permission denied, please try again.
此时,需要配置本机的免秘钥登录
cd ~/.ssh
ssh-keygen -t rsa
cat id_rsa.pub >> authorized_keys
然后再次执行:sudo -u tomcat sbin/start-all.sh (公司要求项目尽可能以tomcat用户启动),仍然报相同的错误。因为配的秘钥是当前用户的,所以对tomcat用户无法生效。所以用默认账户启动:
sbin/start-all.sh
此时可能会报如下错误:
16/12/27 17:42:07 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting namenodes on [localhost]
localhost: Error: JAVA_HOME is not set and could not be found.
localhost: Error: JAVA_HOME is not set and could not be found.
Starting secondary namenodes [0.0.0.0]
0.0.0.0: Error: JAVA_HOME is not set and could not be found.
16/12/27 17:42:10 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
需要修改hadoop-env.sh,将JAVA_HOME改为绝对路径:
export JAVA_HOME=/usr/local/jdk1.7.0_79
再次启动,问题就解决了。