1. 程式人生 > >hadoop常見問題處理

hadoop常見問題處理

Q: 
hadoop fs -ls /
log: FATAL org.apache.hadoop.hdfs.server.datanode.DataNode: Initialization failed for Block pool <registering> (Datanode Uuid unassigned) service to localhost/127.0.0.1:9000. Exiting. java.io.IOException: All specified directories are failed to load.

A:
原因:在使用格式化namenode(command: hadoop namenode -format),會導致datanode和namenode的clusterID不一致.
解決:
(1)根據日誌中的路徑
vi /appl/hadoop-2.7.0/tmp/dfs/name/current/VERSION
clusterID=CID-37b1b589-5d3b-4148-bd03-64d2163278d8
vi /appl/hadoop-2.7.0/tmp/dfs/data/current/VERSION
將name/current下的VERSION中的clusterID複製到data/current下的VERSION中,目的是讓兩個保持一致。然後重啟。

(2)啟動hadoop
sh start-dfs.sh
sh start-yarn.sh
log:/appl/hadoop-2.7.0/logs

(3)測試
hadoop fs -mkdir hdfs://localhost:9000/test/
fs -mkdir test01
hadoop fs -ls /
drwxr-xr-x   - root supergroup          0 2016-03-22 17:34 /test
drwxr-xr-x   - root supergroup          0 2016-03-22 17:36 /test01