问题描述
kafka 和 confluent 包的初学者.我想启动多个代理以便使用该主题.可以通过此设置完成 -{'bootstrap.server' : 'ip:your_host,...',}
Beginner in kafka and confluent package.I want to start multiple brokers so as to consume the topic.It can be done via this setting - {'bootstrap.server' : 'ip:your_host,...',}
这个设置可以在服务器配置文件中定义,也可以在脚本中定义.
This setting can be defined in the server config file or else in the script as well.
但是我该如何运行这些呢?如果我只是向引导服务器添加多个端点,则会出现以下错误:
But how shall I run those?. If I just add multiple end points to the bootstrap servers, it gives this error:
java.lang.IllegalArgumentException:要求失败:每个监听器必须有不同的名称,监听器:PLAINTEXT://:9092, PLAINTEXT://:9093
推荐答案
cp config/server.properties config/server-1.properties
cp config/server.properties config/server-2.properties
config/server-1.properties:
config/server-1.properties:
broker.id=1
listeners=PLAINTEXT://:9093
log.dirs=/tmp/kafka-logs-1
config/server-2.properties:
config/server-2.properties:
broker.id=2
listeners=PLAINTEXT://:9094
log.dirs=/tmp/kafka-logs-2
参考:kafka_quickstart_multibroker
这篇关于在 kafka 中启动多个代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!