格式化HDFS出问题

来源:3-11 HDFS格式化以及启动详解

weixin_慕神5384537

2021-02-17

我是在阿里云上配置的,云上的配置只看了13-6.7.8
之后就从前面开始一点点往后做了
使用的包都是前面的课程提到的
hadoop-2.6.0-cdh5.15.1.tar.gz
jdk-8u91-linux-x64.tar.gz

图片描述

执行 hdfs namenode -format 时,提示

21/02/17 21:16:50 INFO namenode.FSImage: Allocated new BlockPoolId: BP-332358726-172.17.239.134-1613567810743
21/02/17 21:16:50 WARN namenode.NameNode: Encountered exception during format:
java.io.IOException: Cannot create directory /home/hadoop/app/tmp/dfs/name/current
at org.apache.hadoop.hdfs.server.common.StorageStorageDirectory.clearDirectory(Storage.java:358)atorg.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:573)atorg.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:594)atorg.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:174)atorg.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1047)atorg.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1488)atorg.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1615)21/02/1721:16:50ERRORnamenode.NameNode:Failedtostartnamenode.java.io.IOException:Cannotcreatedirectory/home/hadoop/app/tmp/dfs/name/currentatorg.apache.hadoop.hdfs.server.common.StorageStorageDirectory.clearDirectory(Storage.java:358) at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:573) at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:594) at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:174) at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1047) at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1488) at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1615) 21/02/17 21:16:50 ERROR namenode.NameNode: Failed to start namenode. java.io.IOException: Cannot create directory /home/hadoop/app/tmp/dfs/name/current at org.apache.hadoop.hdfs.server.common.StorageStorageDirectory.clearDirectory(Storage.java:358)atorg.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:573)atorg.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:594)atorg.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:174)atorg.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1047)atorg.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1488)atorg.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1615)21/02/1721:16:50ERRORnamenode.NameNode:Failedtostartnamenode.java.io.IOException:Cannotcreatedirectory/home/hadoop/app/tmp/dfs/name/currentatorg.apache.hadoop.hdfs.server.common.StorageStorageDirectory.clearDirectory(Storage.java:358)
at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:573)
at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:594)
at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:174)
at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1047)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1488)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1615)
21/02/17 21:16:50 INFO util.ExitUtil: Exiting with status 1
21/02/17 21:16:50 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at hadoop000/172.17.239.134
************************************************************/

暂时不知道错误在哪

图片描述

第二次编辑

对比了一下 3-11HDFS格式化 和后面的阿里云配置 13-10 HDFS部署,找到了不同的地方
图片描述

图片描述

尝试在 vi hdfs-site.xml
中修改成下图
图片描述

依然报错

21/02/17 22:35:41 WARN namenode.NameNode: Encountered exception during format:
java.io.IOException: Cannot create directory /home/hadoop/app/tmp/dfs/name/current
at org.apache.hadoop.hdfs.server.common.StorageStorageDirectory.clearDirectory(Storage.java:358)atorg.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:573)atorg.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:594)atorg.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:174)atorg.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1047)atorg.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1488)atorg.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1615)21/02/1722:35:41ERRORnamenode.NameNode:Failedtostartnamenode.java.io.IOException:Cannotcreatedirectory/home/hadoop/app/tmp/dfs/name/currentatorg.apache.hadoop.hdfs.server.common.StorageStorageDirectory.clearDirectory(Storage.java:358) at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:573) at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:594) at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:174) at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1047) at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1488) at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1615) 21/02/17 22:35:41 ERROR namenode.NameNode: Failed to start namenode. java.io.IOException: Cannot create directory /home/hadoop/app/tmp/dfs/name/current at org.apache.hadoop.hdfs.server.common.StorageStorageDirectory.clearDirectory(Storage.java:358)atorg.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:573)atorg.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:594)atorg.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:174)atorg.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1047)atorg.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1488)atorg.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1615)21/02/1722:35:41ERRORnamenode.NameNode:Failedtostartnamenode.java.io.IOException:Cannotcreatedirectory/home/hadoop/app/tmp/dfs/name/currentatorg.apache.hadoop.hdfs.server.common.StorageStorageDirectory.clearDirectory(Storage.java:358)
at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:573)
at org.apache.hadoop.hdfs.server.namenode.NNStorage.format(NNStorage.java:594)
at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:174)
at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1047)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1488)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1615)
21/02/17 22:35:41 INFO util.ExitUtil: Exiting with status 1
21/02/17 22:35:41 INFO namenode.NameNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at hadoop000/172.17.239.134
************************************************************/

写回答

2回答

Michael_PK

2021-02-17

还有个问题,2c4g的太小了,很大可能是带不动Hadoop的

0
1
weixin_慕神5384537
这样嘛。但是老师你的视频里面推荐购买的云服务器好像就是2c4g的,我跟着买的。如果不够要多大阿
2021-03-30
共1条回复

Michael_PK

2021-02-17

ERROR namenode.NameNode: Failed to start namenode. java.io.IOException: Cannot create directory /home/hadoop/app/tmp/dfs/name/current

这个报错了,你的操作用户是否有这个创建权限

0
6
weixin_慕神5384537
回复
Michael_PK
我知道为什么一直错了。我是用的XFtp创建的/home/hadoop/app/tmp,所以tmp目录的所有者和用户组都是默认的Root,hadoop用户动不了这些文件,更改所有者和用户组以后可以格式化了。然后第一次启动集群再次报错,提示无法创建目录,这个问题也是因为我用Xftp可视化的去赋予hadoop权限,所以我那一行hadoop ALL=(ALL) ALL有问题。用Xshell vi/etc/sudoers 然后复制 root的那一行 root ALL=(ALL) ALL,然后把root改成hadoop,最后ESC+wq感叹号 强制保存,启动集群就成功了,JPS可以看到三个节点信息
2021-04-28
共6条回复

Hadoop 系统入门+核心精讲

从Hadoop核心技术入手,掌握数据处理中ETL应用,轻松进军大数据

2397 学习 · 902 问题

查看课程