问题描述:
在格式化namenode时,显示报错如下
2024-03-07 13:55:30,543 ERROR namenode.FSNamesystem: FSNamesystem initialization failed.
java.io.IOException: Invalid configuration: a shared edits dir must not be specified if HA is not enabled.
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:794)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:735)
at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1180)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1645)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1755)
2024-03-07 13:55:30,549 INFO namenode.FSNamesystem: Stopping services started for active state
2024-03-07 13:55:30,549 INFO namenode.FSNamesystem: Stopping services started for standby state
2024-03-07 13:55:30,549 WARN namenode.NameNode: Encountered exception during format:
java.io.IOException: Invalid configuration: a shared edits dir must not be specified if HA is not enabled.
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:794)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:735)
at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1180)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1645)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1755)
2024-03-07 13:55:30,549 ERROR namenode.NameNode: Failed to start namenode.
java.io.IOException: Invalid configuration: a shared edits dir must not be specified if HA is not enabled.
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:794)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:735)
at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1180)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1645)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1755)
2024-03-07 13:55:30,550 INFO util.ExitUtil: Exiting with status 1: java.io.IOException: Invalid configuration: a shared edits dir must not be specified if HA is not enabled.
问题分析:
根据报错"如果未启用ha,则不得指定共享编辑目录"提示定位到./hdfs-site.xml文件。在hdfs-site.xml文件中配置过两个共享目录,分别是journalnode namenode,查看后发现journalnode.edits多输入一个t
问题解决:
删除多余的t,重新分发hadoop到salve1 slave2节点
再次进行namenode格式化
格式化成功问题解决
总结:
在修改配置文件部分一定要细心,namenode格式化过程中报错大多都是配置文件写错了。根据报错找到对应文件进行修改。
版权归原作者 爆炒海螺 所有, 如有侵权,请联系我们删除。