【kafka】mac installation Kafka

read catalog

back to the top

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/               

back to the top

2. Start the zookeeper service

nohup zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties &

back to the top

3. Install kafka

brew install kafka

back to the top

4. Modify the Kafka service configuration file

Modify the configuration file /usr/local/etc/kafka/server.properties

Uncomment: listeners=PLAINTEXT://localhost:9092

back to the top

5. Start the Kafka service

nohup kafka-server-start /usr/local/etc/kafka/server.properties &

back to the top

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

back to the top

7. Create a producer

kafka-console-producer --topic topic_a --broker-list localhost:9092

back to the top

8. Create a consumer

kafka-console-consumer --bootstrap-server localhost:9092 -topic topic_a

おすすめ

転載: blog.csdn.net/qq_42200107/article/details/125023637