V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
scalaer
V2EX  ›  程序员

druid 连接 zookeeper 集群报 Unable to connect to server

  •  
  •   scalaer · 2019-02-21 10:57:06 +08:00 · 1162 次点击
    这是一个创建于 2137 天前的主题,其中的信息可能已经有所发展或是发生改变。

    /etc/hosts 文件内容

    192.168.1.14	druid_master
    192.168.1.75	druid_d_01
    192.168.1.113	druid_q_01
    

    druid_master 启动 coordinator 服务的时候, 只能连接本地的 zookeeper 的服务, 报的错误如下

    2019-02-21T02:32:53,003 ERROR [main] org.apache.zookeeper.client.StaticHostProvider - Unable to connect to server:  druid_q_01:2181
    java.net.UnknownHostException:  druid_q_01: 未知的名称或服务
    	at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[?:1.8.0_191]
    	at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929) ~[?:1.8.0_191]
    	at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324) ~[?:1.8.0_191]
    	at java.net.InetAddress.getAllByName0(InetAddress.java:1277) ~[?:1.8.0_191]
    	at java.net.InetAddress.getAllByName(InetAddress.java:1193) ~[?:1.8.0_191]
    	at java.net.InetAddress.getAllByName(InetAddress.java:1127) ~[?:1.8.0_191]
    	at org.apache.zookeeper.client.StaticHostProvider.<init>(StaticHostProvider.java:62) [zookeeper-3.4.11.jar:3.4.11-37e277162d567b55a07d1755f0b31c32e93c01a0]
    	at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:449) [zookeeper-3.4.11.jar:3.4.11-37e277162d567b55a07d1755f0b31c32e93c01a0]
    	at org.apache.curator.utils.DefaultZookeeperFactory.newZooKeeper(DefaultZookeeperFactory.java:29) [curator-client-4.0.0.jar:?]
    	at org.apache.curator.framework.imps.CuratorFrameworkImpl$2.newZooKeeper(CuratorFrameworkImpl.java:191) [curator-framework-4.0.0.jar:4.0.0]
    	at org.apache.curator.HandleHolder$1.getZooKeeper(HandleHolder.java:101) [curator-client-4.0.0.jar:?]
    	at org.apache.curator.HandleHolder.getZooKeeper(HandleHolder.java:57) [curator-client-4.0.0.jar:?]
    	at org.apache.curator.ConnectionState.reset(ConnectionState.java:201) [curator-client-4.0.0.jar:?]
    	at org.apache.curator.ConnectionState.start(ConnectionState.java:111) [curator-client-4.0.0.jar:?]
    	at org.apache.curator.CuratorZookeeperClient.start(CuratorZookeeperClient.java:214) [curator-client-4.0.0.jar:?]
    	at org.apache.curator.framework.imps.CuratorFrameworkImpl.start(CuratorFrameworkImpl.java:308) [curator-framework-4.0.0.jar:4.0.0]
    	at org.apache.druid.curator.CuratorModule$1.start(CuratorModule.java:109) [druid-server-0.13.0-incubating-iap8.jar:0.13.0-incubating-iap8]
    	at org.apache.druid.java.util.common.lifecycle.Lifecycle.start(Lifecycle.java:311) [java-util-0.13.0-incubating-iap8.jar:0.13.0-incubating-iap8]
    	at org.apache.druid.guice.LifecycleModule$2.start(LifecycleModule.java:134) [druid-api-0.13.0-incubating-iap8.jar:0.13.0-incubating-iap8]
    	at org.apache.druid.cli.GuiceRunnable.initLifecycle(GuiceRunnable.java:109) [druid-services-0.13.0-incubating-iap8.jar:0.13.0-incubating-iap8]
    	at org.apache.druid.cli.ServerRunnable.run(ServerRunnable.java:58) [druid-services-0.13.0-incubating-iap8.jar:0.13.0-incubating-iap8]
    	at org.apache.druid.cli.Main.main(Main.java:118) [druid-services-0.13.0-incubating-iap8.jar:0.13.0-incubating-iap8]
    

    druid_master ping 的通其他两台服务

    PING druid_q_01 (192.168.1.113) 56(84) bytes of data.
    64 bytes from druid_q_01 (192.168.1.113): icmp_seq=1 ttl=64 time=1.48 ms
    64 bytes from druid_q_01 (192.168.1.113): icmp_seq=2 ttl=64 time=0.343 ms
    64 bytes from druid_q_01 (192.168.1.113): icmp_seq=3 ttl=64 time=0.334 ms
    --------------------------------------------------------------------------
    
    64 bytes from druid_d_01 (192.168.1.75): icmp_seq=1 ttl=64 time=0.300 ms
    64 bytes from druid_d_01 (192.168.1.75): icmp_seq=2 ttl=64 time=0.301 ms
    64 bytes from druid_d_01 (192.168.1.75): icmp_seq=3 ttl=64 time=0.322 ms
    64 bytes from druid_d_01 (192.168.1.75): icmp_seq=4 ttl=64 time=0.313 ms
    

    找不到原因 求大佬指导下

    1 条回复    2019-02-21 15:12:11 +08:00
    scalaer
        1
    scalaer  
    OP
       2019-02-21 15:12:11 +08:00
    已解决, 原因是配置的时候多了空格

    druid.zk.service.host=druid_master:2181, druid_d_01:2181, druid_q_01:2181

    改后的配置:
    druid.zk.service.host=druid_master:2181,druid_d_01:2181,druid_q_01:2181

    蛋疼 ...
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1020 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 19:39 · PVG 03:39 · LAX 11:39 · JFK 14:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.