5Centos7 安装Kafka · SpringCloud微服务实战 · 看云
导航
1. 下载压缩包, 复制到固定目录并解压
到官网下载压缩包
wget https://www.apache.org/dyn/closer.cgi?path=/kafka/1.1.1/kafka_2.11-1.1.1.tgz
mkdir -p /usr/local/kafka
cp kafka_2.11-1.1.1.tgz /usr/local/kafka
tar -zxvf kafka_2.11-1.1.1.tgz
2. 修改配置文件
vim /usr/local/kafka/kafka_2.11-1.1.1/config/server.properties修改参数
zookeeper.connect=ip:2181
listeners=PLAINTEXT://:9092
advertised.listeners=PLAINTEXT://ip:9092 #本机ip
# ...
3. 启动server
- start脚本
# bin/kafka-server-start.sh -daemon config/server.properties &
- 查看所有topic
# bin/kafka-topics.sh --list --zookeeper ip:2181
- 查看指定topic 下面的数据
# bin/kafka-console-consumer.sh --bootstrap-server ip:9092 --from-beginning --topic example