運行hadoop程序時, 中途我把它終止了,然后再向hdfs加文件或刪除文件時,出現(xiàn)Name node is in safe mode錯誤:
rmr: org.apache.hadoop.dfs.SafeModeException: Cannot delete /user/hadoop/input. Name node is in safe mode
解決的命令:
bin/hadoop dfsadmin -safemode leave #關(guān)閉safe mode
轉(zhuǎn)自: http://shutiao2008.iteye.com/blog/318950
附 安全模式 學(xué)習(xí):
safemode模式
NameNode在啟動的時候首先進入安全模式,如果datanode丟失的block達到一定的比例(1-dfs.safemode.threshold.pct),則系統(tǒng)會一直處于安全模式狀態(tài)即只讀狀態(tài)。
dfs.safemode.threshold.pct(缺省值0.999f)表示HDFS啟動的時候,如果DataNode上報的block個數(shù)達到了元數(shù)據(jù)記錄的block個數(shù)的0.999倍才可以離開安全模式,否則一直是這種只讀模式。如果設(shè)為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命令強制離開
http://bbs.hadoopor.com/viewthread.php?tid=61&extra=page%3D1
-----------------------------
Safe mode is exited when the minimal replication condition is reached, plus an extension
time of 30 seconds. The minimal replication condition is when 99.9% of the blocks in
the whole filesystem meet their minimum replication level (which defaults to one, and
is set by dfs.replication.min).
安全模式的退出前提 - 整個文件系統(tǒng)中的99.9%(默認是99.9%,可以通過dfs.safemode.threshold.pct設(shè)置)的Blocks達到最小備份級別(默認是1,可以通過dfs.replication.min設(shè)置)。
dfs.safemode.threshold.pct float 0.999
The proportion of blocks in the system that must meet the minimum
replication level defined by dfs.rep lication.min before the namenode
will exit safe mode. Setting
this value to 0 or less forces the name-node not to start in safe mode.
Setting this value to more than 1 means the namenode never exits safe
mode.
-----------------------------
用戶可以通過dfsadmin -safemode value 來操作安全模式,參數(shù)value的說明如下:
enter - 進入安全模式
leave - 強制NameNode離開安全模式
get - 返回安全模式是否開啟的信息
wait - 等待,一直到安全模式結(jié)束。
posted on 2013-03-28 16:55
SIMONE 閱讀(730)
評論(0) 編輯 收藏 所屬分類:
hbase