Skip to content

Instantly share code, notes, and snippets.

@ChrisMoney
Last active April 2, 2020 15:25
Show Gist options
  • Save ChrisMoney/e1a5744ab24ed27aaf59957c794b6273 to your computer and use it in GitHub Desktop.
Save ChrisMoney/e1a5744ab24ed27aaf59957c794b6273 to your computer and use it in GitHub Desktop.
Kafka Commands to start Zookeeper broker and spin up Producer and Consumer
-- Start Zookeeper and kafka
$ ./bin/zookeeper-server-start ./etc/kafka/zookeeper.properties
$ ./bin/kafka-server-start ./etc/kafka/server.properties
$ ./bin/schema-registry-start ./etc/schema-registry/schema-registry.properties
-- Create Schema Command (Java app will do this part)
./bin/kafka-avro-console-producer \
--broker-list localhost:9092 --topic test \
--property value.schema='{"type":"record","name":"Provider","fields":[{"name":"ProviderID","type":"int"},{"name":"Location_ID","type":"int"},{"name":"Network_ID","type":"int"},{"name":"Practitioner_ID","type":"int"},{"name":"ProviderName","type":"string"}]}' --property schema.registry.url=http://localhost:9092
-- Start consumer
./bin/kafka-avro-console-consumer --topic test \
--zookeeper localhost:2181 \
--from-beginning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment