docker-compose up
Check the containers are up
docker ps
# Create the topic
docker-compose exec broker kafka-topics --create --topic foo --partitions 1 --replication-factor 1 --if-not-exists --zookeeper zookeeper:2181
# Verify the topic
docker-compose exec broker kafka-topics --describe --topic foo --zookeeper zookeeper:2181
# List the topic
docker-compose exec broker kafka-topics --list --zookeeper zookeeper:2181
docker-compose exec broker kafka-console-producer --request-required-acks 1 --broker-list broker:9092 --topic foo
docker-compose exec broker kafka-console-consumer --bootstrap-server broker:9092 --topic foo --from-beginning --partition 0 # --partition 0 is a quick fix
docker-compose exec broker kafka-topics --delete --topic foo --zookeeper zookeeper:2181
docker-compose exec broker kafka-topics --create --topic bar --partitions 1 --replication-factor 1 --if-not-exists --zookeeper zookeeper:2181
docker-compose exec schema-registry kafka-avro-console-consumer --topic bar --bootstrap-server broker:9092 --from-beginning --partition 0
docker-compose exec broker kafka-console-consumer --topic bar --bootstrap-server broker:9092 --from-beginning --partition 0
docker-compose exec schema-registry kafka-avro-console-producer \
--broker-list broker:9092 --topic bar \
--property value.schema='{"type":"record","name":"myrecord","fields":[{"name":"f1","type":"string"}, {"name": "f2", "type": "string"}]}'
docker-compose exec broker kafka-topics --describe --topic foo --zookeeper zookeeper:2181
docker-compose exec broker kafka-console-consumer --topic _schemas --bootstrap-server broker:9092 --from-beginning --partition 0
docker-compose exec schema-registry kafka-avro-console-producer \
--broker-list broker:9092 --topic bar \
--property value.schema.id=???
docker-compose exec schema-registry kafka-avro-console-producer \
--broker-list broker:9092 --topic bar \
--property value.schema='{"type":"record","name":"myrecord","fields":[{"name":"f1","type":"string"}]}'
docker-compose exec schema-registry kafka-avro-console-producer \
--broker-list broker:9092 --topic bar \
--property value.schema='{"type":"record","name":"myrecord","fields":[{"name":"f1","type":"string"}, {"name": "f2", "type": "string"}, {"name": "f3", "type": "string"}]}'