linux 之centos7安装kafka;;;;;待补充,未完成

centos7安装kafka
安装教程:https://blog.csdn.net/shenyuanhaojie/article/details/121200011

一.安装jdk
rpm -qa | grep java
rpm -qa | grep jdk
rpm -qa | grep gcj
rpm -qa | grep java | xargs rpm -e --nodeps #卸载老版本
yum list java-1.8*
yum install java-1.8.0-openjdk* -y
java -version
#这里为了图方便使用了 yum 安装 JDK

二:安装zookeeper

listeners=PLAINTEXT://47.106.218.60:9092

 

--------看kafka是否启动方式一----------
jps
--------看kafka是否启动方式二---------
netstat -tanlp | egrep "2181|9092"


#####在kafka目录下
#启动kafka
bin/kafka-server-start.sh -daemon config/server.properties &
bin/kafka-server-stop.sh
#启动zookeeper
bin/zookeeper-server-start.sh -daemon config/zookeeper.properties &
bin/zookeeper-server-stop.sh

-----查看topic-----
bin/kafka-topics.sh --zookeeper 127.0.0.1:2181 --list
-----创建topic----
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic mytest

----删除topic----
bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic mytest


-----生产topic-------
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

-----消费topic-------
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning

 

posted @ 2022-05-17 18:42    阅读(27)  评论(0编辑  收藏  举报