-
请先自行安装jdk
-
kafka下载 wget https://mirrors.tuna.tsinghua.edu.cn/apache/kafka/3.0.0/kafka_2.12-3.0.0.tgz
-
tar -xzvf kafka_2.12-3.0.0.tgz
-
进入文件夹kafka_2.12-3.0.0
cd kafka_2.12-3.0.0 -
vi config/zookeeper.properties
-
vi config/server.properties
-
启动zookeeper
在kafka_2.12-3.0.0/bin文件夹下执行
zookeeper-server-start.sh -daemon …/config/zookeeper.properties -
启动kafka
在kafka_2.12-3.0.0/bin文件夹下执行
kafka-server-start.sh …/config/server.properties -
创建topic
kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test -
显示所有topic
kafka-topics.sh --list --bootstrap-server localhost:9092 -
产生消息
kafka-console-producer.sh --broker-list localhost:9092 --topic test -
消费消息
kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning -
删除topic
kafka-topics.sh --delete --bootstrap-server localhost:9092 --topic test -
重点!!!
腾讯云/阿里云 Linux云主机安装kafka后,外网无法访问
以腾讯云为例进行更改- 开放端口
- 修改config/server.properties文件
- 结束
- 开放端口
centos8安装kafaka2.12-3.0.0
最新推荐文章于 2023-03-15 17:03:39 发布