Builder Bob
Builder Bob

Reputation: 149

producer fails on org.apache.kafka.common.errors.TimeoutException: Topic topicTest not present in metadata after 60000 ms

I'm trying to produce messages to a kafka container and it seems to fail on produce. connection seems OK.

docker-compose.yml
version: '2'
services:
zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
kafka:
build: .
ports:
- "9092:9092"
- "9093:9093"
environment:
KAFKA_ADVERTISED_HOST_NAME: localhost
KAFKA_LISTENERS: INTERNAL://kafka:9093,EXTERNAL://127.0.0.1:9092
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9093,EXTERNAL://127.0.0.1:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
volumes:
- /var/run/docker.sock:/var/run/docker.sock

tried with both :

.\kafka-console-producer.bat --broker-list 0.0.0.0:9092 --topic topicTest
and
.\kafka-console-producer.bat --broker-list localhost:9092 --topic topicTest

netstat shows listening on the port.

.\kafka-topics.bat --describe --zookeeper localhost:2181 --topic topicTest 
Topic:topicTest PartitionCount:1 ReplicationFactor:1 Configs:
Topic: topicTest Partition: 0 Leader: 1001 Replicas: 1001 Isr: 1001

any ideas ?

Upvotes: 0

Views: 3052

Answers (1)

Builder Bob
Builder Bob

Reputation: 149

Found my issue!!!!

I've changed the following :

KAFKA_LISTENERS: INTERNAL://kafka:9093,EXTERNAL://127.0.0.1:9092
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9093,EXTERNAL://127.0.0.1:9092

into:

KAFKA_LISTENERS: INTERNAL://:9093,EXTERNAL://:9092
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9093,EXTERNAL://localhost:9092

and it worked.

I guess that the KAFKA_LISTENERS property should not have addressed the localhost or something.

Upvotes: 1

Related Questions