read catalog
- 1. Install zookeeper
- 2. Start the zookeeper service
- 3. Install kafka
- 4. Modify the Kafka service configuration file
- 5. Start the Kafka service
- 6. Create a new topic
- 7. Create a producer
- 8. Create a consumer
1. Install zookeeper
brew install zookeeper
Default installation location
Startup file: /usr/local/Cellar/zookeeper/3.4.10/bin/
Configuration file: /usr/local/etc/zookeeper/
2. Start the zookeeper service
nohup zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties &
3. Install kafka
brew install kafka
4. Modify the Kafka service configuration file
Modify the configuration file /usr/local/etc/kafka/server.properties
Uncomment: listeners=PLAINTEXT://localhost:9092
5. Start the Kafka service
nohup kafka-server-start /usr/local/etc/kafka/server.properties &
6. Create a new topic
kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic topic_a
View the list of existing themes
kafka-topics --list --zookeeper localhost:2181
Modify the number of partitions
kafka-topics --zookeeper localhost:2181 --alter --topic topic_a --partitions 2
7. Create a producer
kafka-console-producer --topic topic_a --broker-list localhost:9092
8. Create a consumer
kafka-console-consumer --bootstrap-server localhost:9092 -topic topic_a