3 Kafka传输部署

本文目标

部署Kafka,用来作为数据同步通道

启动kafka

tar xfz kafka_2.12-3.3.1.tgz
cd kafka_2.12-3.3.1/bin
./zookeeper-server-start.sh -daemon ../config/zookeeper.properties
./kafka-server-start.sh -daemon ../config/server.properties

创建topic

./kafka-topics.sh --list --bootstrap-server 127.0.0.1:9092
[yinyx@localhost bin]$ ./kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --create --topic yinyx
Created topic yinyx.
[yinyx@localhost bin]$ ./kafka-topics.sh --list --bootstrap-server 127.0.0.1:9092
yinyx
[yinyx@localhost bin]$ ./kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --describe --topic yinyx
Topic: yinyx	TopicId: 095NSZOWQ7uns2rtIt6J3A	PartitionCount: 1	ReplicationFactor: 1	Configs: 
	Topic: yinyx	Partition: 0	Leader: 0	Replicas: 0	Isr: 0
[yinyx@localhost bin]$ 

启动消费

[yinyx@localhost bin]$ ./kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --topic yinyx
1
你好
中国!

启动生产

[yinyx@localhost bin]$ ./kafka-console-producer.sh --bootstrap-server 127.0.0.1:9092 --topic yinyx
>1
>你好
>中国!
>
posted @   大雨点  阅读(33)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示