大数据全系列 教程
1869个小节阅读:465.2k
目录
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
启动Zookeeper集群
xxxxxxxxxx
[root@node2 ~]# zkServer.sh start
[root@node3 ~]# zkServer.sh start
[root@node4 ~]# zkServer.sh start
启动kafka集群
xxxxxxxxxx
[root@node2 ~]# kafka.sh start
--------start node2's kafka----------
--------start node3's kafka----------
--------start node4's kafka----------
创建主题topic_sink
xxxxxxxxxx
[root@node2 ~]# kafka-topics.sh --bootstrap-server node3:9092 --replication-factor 1 --partitions 3 --create --topic topic_sink
查看所有主题
xxxxxxxxxx
[root@node2 ~]# kafka-topics.sh --list --bootstrap-server node3:9092
topic_sink
......
node3上启动nc
xxxxxxxxxx
[root@node3 ~]# nc -lk 8888
运行程序KafkaProducerDemo
启动kafka消费者者
xxxxxxxxxx
[root@node4 ~]# kafka-console-consumer.sh --topic topic_sink --bootstrap-server node3:9092,node4:9092 --property print.key=true
node3上启动的nc命令后输出内容
xxxxxxxxxx
[root@node3 ~]# nc -lk 8888
a b c d a
a d b d c
a b c d a
node4上查询消费者输出
xxxxxxxxxx
[root@node4 ~]# kafka-console-consumer.sh --topic topic_sink --bootstrap-server node3:9092,node4:9092 --property print.key=true
......
a 4
b 3
c 3
a 5
d 4