2016年2月23日 星期二

[hadoop] hadoop namenode 怎麼離開 safemode Name node is in safe mode.


[hadoop] hadoop namenode 怎麼離開 safemode Name node is in safe mode. 


操作 HDFS 時,可能會遇到 Name node is in safe mode. 這種情況。

如果只是在開發測試環境,可以直接嘗試下面的作法離開 safemode。單機情況下,可以直接離開safemode。
(當 hdfs file 都符合 replica 的條件,才會脫離 safemode 。)

Safemode

During start up the NameNode loads the file system state from the fsimage and the edits log file. It then waits for DataNodes to report their blocks so that it does not prematurely start replicating the blocks though enough replicas already exist in the cluster. During this time NameNode stays in Safemode. Safemode for the NameNode is essentially a read-only mode for the HDFS cluster, where it does not allow any modifications to file system or blocks. Normally the NameNode leaves Safemode automatically after the DataNodes have reported that most file system blocks are available. If required, HDFS could be placed in Safemode explicitly using bin/hdfs dfsadmin -safemode command. NameNode front page shows whether Safemode is on or off. A more detailed description and configuration is maintained as JavaDoc for setSafeMode().



[root@vagrant-centos65 conf]#  sudo -u hdfs hadoop fs -mkdir -p /test
mkdir: Cannot create directory /test. Name node is in safe mode.

[root@vagrant-centos65 conf]# sudo -u hdfs hdfs dfsadmin -safemode leave

Safe mode is OFF

沒有留言:

張貼留言