一、环境搭建
- 可能因为是虚拟机的缘故?重启后,SSH免密登陆总是失效,解决办法。
mv /root/.ssh/known_hosts /tmp
- 对hadoop的namenode节点格式化的时候,出现
Format aborted in /usr/local/src/hadoop-1.2.1/tmp/dfs/name
错误,格式化失败!
rm -rf /usr/local/src/hadoop-1.2.1/tmp/dfs/
- 执行./start-all.sh 命令的时候,出现
The authenticity of host 'slave2 (192.168.89.12)' can't be established.
错误,但是主从节点之间可以免密登陆,但是会造成slave节点启动失败。- 将错误排查了遍,真是浪费了好多时间,原来虚拟机一旦重启,SELinux就会变回原来的样子。
#临时关闭,重启失效
setenforce 0
getenforce #查看状态,Permissive为关闭
#永久关闭,推荐
vim /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled
- 上传文件失败./hadoop fs -put /etc/passwd /,抛出异常。
原因:防火墙没有关闭:
centOS 6.5关闭防火墙步骤
关闭命令: service iptables stop
永久关闭防火墙:chkconfig iptables off
两个命令同时运行,运行完成后查看防火墙关闭状态
service iptables status
二、MapReducer
- ①由于Partitioner大于Reducer导致的错误。
为job设置足够的reducer数量:
job.setNumReduceTasks(4);//启用四个Reducer,因为我们分了四个paritioner。
java.io.IOException: Illegal partition for 13726230503 (1)
at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:1078)
at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.java:690)
at org.apache.hadoop.mapreduce.TaskInputOutputContext.write(TaskInputOutputContext.java:80)
at cn.jxau.yuan.mapReduce.DataCount$DCMapper.map(DataCount.java:61)
at cn.jxau.yuan.mapReduce.DataCount$DCMapper.map(DataCount.java:1)
at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:764)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:364)
at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1190)
at org.apache.hadoop.mapred.Child.main(Child.java:249)
17/08/05 02:09:44 INFO mapred.JobClient: Task Id : attempt_201708050137_0001_m_000000_1, Status : FAILED
java.io.IOException: Illegal partition for 13726230503 (1)
at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:1078)
at org.apache.hadoop.mapred.MapTask$NewOutputCollector.write(MapTask.java:690)
at org.apache.hadoop.mapreduce.TaskInputOutputContext.write(TaskInputOutputContext.java:80)
at cn.jxau.yuan.mapReduce.DataCount$DCMapper.map(DataCount.java:61)