Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Kafka example not working (with 0.10) #62

Closed
bluepuma77 opened this issue Dec 8, 2016 · 2 comments
Closed

Kafka example not working (with 0.10) #62

bluepuma77 opened this issue Dec 8, 2016 · 2 comments

Comments

@bluepuma77
Copy link

For me the example with kafka-console-producer.sh and kafka-console-consumer.sh does not seem to work. No output from producer and no output from consumer. And when I close the consumer it tells me Processed a total of 0 messages.

# variables for all terminals
export IP=$(ifconfig eth0 | grep "inet addr:" | cut -d ":" -f2 | cut -d " " -f1)
export KAFKA=$IP:9092
export ZOOKEEPER=$IP:2181

# terminal 1
docker run \
  --name kafka \
  --restart=always \
  -p 2181:2181 \
  -p 9092:9092 \
  --env ADVERTISED_HOST=$IP\
  --env ADVERTISED_PORT=9092 \
  spotify/kafka

# terminal 2
docker run -it --rm spotify/kafka /opt/kafka_2.11-0.10.1.0/bin/kafka-console-producer.sh --broker-list $KAFKA --topic test

# terminal 3
docker run -it --rm spotify/kafka /opt/kafka_2.11-0.10.1.0/bin/kafka-console-consumer.sh --zookeeper $ZOOKEEPER --topic test

@bluepuma77
Copy link
Author

I tried to reproduce it with the old kafka 0.8 version from this repo, there I get an error with the producer WARN Property topic is not valid (kafka.utils.VerifiableProperties). Has this worked at some point in time?

# building with kafka 0.8
git clone https://github.com/spotify/docker-kafka
git reset --hard 170791da720498457ec545d97b7e43f13e28946f
cd kafka
docker build -t kafka:0.8 .

# variables for all terminals
export IP=$(ifconfig eth0 | grep "inet addr:" | cut -d ":" -f2 | cut -d " " -f1)
export KAFKA=$IP:9092
export ZOOKEEPER=$IP:2181

# terminal 1
docker run \
  --name kafka \
  --restart=always \
  -p 2181:2181 \
  -p 9092:9092 \
  --env ADVERTISED_HOST=$IP\
  --env ADVERTISED_PORT=9092 \
  kafka:0.8

# terminal 2
docker run -it --rm kafka:0.8 /opt/kafka_2.11-0.8.2.1/bin/kafka-console-producer.sh --broker-list $KAFKA --topic test

# terminal 3
docker run -it --rm kafka:0.8 /opt/kafka_2.11-0.8.2.1/bin/kafka-console-consumer.sh --zookeeper $ZOOKEEPER --topic test

@bluepuma77
Copy link
Author

Sorry, my mistake, I thought the kafka-console-producer.sh would automatically produce demo messages by itself. Instead I had to enter characters and press return for it to be sent to kafka and read by kafka-console-consumer.sh. So the latest kafka 0.10.1.0 docker image seems to work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant