zl程序教程

您现在的位置是:首页 >  其他

当前栏目

解决FATAL ha.BootstrapStandby: Unable to fetch namespace information from active NN at node1/ip.....

2023-04-18 12:59:19 时间

目录

1. 报错详细描述

在搭建 HDFS 高可用集群的过程中,执行 hdfs namenode -bootstrapStandby 进行同步的时候出现报错:

FATAL ha.BootstrapStandby: Unable to fetch namespace information from active NN at node1/192.168.146.111:8020: Call From node2/192.168.146.112 to node1:8020 failed on connection excep
tion: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused

2. 解决步骤(详细剖析)

20/11/21 01:34:16 INFO ipc.Client: Retrying connect to server: node1/192.168.146.111:8020. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MIL
LISECONDS)20/11/21 01:34:17 INFO ipc.Client: Retrying connect to server: node1/192.168.146.111:8020. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MIL
LISECONDS)20/11/21 01:34:18 INFO ipc.Client: Retrying connect to server: node1/192.168.146.111:8020. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MIL
LISECONDS)20/11/21 01:34:19 INFO ipc.Client: Retrying connect to server: node1/192.168.146.111:8020. Already tried 3 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MIL
LISECONDS)20/11/21 01:34:20 INFO ipc.Client: Retrying connect to server: node1/192.168.146.111:8020. Already tried 4 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MIL
LISECONDS)20/11/21 01:34:21 INFO ipc.Client: Retrying connect to server: node1/192.168.146.111:8020. Already tried 5 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MIL
LISECONDS)20/11/21 01:34:22 INFO ipc.Client: Retrying connect to server: node1/192.168.146.111:8020. Already tried 6 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MIL
LISECONDS)20/11/21 01:34:23 INFO ipc.Client: Retrying connect to server: node1/192.168.146.111:8020. Already tried 7 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MIL
LISECONDS)20/11/21 01:34:24 INFO ipc.Client: Retrying connect to server: node1/192.168.146.111:8020. Already tried 8 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MIL
LISECONDS)20/11/21 01:34:25 INFO ipc.Client: Retrying connect to server: node1/192.168.146.111:8020. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MIL
LISECONDS

可以看到尝试了多次,node2 依旧无法感受到 node1 已经启动 NameNode 并处于 active 状态——Unable to fetch namespace information from active NN at node1/192.168.146.111:8020

怎么办呢,网上也没几个可以用的方法 最后发现是自己之前图方便,修改了 /etc/hosts 文件导致的 我之前把 hosts 文件前两行中的 localhost.localdomain 换成了主机名:

127.0.0.1   localhost node2 localhost4 localhost4.localdomain4
::1         localhost node2 localhost6 localhost6.localdomain6

把它换回来 >>

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
# 换完之后,ip映射别忘了再搞一个,不然又多了个问题
ip  主机名

最后把 主NameNode 所在节点(我这里是node1)重启一下,在备NameNode节点(我这里是node2)再次执行 hdfs namenode -bootstrapStandby 即可。

Look~~我的阔以了: