集群的时间同步:
1、date -s ''
2、ntpdate
配置时间服务器:
选定hadoop01做为时间服务器
1、在hadoop01上安装ntp(ntpdate)
2、设置ntp
vi /etc/ntp.conf
restrict 192.168.137.0 mask 255.255.255.0 nomodify notrap
注释掉4条公网的服务:
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
将本机做为时间服务器
server 127.127.1.0
配置crontab:
*/1 * * * * /usr/sbin/ntpdate hadoop01 >> /dev/null
Name node is in safe mode.The reported blocks 356 needs additional 2 blocks to reach the threshold 0.9990 of total blocks 358. Safe mode will be turned off automatically.
解决办法:
法一、暴力的直接将整个文件系统格式化:hdfs namenode -format
法二、将其控制安全模式的阀值调小:dfs.namenode.safemode.threshold-pct
(将其该值调整整)
法三、使用命令离强制开安全模式然后再检测损坏block并删除:
第一步.
hdfs dfsadmin -safemode leave (强制离开安全模式)
第二步.
hdfs fsck / -delete (删除掉损坏的blocks)
如果想修复,可以使用linux的/sbin/fsck修复工具。