Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to list kafka topics in openwhisk setup

Setup details: I am setting up openwhisk on my local ubuntu(16.04) vm. in this setup kafka is running in one docker and zookeeper in another docker.

I connect to the the kafka docker using cmd

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?

docker ps output

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
like image 681
Katiyman Avatar asked May 17 '17 05:05

Katiyman


People also ask

How can I see my Kafka topic details?

You can use the bin/kafka-topics.sh shell script along with the Zookeeper service URL as well as the –list option to display a list of all the topics in the Kafka cluster. You can also pass the Kafka cluster URL to list all topics.

Is used to create and list topics in Kafka?

To list the number of topics created within a broker, use '-list' command as: 'kafka-topics. bat -zookeeper localhost:2181 -list'. There are two topics 'myfirst' and 'mysecond' present in the above snapshot.

How do I send messages to Kafka topic manually?

Step1: Start the zookeeper as well as the kafka server. Step2: Type the command: 'kafka-console-producer' on the command line. This will help the user to read the data from the standard inputs and write it to the Kafka topic.


1 Answers

The Kafka container OpenWhisk is using sets a JMX_PORT by default. That's the 7203 port you're seeing. 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. 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.

like image 178
markusthoemmes Avatar answered Oct 12 '22 19:10

markusthoemmes