0
点赞
收藏
分享

微信扫一扫

Hadoop常见异常处理

何以至千里 2022-02-17 阅读 57


Datanode无法启动

java.io.IOException: Incompatible clusterIDs in /home/hadoop/tmp/dfs/data:
namenode clusterID = CID-19f887ba-2e8d-4c7e-ae01-e38a30581693;
datanode clusterID = CID-14aac0b3-3c32-45db-adb8-b5fc494eaa3d

从日志上说明了问题

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

mapreduce.task.io.sort.mb无效

java.io.IOException: Invalid "mapreduce.task.io.sort.mb": 4096

解决:

这个参数的值设置的过大了,不能超过2047,注意单位是mb

Permission denied

Permission denied: user=liguodong, access=WRITE, inode=”/liguodong”:hdfs:hdfs:rwxr-xr-x

解决方法:

方式一

<property>
<name>dfs.permissions</name>
<value>false</value>
</property>

方式二

​su hdfs​

​bash-4.1$ hdfs dfs -chmod -R 777 /liguodong​

Could not locate executable null\bin\winutils.exe

hadoop源码

public static final String getQualifiedBinPath(String executable) 
throws IOException {
// construct hadoop bin path to the specified executable
String fullExeName = HADOOP_HOME_DIR + File.separator + "bin"
+ File.separator + executable;

File exeFile = new File(fullExeName);
if (!exeFile.exists()) {
throw new IOException("Could not locate executable " + fullExeName
+ " in the Hadoop binaries.");
}

return exeFile.getCanonicalPath();
}

private static String HADOOP_HOME_DIR = checkHadoopHome();
private static String checkHadoopHome() {

// first check the Dflag hadoop.home.dir with JVM scope
String home = System.getProperty("hadoop.home.dir");

// fall back to the system/user-global env variable
if (home == null) {
home = System.getenv("HADOOP_HOME");
}
...
}

如果HADOOP_HOME为空,必然fullExeName为null\bin\winutils.exe。

解决方法很简单。

1、下载winutils.exe(​​​http://public-repo-1.hortonworks.com/hdp-win-alpha/winutils.exe​​​)

2、配置环境变量(HADOOP_HOME=E:\install\hadoop-2.6.0),不想重启电脑可以在程序里加上:

System.setProperty("hadoop.home.dir", "E:\install\hadoop-2.6.0");



举报

相关推荐

0 条评论