安全模式期间:nameNode启动成功后到收到99.99%的datanode块数据。
HDFS的Namenode等待DataNode向其发送块报告,当NameNode统计总模块和发送过来的块报告中的统计信息达到99.999%的时候,表示不存在块的丢失,此时安全模式才会退出。
安全模式已开启。报告的块0需要额外的9个块才能达到块总数的0.9990。活动数据块0的数量已达到最小数0。一旦达到阈值(99.9999%),安全模式将自动关闭。
在安全期间的操作
查看文件系统的文件
不可以改变文件系统的命名空间
不可以创建文件夹
不可以上传文件
不可以删除文件
正常的HDFS文件系统Safemode 是关闭的

HDFS的namenode节点启动的时候会开启安全模式
关闭hadoop下的所有服务

namenode启动


Safe mode is ON. The reported blocks 0 needs additional 9 blocks to reach the threshold 0.9990 of total blocks 9. The number of live datanodes 0 has reached the minimum number 0. Safe mode will be turned off automatically once the thresholds have been reached. 搜索网络
安全模式已开启。报告的块0需要额外的9个块才能达到块总数的0.9990。活动数据块0的数量已达到最小数0。一旦达到阈值(99.9999%),安全模式将自动关闭。
再启动datanode(注意:9)

说明:给个短暂的30秒,稳定一些文件系统,再提供给客户使用。
30秒后查看

hdfs管理员可以管理安全模式
命令:[root@hadoop-senior hadoop-2.5.0]# bin/hdfs dfsadmin safemode enter

进入安全模式

查看安全模式
查看命令:bin/hdfs dfsadmin -safemode get
![]()
![]()
说明:
Safe mode is ON. It was turned on manually. Use "hdfs dfsadmin -safemode leave" to turn safe mode off. 36 files and directories, 9 blocks = 45 total filesystem object(s).
安全模式打开。手动打开。使用“hdfs dfsadmin -safemode leave”关闭安全模式。36个文件和目录,9个块=45个文件系统对象。
关闭安全模式
bin/hdfs dfsadmin -safemode leave
image.png
网友评论