安装 Kafka 服务
直接到 kafka 官网 , 下载最新的
wget https://mirror.bit.edu.cn/apache/kafka/2.5.0/kafka_2.13-2.5.0.tgz
解压,进入目录
tar -zxvf kafka_2.13-2.5.0.tgz
cd kafka_2.13-2.5.0
启动 Kafka 服务
使用安装包中的脚本启动单节点 Zookeeper 实例
bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
使用 kafka-server-start.sh 启动 kafka 服务
bin/kafka-server-start.sh config/server.properties
创建 topic
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
查看 topic 列表,检查是否创建成功
bin/kafka-topics.sh --list --zookeeper localhost:2181
$ test
生产者,发送消息
bin/kafka-console-producer.sh --broker-list 127.0.0.1:9092 --topic test
服务方面到这里就差不多了,接下来就是 php