For now, I set my producer on machine A, and consumer on machine B, both are docker container, and both are under same WIFI connection. How to set up?
Now I can set it work on each side. The following is the docker-compose.yaml
version: '2'
services:
zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
kafka:
image: wurstmeister/kafka
ports:
- "9092:9092"
environment:
KAFKA_BROKER_ID: 1
KAFKA_LISTENERS: PLAINTEXT://localhost:9092
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
KAFKA_ADVERTISED_HOST_NAME: localhost
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
volumes:
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- zookeeper
same on both machine.
I would like to know how to set the hostname and IP address? I saw someone said that docker overlay network, I am not so sure if that is suitable in this scenario. Actully I have already tried
docker swarm init
on one machine, and let another join, but it cannot join, not sure how to use this. Is there anyone has some experience on this issue? Please share some comments with me!