记住,你的记忆效率=线索数量*线索质量
问题场景:只配置了一个NameNode作为主节点,当它宕掉后如何恢复数据呢?
kill -9 NameNode进程
删除NameNode存储的数据(/opt/module/hadoop-2.7.2/data/tmp/dfs/name)
rm -rf /opt/module/hadoop-2.7.2/data/tmp/dfs/name/*
在hadoop102上执行,拷贝hadoop104的数据到这里 scp -r 用户名@hadoop104:/opt/module/hadoop-2.7.2/data/tmp/dfs/namesecondary/* ./name/
hadoop-daemon.sh start namenode
<property> <name>dfs.namenode.checkpoint.period</name> <value>120</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>/opt/module/hadoop-2.7.2/data/tmp/dfs/name</value> </property>
rm -rf /opt/module/hadoop-2.7.2/data/tmp/dfs/name/*
scp -r 用户名@hadoop104:/opt/module/hadoop-2.7.2/data/tmp/dfs/namesecondary ./ [zhutiansama@hadoop102 namesecondary]$ rm -rf in_use.lock
hdfs namenode -importCheckpoint
6.启动NameNode
hadoop-daemon.sh start namenode