$ kafka-console-producer -broker-list localhost:9092 -topic foobar > foo > bar And try to send some test messages as follows: In the first one initialize a producer console for topic the foobar.Once the topic is created we can test out Kafka producer and consumer APIs: NOTE: Notice here we aren’t using -zookeeper flag as in standard documentations because Kafka versions for new MacOS do not support/ require that flag anymore. Here is an example to create a sample topic named foobar : $ kafka-topics -create -bootstrap-server localhost:9092 -replication-factor 1 -partitions 1 -topic foobar Before running any producer or consumer API it is mandatory to create a topic. A topic is a category or feed name to which records are stored and published. Start Kafka: $ kafka-server-start /opt/homebrew/etc/kafka/server.propertiesĪfter the services are successfully running, the next step is to create a kafka topic. Start Zookeeper: $ zookeeper-server-start /opt/homebrew/etc/kafka/zookeeper.properties Now to run kafka open two seperate terminals to run Zookeeper and Kafka services seperately as: Once these commands run successfully your kafka package is installed. The first steps are pretty straightforward: $ brew install java $ brew install kafka If not refer to this stackoverflow link to set it up or refer the official documentation. This article assumes that you have already setup homebrew on your MacOS M1 system.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |