windows环境下Eclipse开发MapReduce程序遇到的四个问题及解决办法

时间:2021-10-31 07:18:51

按此文章《Hadoop集群(第7期)_Eclipse开发环境设置》进行MapReduce开发环境搭建的过程中遇到一些问题,饶了一些弯路,解决办法记录在此:

文档目的:

记录windows环境下Eclipse开发MapReduce程序遇到的四个问题及解决办法;

问题一:程序运行时报JobTracker is in safe mode

security.UserGroupInformation: PriviledgedActionException as:hadoop cause:org.apache.hadoop.ipc.RemoteException: org.apache.hadoop.mapred.SafeModeException: JobTracker is in safe mode
at org.apache.hadoop.mapred.JobTracker.checkSafeMode(JobTracker.java:)

解决办法:

解除安全模式,如下命令:

bin/hadoop dfsadmin -safemode leave

操作安全模式的参数:

enter 进入安全模式

leave 强制退出安全模式

get 返回是否开启安全模式

wait 等待,一直到安全模式结束

问题二:程序运行时报错Input path does not exist: file

// :: INFO mapred.JobClient: Cleaning up the staging area hdfs://hadoop:9000/usr/local/hadoop/tmp/mapred/staging/hadoop/.staging/job_201406041924_0002
// :: ERROR security.UserGroupInformation: PriviledgedActionException as:hadoop cause:org.apache.hadoop.mapreduce.lib.input.InvalidInputException: Input path does not exist: file:

解决办法:创建input目录

问题三:程序运行时报错unknown host: hadoop

// :: ERROR security.UserGroupInformation: PriviledgedActionException as:hadoop cause:java.net.UnknownHostException: unknown host: hadoop
Exception in thread "main" java.net.UnknownHostException: unknown host: hadoop

解决办法:将C:\Windows\System32\drivers\etc\hosts文件中,增加Hadoop的DNS解析

192.168.80.100        hadoop

问题四:程序运行时报错JobTracker is in safe mode

// :: ERROR security.UserGroupInformation: PriviledgedActionException as:administrator cause:org.apache.hadoop.ipc.RemoteException: org.apache.hadoop.mapred.SafeModeException: JobTracker is in safe mode

解决办法:"右击"桌面上图标"我的电脑",选择"管理",将用户中,找到administrator,改为hadoop,注销或重启电脑。