Kafka Consumer Error-提供的xxxx节点名或servname或未知 [英] Kafka Consumer Error - xxxx nodename nor servname provided, or not known

查看:159
本文介绍了Kafka Consumer Error-提供的xxxx节点名或servname或未知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用以下命令运行控制台使用者时

When running the console consumer using the following command

$〜/project/libs/kafka_2.9.2-0.8.1.1/bin/kafka-console-consumer.sh --zookeeper本地主机:2181 --topic customerevents --autocommit.interval.ms 100 --group customereventsgroup

$ ~/project/libs/kafka_2.9.2-0.8.1.1/bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic customerevents --autocommit.interval.ms 100 --group customereventsgroup

我遇到以下错误

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

$ hostname
HQSML-142453
$

$hostname
HQSML-142453
$

看了一点之后,我注意到Kafka服务器的配置如下

After reading a bit, I noticed that the Kafka server configuration has the following

#代理将向生产者和消费者发布广告的主机名.如果未设置,则使用
#"host.name"的值(如果已配置).否则,它将使用
返回的值 #java.net.InetAddress.getCanonicalHostName().
advertised.host.name = HQSML-142453

# Hostname the broker will advertise to producers and consumers. If not set, it uses the
# value for "host.name" if configured. Otherwise, it will use the value returned from
# java.net.InetAddress.getCanonicalHostName().
advertised.host.name=HQSML-142453

我更新了主机名,但似乎没有帮助.关于可能出现问题的任何想法.

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或未知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆