https://blog.csdn.net/weixin_44039105/article/details/129240685?spm=1001.2014.3001.5502
https://blog.csdn.net/weixin_44039105/article/details/88045932?spm=1001.2014.3001.5502
https://kafka.apache.org/downloads

rz命令上传(如果不能用rz命令上传,安装一下rz命令 :yum install lrzsz)
tar -zxvf 压缩包名
进入到config文件夹里面,找到server.properties文件,找到log.dirs,把位置设置自己能找到的地方即可
进入到config文件夹里面,找到zookeeper.properties文件,找到dataDir,同上
启动kafka的前提是启动zookeeper
将目录切换到和bin文件夹同级进行运行命令
#1.启动zookeeper(需要单独窗口运行)
./bin/zookeeper-server-start.sh ./config/zookeeper.properties
#2.启动kafka(需要单独窗口运行)
./bin/kafka-server-start.sh ./config/server.properties
#3.新建topic testTopic
./bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic testTopic
#4.查看所有topic
./bin/kafka-topics.sh --list --bootstrap-server localhost:9092
#5.启动生产者 testTopic(单独窗口运行)
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testTopic
#6.启动消费者 testTopic(单独窗口运行)
./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic testTopic --from-beginningconfig 中server.properties文件
#listeners=PLAINTEXT://:9092 (配置内网)
listeners=PLAINTEXT://192.168.1.23:9092
#advertised.listeners=PLAINTEXT://your.host.name:9092 (配置外网)
advertised.listeners=PLAINTEXT://10.32.2.34:9092
外网即可访问成功
上一篇:(十六)风险管理规范