使用Hadoop时遇到的问题
1.Hase错误
1. ServerNotRunningYetException。
问题描述:
Hbase启动一会就自动关闭了。
解决方法
关闭Hadoop的安全模式。
hadoop dfsadmin -safemode leave
1.2 类找不到的错误
问题描述
Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: Class mastercom.cn.bigdata.util.hadoop.mapred.CombineSmallFileInputFormat not found
at org.apache.hadoop.mapreduce.lib.input.MultipleInputs.getInputFormatMap(MultipleInputs.java:112)
at org.apache.hadoop.mapreduce.lib.input.DelegatingInputFormat.getSplits(DelegatingInputFormat.java:58)
解决方法:
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-JgxCNXDH-1596588927912)(hadoop学习.assets/image-20200622192423199.png)]
2. hadoop相关问题
2.1 Could not resolve hostname: Name or service not known
问题描述
原因:这是因为没有把配置文件里的节点名称加入域名映射,所以无法识别主机名。
解决方法:
vim /etc/hosts
127.0.0.1 你的节点名称
2.2 permission denied
问题描述
可能是在创建hadoop相关的文件夹的时候忘记授予hadoop用户权限了
解决方法
chown -R hadoop.hadoop 文件夹名
2.3 本地模式运行mapreduce,Eclipse报错
问题描述
ERROR [main] util.Shell (Shell.java:getWinUtilsPath(373)) - Failed to locate the winutils binary in the hadoop binary path java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
解决方法
javamain方法中代码设置: System.setProperty("hadoop.home.dir", "hadoop的路径名");
2.4 运行job任务时报out of memory
问题描述
错误,然后怎么调整内存大小都不行,后来发现是can’t create new thread。
解决方法
在vi /etc/security/limits.conf 添加
ocnosql - nofile 65535
ocnosql- nproc 65535
3. Kafka相关错误
3.1 UnknownTopicOrPartitionException
问题描述
org.apache.kafka.common.errors.UnknownTopicOrPartitionException:
This server does not host this topic-partition
错误原因producer向不存在的topic发送消息
解决方法
用户可以检查topic是否存在 或者设置auto.create.topics.enable参数
3.2 LEADER_NOT_AVAILABLE
WARN Error while fetching metadata with correlation id 0 : {test=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient
错误原因:leader失效了
解决方法:原因很多 topic正在被删除 正在进行leader选举 使用kafka-topics脚本检查leader信息进而检查broker的存活情况 尝试重启解决
3.3Closing socket connection
问题描述
Closing socket connection to/127,0,0,1.(kafka.network.Processor)
错误原因:如果javaApi producer版本高,想在客户端consumer启动低版本验证,会不停的报错无法识别客户端消息
解决方法
暂时没有解决,我是更换了版本之后可以了。