我正在尝试构建一个 3 节点集群(2 个 Namenode(nn1,nn2) 和 1 个 datanode(dn1))。使用 Namenode WEBUI,我可以看到 nn1 处于活动状态,而 nn2 处于待机状态。但是,当我杀死活动的 nn1 时,备用 nn2 不会激活。请帮助我我做错了什么或需要修改什么
nn1 /etc/hosts
127.0.0.1 localhost
192.168.10.153 nn1
192.168.10.154 dn1
192.168.10.155 nn2
nn2 /etc/hosts
127.0.0.1 localhost nn2
127.0.1.1 ubuntu
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
核心站点.xml (nn1,nn2)
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://192.168.10.153:8020</value>
</property>
<property>
<name>dfs.journalnode.edits.dir</name>
<value>/usr/local/hadoop/hdfs/data/jn</value>
</property>
<property>
<name>ha.zookeeper.quorum</name>
<value>192.168.10.153:2181,192.168.10.155:2181,192.168.10.154:2181</value>
</property>
</configuration>
hdfs-site.xml(nn1,nn2,dn1)
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
<property>
<name>dfs.nameservices</name>
<value>ha-cluster</value>
</property>
<property>
<name>dfs.ha.namenodes.ha-cluster</name>
<value>nn1,nn2</value>
</property>
<property>
<name>dfs.namenode.rpc-address.ha-cluster.nn1</name>
<value>192.168.10.153:9000</value>
</property>
<property>
<name>dfs.namenode.rpc-address.ha-cluster.nn2</name>
<value>192.168.10.155:9000</value>
</property>
<property>/usr/local/hadoop/hdfs/datanode</value>
<name>dfs.namenode.http-address.ha-cluster.nn1</name>
<value>192.168.10.153:50070</value>
</property>
<property>
<name>dfs.namenode.http-address.ha-cluster.nn2</name>
<value>192.168.10.155:50070</value>
</property>
<property>
<name>dfs.namenode.shared.edits.dir</name>
<value>qjournal://192.168.10.153:8485;192.168.10.155:8485;192.168.10.154:8485/ha-cluster</value>
</property>
<property>
<name>dfs.client.failover.proxy.provider.ha-cluster</name>
<value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
</property>
<property>
<name>dfs.ha.automatic-failover.enabled</name>
<value>true</value>
</property>
<property>
<name>ha.zookeeper.quorum</name>
<value>192.168.10.153:2181,192.168.10.155:2181,192.168.10.154:2181</value>
</property>
<property>
<name>dfs.ha.fencing.methods</name>
<value>sshfence</value>
</property>
<property>
<name>dfs.ha.fencing.ssh.private-key-files</name>
<value>/home/ci/.ssh/id_rsa</value></property></configuration>
日志:(zkfc nn1,nn2)(namenode nn1,nn2)停止nn1(活动节点) https://pastebin.com/bWvfnanQ