kafka-docker: Not works on Docker Mac Native - Zookeeper timeouts
I’m using Docker Native with 6GB RAM, 2CPU Core.
$ docker -v
Docker version 1.12.0, build 8eab29e
kafka_2.11-0.10.0.0, zookeeper-3.4.6
I try make steps in help for testing.
$ docker-compose up -d
$ docker-compose scale kafka=2
$ ./start-kafka-shell.sh 172.18.0.2 172.18.0.3:2181
bash-4.3# $KAFKA_HOME/bin/kafka-topics.sh --create --topic topic \
> --partitions 4 --zookeeper $ZK --replication-factor 2
Exception in thread "main" org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 30000
at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:1232)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:156)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:130)
at kafka.utils.ZkUtils$.createZkClientAndConnection(ZkUtils.scala:75)
at kafka.utils.ZkUtils$.apply(ZkUtils.scala:57)
at kafka.admin.TopicCommand$.main(TopicCommand.scala:54)
at kafka.admin.TopicCommand.main(TopicCommand.scala)
Any idea why this not work?
It’s some simple test for zookeeper how check if works correctly?
IP Addresses are from docker inspect
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 7
- Comments: 16
Most likely the broker’s advertised IP address is incorrect. I use an environment variable, DOCKER_HOST_IP, to use my Mac’s public IP address as the KAFKA_ADVERTISED_HOST_NAME value. Here are the relevant snippets from my scripts:
…
…
…
…
@jonbuffington @VatslavDS @mmullis
I find that nothing proposed here works.
My full
docker-compose.yml:What sense does it make to set
KAFKA_ZOOKEEPER_CONNECTto a link alias, i.e.zk?