简体   繁体   English

无法在openwhisk设置中列出kafka主题

[英]Unable to list kafka topics in openwhisk setup

Setup details: I am setting up openwhisk on my local ubuntu(16.04) vm. 设置细节:我在我当地的ubuntu(16.04)vm上设置openwhisk。 in this setup kafka is running in one docker and zookeeper in another docker. 在这个设置中,kafka在另一个docker中的一个docker和zookeeper中运行。

I connect to the the kafka docker using cmd 我使用cmd连接到kafka docker

sudo docker exec -it <container id> sh

once connected i execute the following command to get the list of topics 一旦连接,我执行以下命令来获取主题列表

bin/kafka-topics.sh --list --zookeeper localhost:2181

which gives me an exception 这给了我一个例外

Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 7203; nested exception is:
        java.net.BindException: Address already in use

i am unable to understand why is it trying to use 7203 port? 我无法理解为什么要尝试使用7203端口?

docker ps output docker ps输出

83eba3961247        ches/kafka:0.10.0.1              "/start.sh"              
11 days ago         Up 23 hours         7203/tcp, 0.0.0.0:9092->9092/tcp                                                                                                                       
kafka
947fa689a7ef        zookeeper:3.4                    "/docker-
entrypoin..."   11 days ago         Up 23 hours         2888/tcp, 
0.0.0.0:2181->2181/tcp, 3888/tcp                                                                                                             zookeeper

The Kafka container OpenWhisk is using sets a JMX_PORT by default. Kafka容器OpenWhisk默认使用设置JMX_PORT That's the 7203 port you're seeing. 那是你看到的7203端口。 To get your script to work you need to unset that environment setting: 要使脚本正常工作,您需要取消设置该环境:

unset JMX_PORT; bin/kafka-topics.sh --list --zookeeper localhost:2181

Note though, that localhost is not a valid address for your zookeeper instance, as it refers to the localhost of the current container, which is not Zookeeper. 但请注意, localhost不是zookeeper实例的有效地址,因为它引用当前容器的localhost,而不是Zookeeper。 If you exchange localhost with the external IP of your VM or the IP of the zookeeper container (get it via docker inspect zookeeper --format {{.NetworkSettings.Networks.bridge.IPAddress}} ) your topics should be listed fine. 如果您将localhost与VM的外部IP或zookeeper容器的IP交换(通过docker inspect zookeeper --format {{.NetworkSettings.Networks.bridge.IPAddress}} ),您的主题应该被列出正常。

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

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