HDFS ha 格式化报错:a shared edits dir must not be specified if HA is not enabled.
错误内容:
Formatting using clusterid: CID-19921335-620f-4e72-a056-899702613a6b
2019-01-12 07:28:46,986 INFO namenode.FSEditLog: Edit logging is async:true
2019-01-12 07:28:47,043 INFO namenode.FSNamesystem: KeyProvider: null
2019-01-12 07:28:47,044 INFO namenode.FSNamesystem: fsLock is fair: true
2019-01-12 07:28:47,046 INFO namenode.FSNamesystem: Detailed lock hold time metrics enabled: false
2019-01-12 07:28:47,052 INFO namenode.FSNamesystem: fsOwner = root (auth:SIMPLE)
2019-01-12 07:28:47,052 INFO namenode.FSNamesystem: supergroup = supergroup
2019-01-12 07:28:47,052 INFO namenode.FSNamesystem: isPermissionEnabled = true
2019-01-12 07:28:47,053 INFO namenode.FSNamesystem: Determined nameservice ID: bi
2019-01-12 07:28:47,053 INFO namenode.FSNamesystem: HA Enabled: false
2019-01-12 07:28:47,053 WARN namenode.FSNamesystem: Configured NNs:
Nameservice <bi>:
NN ID nn2 => MyLinux2/192.168.33.202:9000
2019-01-12 07:28:46,986 INFO namenode.FSEditLog: Edit logging is async:true
2019-01-12 07:28:47,043 INFO namenode.FSNamesystem: KeyProvider: null
2019-01-12 07:28:47,044 INFO namenode.FSNamesystem: fsLock is fair: true
2019-01-12 07:28:47,046 INFO namenode.FSNamesystem: Detailed lock hold time metrics enabled: false
2019-01-12 07:28:47,052 INFO namenode.FSNamesystem: fsOwner = root (auth:SIMPLE)
2019-01-12 07:28:47,052 INFO namenode.FSNamesystem: supergroup = supergroup
2019-01-12 07:28:47,052 INFO namenode.FSNamesystem: isPermissionEnabled = true
2019-01-12 07:28:47,053 INFO namenode.FSNamesystem: Determined nameservice ID: bi
2019-01-12 07:28:47,053 INFO namenode.FSNamesystem: HA Enabled: false
2019-01-12 07:28:47,053 WARN namenode.FSNamesystem: Configured NNs:
Nameservice <bi>:
NN ID nn2 => MyLinux2/192.168.33.202:9000
2019-01-12 07:28:47,054 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:778)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:723)
at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1116)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1579)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1689)
2019-01-12 07:28:47,064 INFO namenode.FSNamesystem: Stopping services started for active state
2019-01-12 07:28:47,064 INFO namenode.FSNamesystem: Stopping services started for standby state
2019-01-12 07:28:47,064 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:778)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:723)
at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1116)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1579)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1689)
2019-01-12 07:28:47,071 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.
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:778)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:723)
at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1116)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1579)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1689)
2019-01-12 07:28:47,064 INFO namenode.FSNamesystem: Stopping services started for active state
2019-01-12 07:28:47,064 INFO namenode.FSNamesystem: Stopping services started for standby state
2019-01-12 07:28:47,064 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:778)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:723)
at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1116)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1579)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1689)
2019-01-12 07:28:47,071 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.
解决方法:
<property>
core-site.xml需要有这样类似的nameservices配置
<name>fs.defaultFS</name>
<value>hdfs://mycluster</value>
<description>HDFS的URI,文件系统://namenode标识:端口号</description>
</property>
<property>
<name>dfs.nameservices</name>
<value>mycluster</value>
</property>
<name>fs.defaultFS</name>
<value>hdfs://mycluster</value>
<description>HDFS的URI,文件系统://namenode标识:端口号</description>
</property>
<property>
<name>dfs.nameservices</name>
<value>mycluster</value>
</property>