“Caused by: java.net.UnknownHostException: localhsot" ----- localhsot?  A typo?


________________________________
发件人: M. Manna <manme...@gmail.com>
发送时间: 2017年7月7日 16:59
收件人: users@kafka.apache.org
主题: console consumer doesn't recognise localhost:2181 but only 127.0.0.1:2181

Hello,

As part of my PoC I wanted to check if we have two Windows 10 boxes where

1) One box will have the ZK
2) Other box will have Kafka

The idea was to physically separate zookeeper and Kafka to isolate issues.
For trial, I set it up on my Windows 10 machine where I used the
Documentation to create 3 ZK and 3 Kafka cluster setup. For this, I
downloaded zookeeper-3.4.10 separately, and started them (in order) and
independent of Kafka Servers. So I am* not *using zookeeper-server-start.

When I ran the topics utility

C:/kafka/bin/windows/kafka-topics --create --topic "test1" --partitions 3
--replication-factor 3 --zookeeper
localhost:2181,localhost:2182,localhost:2183

It spits out error since it cannot find localhost:

C:\kafka_2.10-0.10.2.1\bin\windows>kafka-topics.bat --create --topic test1
> --zookeeper localhsot:2181,localhost:2182,localhost:2183 --partitions 3
> --replication-factor 3
> Exception in thread "main" org.I0Itec.zkclient.exception.ZkException:
> Unable to connect to localhsot:2181,localhost:2182,localhost:2183
>         at org.I0Itec.zkclient.ZkConnection.connect(ZkConnection.java:72)
>         at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:1228)
>         at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:157)
>         at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:131)
>         at
> kafka.utils.ZkUtils$.createZkClientAndConnection(ZkUtils.scala:106)
>         at kafka.utils.ZkUtils$.apply(ZkUtils.scala:88)
>         at kafka.admin.TopicCommand$.main(TopicCommand.scala:53)
>         at kafka.admin.TopicCommand.main(TopicCommand.scala)
> Caused by: java.net.UnknownHostException: localhsot
>         at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
>         at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
>         at
> java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
>         at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
>         at java.net.InetAddress.getAllByName(InetAddress.java:1192)
>         at java.net.InetAddress.getAllByName(InetAddress.java:1126)
>         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.I0Itec.zkclient.ZkConnection.connect(ZkConnection.java:70)
>         ... 7 more


but when I replace them with 127.0.0.1 it works! I know that I have to keep
correct values for advertised.listeners or listeners property to make this
work correctly (and i have). But since it's ignoring "localhost" name when
zookeeper is started I am thinking that for some reason it couldn't bind
127.0.0.1 to localhost.

Has anyone experienced this with fully segregated ZK and Kafka setup? or is
it just Windows issue?

KR,

Reply via email to