问题描述
使用以下命令运行控制台使用者时
When running the console consumer using the following command
我遇到以下错误
Exception in thread "main" java.net.UnknownHostException: HQSML-142453: HQSML-142453: nodename nor servname provided, or not known
at java.net.InetAddress.getLocalHost(InetAddress.java:1473)
at kafka.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerConnector.scala:107)
at kafka.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerConnector.scala:128)
at kafka.consumer.Consumer$.create(ConsumerConnector.scala:89)
at kafka.consumer.ConsoleConsumer$.main(ConsoleConsumer.scala:178)
at kafka.consumer.ConsoleConsumer.main(ConsoleConsumer.scala)
Caused by: java.net.UnknownHostException: HQSML-142453: nodename nor servname provided, or not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
at java.net.InetAddress.getLocalHost(InetAddress.java:1469)
... 5 more
现在,此命令在连接到工作网络时可以正常工作,但在从我的家庭网络运行时则不能正常工作.
Now this command worked fine when connected to the work network but not when running from my home network.
检查系统的主机名,我确实得到了正确的响应
Checking the hostname of the system I do get the correct response
看了一点之后,我注意到Kafka服务器的配置如下
After reading a bit, I noticed that the Kafka server configuration has the following
我更新了主机名,但似乎没有帮助.关于可能出现问题的任何想法.
which i updated to include my hostname but that didn't seem to help. Any ideas on what could be the problem here.
我知道这是与某些网络接口相关的,但是不能缩小到它的范围.
I know this is some networking interface related but cannot narrow it down to what it is.
config:优胜美地,osx jdk 7,kafka v0.8.1.1
config: Yosemite, osx jdk 7, kafka v0.8.1.1
推荐答案
尝试以下操作;
运行
ping HQSML-142453
如果ping不起作用,则意味着您没有在/etc/hosts
或路由器DNS中配置的主机名.因此,您必须编辑/etc/hosts
并将HQSML-142453
名称映射到kafka运行所在的IP地址,或者将其映射到路由器DNS中.
If the ping is not working that means you don't have have the hostname configured in /etc/hosts
or in your router DNS. So you must either edit the /etc/hosts
and map your HQSML-142453
name to the IP address where your kafka is running or map it in your router DNS.
映射必须类似于/etc/hosts
中的以下内容;
Mapping must look like the following in /etc/hosts
;
127.0.0.1 HQSML-142453
这篇关于Kafka Consumer Error-提供的xxxx节点名或servname或未知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!