CentOS6.9安裝hadoop中出現(xiàn)的問題

Tips:
非手動編譯的情況下,一定要注意各個軟件包的版本對應(yīng)關(guān)系。
如果學習的話還是推薦手動編譯。

這是我在編譯搭建過程中出現(xiàn)的一些問題。記錄一下:

1.在搭建hadoop環(huán)境時,需要安裝protobuf-3.3.0的包時,然而在源碼編譯的過程中出現(xiàn)錯誤如下:

   ./google/protobuf/metadata.h:175: error: class 
   ‘google::protobuf::internal::InternalMetadataWithArena’ 
   does not have any field named ‘InternalMetadataWithArenaBase’

只知道是編譯過程中出現(xiàn)缺失什么的問題,卻在網(wǎng)上一直找不到原因。

于是去該軟件包的github上找,在該軟件包的issue中找到了一個#2599找到了相關(guān)的解決方案,

安裝上邊所說,需要修改源碼中的一個文件。在protobuf/src/google/protobuf/metadata_lite.h文件中修改。如下:

vim metadata_lite.h
replace:
   explicit InternalMetadataWithArenaLite(Arena* arena)
   : InternalMetadataWithArenaBase(arena) {}

with:
   explicit InternalMetadataWithArenaLite(Arena* arena)
   : InternalMetadataWithArenaBase<string,
   InternalMetadataWithArenaLite>(arena) {}

然后重新執(zhí)行編譯過程,就可以通過了。

#./configure
#make
#make check  
#make install

然而在最后安裝hadoop的時候,卻提示需要protobuf-2.5.0的包,我無語了,但是重新安裝這個包時,卻沒有遇到問題,不明白。。。。。

2.在build hadoop中的時候,使用命令:

mvn package -Pdist,native,docs -DskipTests -Dtar。

出現(xiàn)錯誤:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-
javadoc-plugin:2.8.1:jar (module-javadocs) on project hadoop-annotations: 
MavenReportException: Error while creating archive:
[ERROR] Exit code: 1 - /tmp/hadoop-2.5.0-src/hadoop-common-
project/hadoop-annotations/src/main/java/org/apache/hadoop/classification/InterfaceStability.java:27: error: unexpected end tag: </ul>
[ERROR] * </ul>

看這個錯誤是在包的doc文件中出現(xiàn)的的,根據(jù)stack Overflow上的提示,在編譯的時候忽略掉doc文件。使用如下命令:

mvn package -Pdist,native,docs -DskipTests -Dtar -Dmaven.javadoc.skip=true  

就可以正確安裝了。

在build hadoop時,注意與其依賴包的對應(yīng)關(guān)系。
比如,在我編譯hadoop2.5.0的時候,需要依賴的包有protobuf-2.5.0,如果使用其他版本,就會出現(xiàn)錯誤。

3.配置好hadoop-2.5.0后,執(zhí)行啟動 ./start-all.sh,報錯:

[hadoop@hadoop1]$ ./start-all.sh
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
Error: Cannot find configuration directory: /etc/hadoop
starting yarn daemons
Error: Cannot find configuration directory: /etc/hadoop

[hadoop@hadoop1]$ ./start-all.sh

 This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh

 Error: Cannot find configuration directory: /etc/hadoop

 starting yarn daemons

 Error: Cannot find configuration directory: /etc/hadoop

這是因為使用了hadoop-env.sh默認的關(guān)于hadoop配置文件所在目錄的配置,這里需要根據(jù)你自己的安裝路徑重新設(shè)置。修改hadoop-env.sh:

 export HADOOP_CONF_DIR=/app/hadoop/hadoop-2.5.0/etc/hadoop/

最后別忘了:

 source  hadoop-env.sh
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容