執行hdfs namenode -bootstrapStandby的時候報錯以下java
java.io.IOException: java.lang.IllegalStateException: Could not determine own NN ID in namespace 'mycluster'. Please ensure that this node is one of the machines listed as an NN RPC address, or configure dfs.ha.namenode.id at org.apache.hadoop.hdfs.server.namenode.ha.BootstrapStandby.run(BootstrapStandby.java:428) at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1482) at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1582) Caused by: java.lang.IllegalStateException: Could not determine own NN ID in namespace 'mycluster'. Please ensure that this node is one of the machines listed as an NN RPC address, or configure dfs.ha.namenode.id at com.google.common.base.Preconditions.checkState(Preconditions.java:172) at org.apache.hadoop.hdfs.HAUtil.getNameNodeIdOfOtherNode(HAUtil.java:164) at org.apache.hadoop.hdfs.HAUtil.getConfForOtherNode(HAUtil.java:187) at org.apache.hadoop.hdfs.server.namenode.ha.BootstrapStandby.parseConfAndFindOtherNN(BootstrapStandby.java:391) at org.apache.hadoop.hdfs.server.namenode.ha.BootstrapStandby.run(BootstrapStandby.java:104) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84) at org.apache.hadoop.hdfs.server.namenode.ha.BootstrapStandby.run(BootstrapStandby.java:423) ... 2 more
錯誤信息裏面說找不到NN id,這裏個人nn是克隆出來的,因此查看hosts文件,是由於沒有添加該節點的IP映射
[xiaoqiu@s150 /etc]$ xcall.sh "cat /etc/hosts" ====s150 ===== 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.109.150 s150 192.168.109.151 s151 192.168.109.152 s152 192.168.109.153 s153 ====s151 ===== 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.109.150 s150 192.168.109.151 s151 192.168.109.152 s152 192.168.109.153 s153 ====s152 ===== 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.109.150 s150 192.168.109.151 s151 192.168.109.152 s152 192.168.109.153 s153 ====s153 ===== 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.109.150 s150 192.168.109.151 s151 192.168.109.152 s152 192.168.109.153 s153
應該使得每臺主機的hosts文件都具備其餘節點的IP映射node