Hdfs datanode启动问题

时间:2024-11-16 08:42:10

场景:

项目组6个节点中,某一节点硬盘寿命到了,由于当时硬盘做的raid0,没有备份,更换新硬盘后,启动datanode遇到如下问题:

1. 更换硬盘前,停止datanode,停止在此节点上应用;

2. 停止机器,更换硬盘

3. 重启机器,重启datanode,遇到问题

3.1 

WARN org.apache.hadoop.hdfs.: Invalid /data :

  1. WARN : Invalid .data.dir /data :
  2. EPERM: Operation not permitted
  3. at $(Native Method)
  4. at $(:230)
  5. at (:729)
  6. at $1.apply(:505)
  7. at $FsOperation.run(:486)
  8. at (:502)
  9. at (:140)
  10. at (:156)
  11. at $(:2345)
  12. at (:2387)
  13. at (:2369)
  14. at (:2261)
  15. at (:2308)
  16. at (:2485)
  17. at (:2509)
  18. 2019-03-05 21:01:10,707 FATAL : Exception in secureMain
  19. : All directories in .data.dir are invalid: "/data/"
  20. at (:2396)
  21. at (:2369)
  22. at (:2261)
  23. at (:2308)
  24. at (:2485)
  25. at (:2509)
  26. 2019-03-05 21:01:10,708 INFO : Exiting with status 1

原因:

由于更换硬盘,针对/data目录的权限变成了root,需要对当前用户赋予权限

解决办法:

chown -R hadoop:hadoop /data

 

3.2 

2019-03-05 21:25:47,891 FATAL .server.: Exception in secureMain
: failed to stat a path component: '/var/run/hdfs-sockets'

  1. 2019-03-05 21:25:47,891 FATAL : Exception in secureMain
  2. : failed to stat a path component: '/var/run/hdfs-sockets'. error code 2 (No such file or directory)
  3. at 0(Native Method)
  4. at (:189)
  5. at .<init>(:40)
  6. at (:946)
  7. at (:912)
  8. at (:1111)
  9. at .<init>(:429)
  10. at (:2374)
  11. at (:2261)
  12. at (:2308)
  13. at (:2485)
  14. at (:2509)
  15. 2019-03-05 21:25:47,893 INFO : Exiting with status 1
  16. 2019-03-05 21:25:47,894 INFO : SHUTDOWN_MSG:

原因:

没有/var/run/hdfs-sockets 这个路径

解决办法:

创建这个目录即可