Kafaka
安装
参考:
下载
https://kafka.apache.org/downloads
bash
wget https://archive.apache.org/dist/kafka/0.10.1.1/kafka_2.10-0.10.1.1.tgz
安装
bash
# 解压即可
tar -zxf kafka_2.10-0.10.1.1.tgz
启动
bash
bin/kafka-server-start.sh config/server.properties
验证
创建topic
bash
#bin/kafka-topics.sh --create --partitions 1 --replication-factor 1 --topic quickstart-events --bootstrap-server 127.0.0.1:9092
bin/kafka-topics.sh --create --zookeeper 127.0.0.1:2181 --partitions 1 --replication-factor 1 --topic quickstart-events
查看topic
bash
bin/kafka-topics.sh --list --zookeeper 127.0.0.1:2181
发送消息
bash
bin/kafka-console-producer.sh --broker-list 127.0.0.1:9092 --topic quickstart-events
接收消息
bash
bin/kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --topic quickstart-events --from-beginning
查看topic
详情
bash
bin/kafka-topics.sh --zookeeper 127.0.0.1:2181 --describe --topic quickstart-events
删除topic
bash
bin/kafka-topics.sh --zookeeper 127.0.0.1:2181 --delete --topic quickstart-events