kafka的基本安装与使用
kafka的基本安装与使用
1、上官网下载tar包
2、解压
3、运行zookeeper
4、运行kafka服务器
5、创建topic
6、发送消息
7、监听消息
1、上官网下载tar包
https://www.apache.org/dyn/closer.cgi?path=/kafka/2.2.0/kafka_2.12-2.2.0.tgz
2、tar包上传到服务器
tar -zxvf kafka_2.12-2.2.0.tgz
3、运行zookeeper
切换到解压目录

运行
bin/zookeeper-server-start.sh config/zookeeper.properties &

4、运行kafka服务器
修改配置文件
vim config/server.properties

bin/kafka-server-start.sh config/server.properties &
5、创建topic
创建名为 test的topic
bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test
查看主题数量
bin/kafka-topics.sh --list --bootstrap-server localhost:9092

6、发送消息
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

this is a message;
7、监听消息
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning


浙公网安备 33010602011771号