2016-05-04 18:14:51,990 INFO org.apache.hadoop.ipc.Server: IPC Server Responder: starting
2016-05-04 18:14:51,990 INFO org.apache.hadoop.ipc.Server: IPC Server listener on 50020: starting
2016-05-04 18:14:52,219 INFO org.apache.hadoop.hdfs.server.common.Storage: Lock on /home/hadoopuser/hadoop-2.6.0-cdh5.6.0/tmp/dfs/data/in_use.lock acquired by nodename 53036@Hadoop-DN-01
2016-05-04 18:14:52,220 WARN org.apache.hadoop.hdfs.server.common.Storage: java.io.IOException: Incompatible clusterIDs in /home/hadoopuser/hadoop-2.6.0-cdh5.6.0/tmp/dfs/data: namenode clusterID = CID-1dc853da-6e7a-41a3-b7aa-65e66100891a; datanode clusterID = CID-f8a918d0-3b61-4b83-a7b4-796e490ec780
2016-05-04 18:14:52,220 FATAL org.apache.hadoop.hdfs.server.datanode.DataNode: Initialization failed for Block pool <registering> (Datanode Uuid unassigned) service to Hadoop-NN-01/192.168.107.82:9000. Exiting.
从日志上看,加粗的部分说明了问题:
datanode的clusterID 和 namenode的clusterID 不匹配。
解决办法:
根据日志中的路径,cd /home/hadoop/tmp/dfs
能看到 data和name两个文件夹,
将name/current下的VERSION中的clusterID复制到data/current下的VERSION中,覆盖掉原来的clusterID
让两个保持一致
然后重启,启动后执行jps,查看进程
20131 SecondaryNameNode
20449 NodeManager
19776 NameNode
21123 Jps
19918 DataNode
20305 ResourceManager
出现该问题的原因:在第一次格式化dfs后,启动并使用了hadoop,后来又重新执行了格式化命令(hdfs namenode -format),这时namenode的clusterID会重新生成,而datanode的clusterID 保持不变。