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

2019-02-21 10:57:06 +08:00
 scalaer

/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

找不到原因 求大佬指导下

1164 次点击
所在节点    程序员
1 条回复
scalaer
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

蛋疼 ...

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/537153

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX