场景:
项目组6个节点中,某一节点硬盘寿命到了,由于当时硬盘做的raid0,没有备份,更换新硬盘后,启动datanode遇到如下问题:
1. 更换硬盘前,停止datanode,停止在此节点上应用;
2. 停止机器,更换硬盘
3. 重启机器,重启datanode,遇到问题
3.1
WARN org.apache.hadoop.hdfs.: Invalid /data :
-
WARN : Invalid .data.dir /data :
-
EPERM: Operation not permitted
-
at $(Native Method)
-
at $(:230)
-
at (:729)
-
at $1.apply(:505)
-
at $FsOperation.run(:486)
-
at (:502)
-
at (:140)
-
at (:156)
-
at $(:2345)
-
at (:2387)
-
at (:2369)
-
at (:2261)
-
at (:2308)
-
at (:2485)
-
at (:2509)
-
2019-03-05 21:01:10,707 FATAL : Exception in secureMain
-
: All directories in .data.dir are invalid: "/data/"
-
at (:2396)
-
at (:2369)
-
at (:2261)
-
at (:2308)
-
at (:2485)
-
at (:2509)
-
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'
-
2019-03-05 21:25:47,891 FATAL : Exception in secureMain
-
: failed to stat a path component: '/var/run/hdfs-sockets'. error code 2 (No such file or directory)
-
at 0(Native Method)
-
at (:189)
-
at .<init>(:40)
-
at (:946)
-
at (:912)
-
at (:1111)
-
at .<init>(:429)
-
at (:2374)
-
at (:2261)
-
at (:2308)
-
at (:2485)
-
at (:2509)
-
2019-03-05 21:25:47,893 INFO : Exiting with status 1
-
2019-03-05 21:25:47,894 INFO : SHUTDOWN_MSG:
原因:
没有/var/run/hdfs-sockets 这个路径
解决办法:
创建这个目录即可