-
Notifications
You must be signed in to change notification settings - Fork 14
Docker container for a single node Kafka broker
authorjapps edited this page Dec 25, 2018
·
14 revisions
See here the docker-compose file
-
Go to the
zerocode-docker-factory/compose
dir in a terminal window -
Then run
-
$ docker-compose -f kafka-single-node.yml up -d
or
-
$ docker-compose -f kafka-single-node.yml up
-
This brings up both Zookeeper and Kafka server(server and broker mean the same thing on this page)
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9b5001dc2931 confluentinc/cp-kafka:5.0.1 "/etc/confluent/dock…" 3 hours ago Up 3 hours 0.0.0.0:9092->9092/tcp compose_kafka_1
037afbb001ac confluentinc/cp-zookeeper:5.0.1 "/etc/confluent/dock…" 3 hours ago Up 3 hours 2181/tcp, 2888/tcp, 3888/tcp compose_zookeeper_1
$
Note-
See under the "NAMES" column(right hand ride) above, for `compose_kafka_1` as container name
and the "PORT" column to see which port it is listening to for the external clients
- To make sure Kafka broker is running and it has exposed the port
9092
to external client outside the docker,-
nc -vz localhost 9092
-
$ nc -vz localhost 9092
found 0 associations
found 1 connections:
1: flags=82<CONNECTED,PREFERRED>
outif lo0
src ::1 port 51288
dst ::1 port 9092
rank info not available
TCP aux info available
Connection to localhost port 9092 [tcp/XmlIpcRegSvc] succeeded!
Note- If a port is not exposed, you get the following message.
--------------------------------------------------------------
$ nc -vz localhost 9093
nc: connectx to localhost port 9093 (tcp) failed: Connection refused
nc: connectx to localhost port 9093 (tcp) failed: Connection refused
$
docker exec -it compose_kafka_1 bash