简体   繁体   English

卡夫卡+ Zookeeper远程=错误

[英]kafka + zookeeper remote = error

I am trying to install a kafka & zookeeper instance on a remote server. 我正在尝试在远程服务器上安装kafka和zookeeper实例。 I only need 1 node of each actually because i only want to provide remote kafka for test purposes. 我实际上只需要一个节点,因为我只想提供远程kafka进行测试。

Kafka and Zookeeper are running from the Apache Kafka tarball you can find there (v0.0.9), inside a Docker image . 卡夫卡和动物园管理员从Apache的卡夫卡压缩包,你可以找到运行的 (v0.0.9), 码头工人图像内。

Trying to consume / produce using the provided scripts. 尝试使用提供的脚本消费/生产。 And trying to produce using own java application. 并尝试使用自己的Java应用程序进行生产。 Everythinf is working fine if Kafka & ZK are installed on the local server. 如果在本地服务器上安装了Kafka&ZK,Everythinf可以正常工作。

Here is the error I get while trying to produce : 这是我尝试产生时遇到的错误:

BrokerPartitionInfo:83 - Error while fetching metadata [{TopicMetadata for topic RSS ->
No partition metadata for topic RSS due to kafka.common.LeaderNotAvailableException}] for topic [RSS]: class kafka.common.LeaderNotAvailableException

Kafka properties tested 卡夫卡性能测试

First : 首先:

borker.id=0
port=9092
host.name=<external-ip>
zookeeper.connect=localhost:<PORT>

Second: 第二:

borker.id=0
port=9092
host.name=<external-ip>
zookeeper.connect=<external-ip>:<PORT>

Third: 第三:

borker.id=0
port=9092
host.name=<external-ip>
zookeeper.connect=<external-ip>:<PORT>
advertised.host.name=<external-ip>
advertised.host.port=<external-ip>

Last: 持续:

borker.id=0
port=9092
host.name=</etc/host name>
zookeeper.connect=<external-ip>:<PORT>
advertised.host.name=<external-ip>
advertised.host.port=<external-ip>

Here is my " /etc/hosts " 这是我的“ / etc / hosts

127.0.0.1 kafka kafka
127.0.0.1 localhost  

I followed the Getting Started, which if I understood is a localhost / signle server configurations. 我遵循了《入门指南》,如果我理解的话,它是localhost / signle服务器的配置。 I cannot understand what I have to do to get this work with remote calls... 我不明白我需要做些什么才能通过远程呼叫完成这项工作...

Thanks for your help ! 谢谢你的帮助 !


EDIT 1 编辑1

host.name=localhost
advertised.host.name=politik.cm-cloud.fr

Seems to allow a local consumer (on the server) and producer. 似乎允许本地使用者(在服务器上)和生产者。 But if we want to do the same from a remote server we get 但是,如果我们想从远程服务器上做同样的事情,我们会得到

[2015-12-09 12:44:10,826] WARN Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)
java.net.NoRouteToHostException: No route to host

The error does not look like connectivity problem with Zookeeper / Kafka. 该错误看起来不像Zookeeper / Kafka的连接问题。 Just follow the instruction in "quickstart" from http://kafka.apache.org/ 只需按照http://kafka.apache.org/中“ quickstart”中的说明进行操作

BrokerPartitionInfo:83 - Error while fetching metadata [{TopicMetadata for topic RSS ->

Additionally the error indicates there is no partition info ie topic not yet created . 此外,该错误指示没有分区信息,即尚未创建主题。 Try creating topics first and then try to produce/consume because when producing to a non existent topic kafka will create the topic based on auto.create.topics.enable in server.properties but remotely it is better to create topics rathen than relying on auto create 首先尝试创建主题,然后尝试生成/消费,因为当生成不存在的主题时,kafka将基于server.properties中的auto.create.topics.enable创建主题,但从远程创建主题​​比与依赖auto更好。创造

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM