安裝
1. 到 kafka 網站 APACHE KAFKA
2. 點 DOWNLOAD KAFA
3. 下載 Binary download
nano@nano-desktop:~/Data/DeepStream$ tar -xzf kafka_2.13-2.6.0.tgz
nano@nano-desktop:~/Data/DeepStream$ cd kafka_2.13-2.6.0/
啟動 zookeeper
nano@nano-desktop:~/Data/DeepStream/kafka_2.13-2.6.0$ bin/zookeeper-server-start.sh config/zookeeper.properties
啟動 kafka
nano@nano-desktop:~/Data/DeepStream/kafka_2.13-2.6.0$ bin/kafka-server-start.sh config/server.properties
查詢目前 topic
nano@nano-desktop:~/Data/DeepStream/kafka_2.13-2.6.0$ bin/kafka-topics.sh --list --zookeeper localhost:2181
建立 topic test
nano@nano-desktop:~/Data/DeepStream/kafka_2.13-2.6.0$ bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
從 topic test 接收訊息
nano@nano-desktop:~/Data/DeepStream/kafka_2.13-2.6.0$ bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
傳送訊息到 topic test
nano@nano-desktop:~/Data/DeepStream/kafka_2.13-2.6.0$ bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
>
沒有留言:
張貼留言