gpt4 book ai didi

apache-kafka - 如何运行模式注册表的两个实例

转载 作者:行者123 更新时间:2023-12-04 04:42:27 26 4
gpt4 key购买 nike

我正在尝试使用模式注册表的两个实例以集群模式运行 Kafka,但我不太确定如何配置第二个实例,以便在第一个实例出现故障时接管。

这是第一个模式注册表实例的属性文件:

port=8081

# The address the socket server listens on.
# FORMAT:
# listeners = listener_name://host_name:port
# EXAMPLE:
# listeners = PLAINTEXT://your.host.name:9092
listeners=http://0.0.0.0:8081

# Zookeeper connection string for the Zookeeper cluster used by your Kafka cluster
# (see zookeeper docs for details).
# This is a comma separated host:port pairs, each corresponding to a zk
# server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002".
kafkastore.connection.url=localhost:2181,localhost:2182,localhost:2183

# Alternatively, Schema Registry can now operate without Zookeeper, handling all coordination via
# Kafka brokers. Use this setting to specify the bootstrap servers for your Kafka cluster and it
# will be used both for selecting the master schema registry instance and for storing the data for
# registered schemas.
# (Note that you cannot mix the two modes; use this mode only on new deployments or by shutting down
# all instances, switching to the new configuration, and then starting the schema registry
# instances again.)
#kafkastore.bootstrap.servers=localhost:9092

# The name of the topic to store schemas in
kafkastore.topic=_schemas

# If true, API requests that fail will include extra debugging information, including stack traces
debug=false

第二个文件应该是什么样子的,这样它们才能与 zookeeper 通信并实现高可用性?

最佳答案

您可以使用 Kafka 领导者选举或 Zookeeper 领导者选举。

在连接到同一个 Kafka/Zookeeper 的同一台机器上的两个实例之间唯一需要更改的是端口和监听器属性

要适本地配置高可用性,您需要一个 HTTP 负载平衡器来为所有实例提供一个地址。

关于apache-kafka - 如何运行模式注册表的两个实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51067971/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com