テスト用に小さなkafkaセットアップが必要です。
私はkafkaを初めて使用しますが、Dockerコンテナーにセットアップしたkafkaに接続する方法が見つかりません。
zookeeperとkafkaを含むコンテナーであるhttps://hub.docker.com/r/spotify/kafka/を使用しようとしましたが、kafkaのIPが何であるかわかりません。
docker run -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=`docker-machine ip \`docker-machine active\`` --env ADVERTISED_PORT=9092 spotify/kafka
ログ:
Digest: sha256:cf8f8f760b48a07fb99df24fab8201ec8b647634751e842b67103a25a388981b
Status: Downloaded newer image for spotify/kafka:latest
/usr/lib/python2.7/dist-packages/supervisor/options.py:296: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
'Supervisord is running as root and it is searching '
2020-07-12 19:45:07,018 CRIT Supervisor running as root (no user in config file)
2020-07-12 19:45:07,019 WARN Included extra file "/etc/supervisor/conf.d/kafka.conf" during parsing
2020-07-12 19:45:07,019 WARN Included extra file "/etc/supervisor/conf.d/zookeeper.conf" during parsing
2020-07-12 19:45:07,027 INFO RPC interface 'supervisor' initialized
2020-07-12 19:45:07,027 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2020-07-12 19:45:07,027 INFO supervisord started with pid 1
2020-07-12 19:45:08,031 INFO spawned: 'zookeeper' with pid 8
2020-07-12 19:45:08,034 INFO spawned: 'kafka' with pid 9
2020-07-12 19:45:09,081 INFO success: zookeeper entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-07-12 19:45:09,082 INFO success: kafka entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
kafka-uiを使用して接続しています。私が使おうとしているのは:
zookeeper: localhost:2181 <--- working
kafka: localhost:9092 <--- ERROR: "The broker [localhost:9092] is reachable
but Kafka can't connect. ensure you have access to the *advertised listeners*
of the cluster and the proper authorizations."
Spotifyコンテナはメンテナンスされなくなりました。
Confluent Dockerクイックスタートガイドに従うか、少なくともオールインワンのKafka + ZooKeeperイメージではなくDockerComposeを使用することをお勧めします
また、「またはDocker?」という青いヘルプコンテンツについても説明します。
しかし、私はkafkaのIPが何であるかわかりません:
ここでは単一のホストのみを使用しているため、Zookeeperと同じIPです。
Linuxを使用しているようですので、DockerMachineが必要な理由は明確ではありません。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加