版本:kafka_2.11-2.1.1
下载地址:http://mirrors.hust.edu.cn/apache/kafka/2.1.1/kafka_2.11-2.1.1.tgz
准备:zookeeper已经启动好伪集群
1.修改server.properties文件
broker.id=1
listeners=PLAINTEXT://127.0.0.1:9092
log.dirs=/usr/local/kafka1/kafka-logs
zookeeper.connect=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183
broker.id=2
listeners=PLAINTEXT://127.0.0.1:9093
log.dirs=/usr/local/kafka2/kafka-logs
zookeeper.connect=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183
broker.id=3
listeners=PLAINTEXT://127.0.0.1:90924
log.dirs=/usr/local/kafka3/kafka-logs
zookeeper.connect=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183
2.启动方式
进入kafka文件夹下运行此命令
./bin/kafka-server-start.sh ./config/server.properties
如果后台运行,就运行下面命令
nohup ./bin/kafka-server-start.sh ./config/server.properties &
3.我遇到的错误
(1)A Kafka instance in another process or thread is using this directory.
只需删除目录/ 你的地址 / kafka-logs,然后重试
(2)Unable to parse PLAINTEXT:/127.0.0.1/:9094 to a broker endpoint
config中的配置文件写错了