当前位置: 首页 > 知识库问答 >
问题:

由于Zookeeper UnknownHostException,HBase HMaster无法启动

傅阳
2023-03-14

在CentOS7上运行HBase 2.0.4和Hadoop 2.8.5,其中有1个主节点、4个从节点。我在HBase2.1.3上尝试过同样的设置,也出现了同样的问题。

由于Zookeeper未解析HRegionservers,HMaster无法启动,如此错误日志所示。

2019-03-29 13:58:34,961 INFO  [main] zookeeper.ZooKeeper: Initiating client connection, connectString=node0.ken:2181, node1.ken:2181, node2.ken:2181, node3.ken:2181, node4.ken:21
81 sessionTimeout=90000 watcher=org.apache.hadoop.hbase.zookeeper.PendingWatcher@165e389b
2019-03-29 13:58:34,965 WARN  [main] zookeeper.RecoverableZooKeeper: Unable to create ZooKeeper Connection
java.net.UnknownHostException:  node1.ken: Name or service not known
        at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
        at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929)
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324)
        at java.net.InetAddress.getAllByName0(InetAddress.java:1277)
        at java.net.InetAddress.getAllByName(InetAddress.java:1193)
        at java.net.InetAddress.getAllByName(InetAddress.java:1127)
        at org.apache.zookeeper.client.StaticHostProvider.<init>(StaticHostProvider.java:61)
        at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:445)
        at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:380)
        at org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper.checkZk(RecoverableZooKeeper.java:131)

我的配置文件如下所示:

----hbase-site.xml---

xml prettyprint-override"><configuration>
  <property>
    <name>hbase.rootdir</name>
    <value>hdfs://node0.ken:9000/hbase</value>
  </property>

  <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
  </property>

  <property>
    <name>zookeeper.session.timeout</name>
    <value>1200000</value>
  </property>

  <property>
    <name>hbase.zookeeper.session.timeout</name>
    <value>1200000</value>
  </property>

  <property>
    <name>hbase.zookeeper.property.tickTime</name>
    <value>6000</value>
  </property>

  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>hdfs://node0.ken:9000/zookeeper</value>
  </property>

  <property>
    <name>hbase.zookeeper.quorum</name>
    <value>node0.ken, node1.ken, node2.ken, node3.ken, node4.ken</value>
  </property>

  <property>
    <name>hbase.zookeeper.property.clientPort</name>
    <value>2181</value>
  </property>

  <property>
    <name>zookeeper.znode.parent</name>
    <value>/node0.ken</value>
  </property>
</configuration>

----区域服务器----

node1.ken
node2.ken
node3.ken
node4.ken

----/etc/hosts----

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

10.158.57.150  node0.ken node0 master-node
10.158.57.151  node1.ken node1
10.158.57.152  node2.ken node2
10.158.57.153  node3.ken node3
10.158.57.154  node4.ken node4

所有主机都可以彼此ping,SELinux和firewalld被禁用,我可以从所有其他节点成功telnet node1:2181,并且我已经尝试了这里建议的步骤,但Zookeeper仍然无法解决:https://jayunit100.blogspot.com/2013/05/debugg-hbase-installation.html

我是不是漏掉了什么?Zookeeper还从哪里提取主机分辨率?

更新日期:2019-03-29

问题似乎是HBase使用的Zookeeper客户端(Zookeeper.version=3.4.10),并且可能与此bug有关:https://issues.apache.org/jira/browse/Zookeeper-2982有没有人知道如何将HBase使用的Zookeeper客户端替换为更更新的客户端?

更新:2019-04-01我尝试将hbase/lib/zookeeper-3.4.10.jar替换为hbase/lib/zookeeper-3.4.13.jar,仅从不同的API调用输出相同的错误:

2019-03-29 19:09:46,880 INFO  [main] zookeeper.ZooKeeper: Initiating client connection, connectString=node0.ken:2181, node1.ken:2181, node2.ken:2181, node3.ken:2181, node4.ken:2181 sessionTimeout=1200000 watcher=org.apache.hadoop.hbase.zookeeper.PendingWatcher@336880df
2019-03-29 19:09:46,912 INFO  [main-SendThread( node1.ken:2181)] zookeeper.ClientCnxn: Opening socket connection to server  node1.ken:2181. Will not attempt to authenticate using SASL (unknown error)
2019-03-29 19:09:46,917 WARN  [main-SendThread( node1.ken:2181)] zookeeper.ClientCnxn: Session 0x0 for server  node1.ken:2181, unexpected error, closing socket connection and attempting reconnect
java.nio.channels.UnresolvedAddressException
        at sun.nio.ch.Net.checkAddress(Net.java:101)
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:622)
        at org.apache.zookeeper.ClientCnxnSocketNIO.registerAndConnect(ClientCnxnSocketNIO.java:277)
        at org.apache.zookeeper.ClientCnxnSocketNIO.connect(ClientCnxnSocketNIO.java:287)
        at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1021)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1064)

我尝试编译一个小的Java类来测试这些功能:

import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.Socket;
import sun.nio.ch.Net;
import java.net.UnknownHostException;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

public class GetIPHostname {

    public static void main(String[] args) {

        InetAddress ip;
        String hostname;
        try {
            ip = InetAddress.getLocalHost();
            hostname = ip.getHostName();
            System.out.println("Your current IP address : " + ip);
            System.out.println("Your current Hostname : " + hostname);
            //List<String> hostname_list = Arrays.asList("node0", "node1", "node2", "node3", "node4");
            List<String> hostname_list = Arrays.asList("node0.ken", "node1.ken", "node2.ken", "node3.ken", "node4.ken");

            for (String cur_hostname : hostname_list) {
                String ip_address = InetAddress.getByName(cur_hostname).getHostAddress();

                System.out.println("Hostname resolved: "+cur_hostname+" -> "+ip_address);
                final Socket socket = new Socket();
                SocketAddress address = new InetSocketAddress(cur_hostname, 2181);
                try {
                        InetSocketAddress isa = Net.checkAddress(address);
                        System.out.println("ISA: " +isa.getAddress()+ " -> " +isa.getPort());

                        InetAddress[] iadresses= InetAddress.getAllByName(cur_hostname);
                        for (InetAddress cur_ia : iadresses) {
                            System.out.println("InetAddress: " + cur_ia.getHostAddress());
                        }

                        socket.connect(address);
                        socket.close();
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }// To connect to remote host
            }

        } catch (UnknownHostException e) {

            e.printStackTrace();
        }
    }
}

...并且这两个API都能够使用hosts文件解析地址,甚至连接到端口2181的Zookeeper服务器:

[root@node1 test]# java GetIPHostname
Your current IP address : node1.ken/10.158.57.151
Your current Hostname : node1.ken
Hostname resolved: node0.ken -> 10.158.57.150
ISA: node0.ken/10.158.57.150 -> 2181
InetAddress: 10.158.57.150
Hostname resolved: node1.ken -> 10.158.57.151
ISA: node1.ken/10.158.57.151 -> 2181
InetAddress: 10.158.57.151
Hostname resolved: node2.ken -> 10.158.57.152
ISA: node2.ken/10.158.57.152 -> 2181
InetAddress: 10.158.57.152
Hostname resolved: node3.ken -> 10.158.57.153
ISA: node3.ken/10.158.57.153 -> 2181
InetAddress: 10.158.57.153
Hostname resolved: node4.ken -> 10.158.57.154
ISA: node4.ken/10.158.57.154 -> 2181
InetAddress: 10.158.57.154

共有1个答案

齐向笛
2023-03-14
<property>
    <name>hbase.zookeeper.quorum</name>
    <value>node0.ken, node1.ken, node2.ken, node3.ken, node4.ken</value>
</property>

尝试删除节点0.ken,节点1.ken,...的间距,以

<property>
    <name>hbase.zookeeper.quorum</name>
    <value>node0.ken,node1.ken,node2.ken,node3.ken,node4.ken</value>
</property>
 类似资料:
  • 我一直在尝试启动NiFi,但每次我这样做,我都得到以下错误:

  • 我在eclipse安装中复制了一些插件(特别是Green和ObjectAid)。 我删除了它们(因为它不起作用),但现在我无法启动eclipse(即使使用)。 我得到: !session 2013-02-08 !Entry org.eclipse.osgi 4 0 201 3-02-08 16:21:17.779!Message Application error!Stack 1 java.lan

  • 我正在尝试启动一个简单的spring应用程序 我有主管道。java文件就在这里: 这是pom。xml: 最后一个错误是: 据我所知我少了一颗豆子?然而,看起来好像我有罐子春豆。

  • Maven build成功了,但当我尝试运行它时失败了: 我有带 一切似乎都准备就绪。发生了什么? pom.xml 更新1 使用IntelliJ构建jar工件时也是如此。 更新2 好的,我设法运行了它,但现在我有: 更新3 通过添加到应用程序使其正常工作。爪哇:

  • 我们在运行命令“minikube start--drive=hyv”时遇到以下错误,该命令最初工作正常,但突然开始出错。 C:\Windows\system32 迷你库贝 v1.22.0 on 微软视窗 10 企业 10.0.19043 内部版本 19043 根据用户配置使用 hyperv 驱动程序 由于PROVIDER_HYPERV_NOT_FOUND而退出:找不到“hyperv”提供程序:C:

  • 问题内容: 我尝试在Linux机器上运行jstatd jvm监视工具 使用以下命令: jstatd.all.policy内容 不幸的是,我得到以下输出: 由于某种原因,jstatd可以在具有相同命令和策略文件的Windows上成功运行。 Linux Java版本: Windows Java版本: 问题答案: 这对我有用: 确保tools.jar文件存在,并且运行jstatd命令的用户有权读取该文件