spotify / docker-kafka

Kafka (and Zookeeper) in Docker
Apache License 2.0
1.4k stars 643 forks source link

Unable to change port mappings #87

Open Godsim opened 6 years ago

Godsim commented 6 years ago

Hi, I seem to be unable to use different port mappings for this image in order to run different environments on the same machine. In conjunction with spring-kafka:2.1.4.RELEASE i get the following error:

2018-04-10 19:57:38.191 WARN 13318 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient : [Consumer clientId=consumer-1, groupId=notifications] Error while fetching metadata with correlation id 4 : {notifications.topic=LEADER_NOT_AVAILABLE} 2018-04-10 19:57:38.208 INFO 13318 --- [ Test worker] o.a.kafka.common.utils.AppInfoParser : Kafka version : 1.0.0 2018-04-10 19:57:38.208 INFO 13318 --- [ Test worker] o.a.kafka.common.utils.AppInfoParser : Kafka commitId : aaa7af6d4a11b29d 2018-04-10 19:57:38.228 WARN 13318 --- [ad | producer-1] org.apache.kafka.clients.NetworkClient : [Producer clientId=producer-1] Error while fetching metadata with correlation id 2 : {notifications.topic=LEADER_NOT_AVAILABLE} 2018-04-10 19:57:38.299 WARN 13318 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient : [Consumer clientId=consumer-1, groupId=notifications] Error while fetching metadata with correlation id 5 : {notifications.topic=LEADER_NOT_AVAILABLE} 2018-04-10 19:57:38.337 WARN 13318 --- [ad | producer-1] org.apache.kafka.clients.NetworkClient : [Producer clientId=producer-1] Error while fetching metadata with correlation id 3 : {notifications.topic=LEADER_NOT_AVAILABLE} 2018-04-10 19:57:38.406 WARN 13318 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient : [Consumer clientId=consumer-1, groupId=notifications] Error while fetching metadata with correlation id 6 : {notifications.topic=LEADER_NOT_AVAILABLE} 2018-04-10 19:57:38.445 WARN 13318 --- [ad | producer-1] org.apache.kafka.clients.NetworkClient : [Producer clientId=producer-1] Error while fetching metadata with correlation id 4 : {notifications.topic=LEADER_NOT_AVAILABLE} ... and so on

docker-compose: kafka: container_name: integration_kafka image: spotify/kafka:latest ports:

bootstrap.yml: spring: kafka: consumer: auto-offset-reset: earliest group-id: notifications bootstrap-servers:

Only if i run the container with the default mappings 9092:9092, 2181:2181 and the bootstrap servers set to 127.0.0.1:9092 it seems to work as intended. I'd be very thankful if you could point out my mistake... or care to correct yours ;-)

Godsim commented 6 years ago

Unfortunately the indents were ignored, considering the bootstrap-servers, it's on spring.kafka.bootstrap-servers, not spring.kafka.consumer.bootstrap-servers!

abendt commented 6 years ago

try to set ADVERTISED_HOST to the address of your docker host instead of 127.0.0.1