Hadoop 出现SafeModeException

最近Hadoop启动后出现错误,在jobtracker的log中错误如下:

2012-03-24 13:50:55,615 INFO org.apache.hadoop.mapred.JobTracker: problem cleaning system directory: hdfs://192.168.1.100:9000/home/yaoxianglong/hadoop-1.0.1/mapred/system

org.apache.hadoop.ipc.RemoteException: org.apache.hadoop.hdfs.server.namenode.SafeModeException: Cannot delete /home/yaoxianglong/hadoop-1.0.1/mapred/system. Name node is in safe mode.

The ratio of reported blocks 0.0000 has not reached the threshold 0.9990. Safe mode will be turned off automatically.

解决办法:

safemode模式

NameNode在启动的时候首先进入安全模式,如果datanode丢失的block达到一定的比例(1-dfs.safemode.threshold.pct),则系统会一直处于安全模式状态即只读状态。

dfs.safemode.threshold.pct(缺省值0.999f)表示HDFS启动的时候,如果DataNode上报的block个数达到了元数据记录的block个数的0.999倍才可以离开安全模式,否则一直是这种只读模式。如果设为1则HDFS永远是处于SafeMode。

下面这行摘录自NameNode启动时的日志(block上报比例1达到了阀值0.9990)

The ratio of reported blocks 1.0000 has reached the threshold 0.9990. Safe mode will be turned off automatically in 18 seconds.

hadoop dfsadmin -safemode leave

有两个方法离开这种安全模式

1. 修改dfs.safemode.threshold.pct为一个比较小的值,缺省是0.999。

2. hadoop dfsadmin -safemode leave命令强制离开

在hdfs-site.xml中把

dfs.safemode.threshold.pct设置为0即可关闭safemode

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/d36be33ed5175b24b2d905628695f9a2.html