2014-09-23 160 views
0

我已經安裝了hadoop,我已經設置了JAVA_HOME,但仍然出現這個錯誤,爲什麼?Hadoop:安裝問題

/opt/hadoop/2.5.1/sbin: $JAVA_HOME 
-bash: /opt/java/6.0: Is a directory 
/opt/hadoop/2.5.1/sbin: ./start-dfs.sh 
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. 
/opt/hadoop/2.5.1/sbin: 

如果我嘗試:

sh start-dfs.sh 
start-dfs.sh: 82: /opt/hadoop/2.5.1/sbin/../libexec/hadoop-config.sh: Syntax error: word unexpected (expecting ")") 
+0

你在'$ HADOOP_HOME/conf目錄/ Hadoop的設置JAVA_HOME -env.sh'呢? – vefthym 2014-09-23 13:08:56

+1

將導出$ JAVA_HOME添加到.profile或.bash_profile的末尾,使用源.bash_profile執行它,然後啓動hadoop – Satya 2014-09-23 13:12:03

+0

您需要在「yarn-env.sh」中爲hadoop 2.x設置JAVA_HOME。可以找到此文件在可以在/ etc/hadoop下看到hadoop-env.sh的相同路徑上 – user3484461 2014-09-23 13:58:03

回答

0

使用bash,而不是SH調用腳本。這解決了我的問題。

0

打開內hadoop-xxx/etc/hadoop文件hadoop.env.sh,並添加以下行

JAVA_HOME = "address of java"