hadoop解除 "Name node is in safe mode"

解決的命令:

 

bin/hadoop dfsadmin -safemode leave #關閉safe mode

 

附 安全模式 學習:

 

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命令強制離開

 

 

-----------------------------

 

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).

 

安全模式的退出前提 - 整個文件系統中的99.9%(默認是99.9%,可以通過dfs.safemode.threshold.pct設置)的Blocks達到最小備份級別(默認是1,可以通過dfs.replication.min設置)。

 

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  來操作安全模式,參數value的說明如下:

 

enter - 進入安全模式

 

leave - 強制NameNode離開安全模式

 

get -  返回安全模式是否開啓的信息

 

wait - 等待,一直到安全模式結束。

發佈了46 篇原創文章 · 獲贊 4 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章