ubuntu 安装kafka

下载

wget http://mirrors.hust.edu.cn/apache/kafka/2.0.0/kafka_2.12-2.0.0.tgz

解压

tar -zxf kafka_2.12-2.0.0.tgz

启动zookeeper

bin/zookeeper-server-start.sh config/zookeeper.properties &

启动kafka

bin/kafka-server-start.sh config/server.properties &

测试是否安装成功

启动生产者

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

启动消费者

(低版本)

bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning

(高版本)

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

开启远程访问:

vim config/server.properties

listeners=PLAINTEXT://:9092

advertised.listeners=PLAINTEXT://your.host.name:9092

原文地址:https://www.cnblogs.com/myDreamWillCometrue/p/9776420.html