Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run two instances of schema registry

I am trying to run Kafka in cluster mode using two instances of schema registry but I am not quite sure how to configure the second instance so that it takes over in case the first one is down.

Here's the properties file for the first schema-registry instance:

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

How should the second file look like so that they can both communicate with zookeeper and achieve high availability?

like image 271
Giorgos Myrianthous Avatar asked Jan 20 '26 23:01

Giorgos Myrianthous


1 Answers

You can use either the Kafka leader election or Zookeeper leader election.

The only thing you need to change between two instances on the same machine connected to the same Kafka/Zookeeper is the port and listeners property

To appropriately configure high availability, you need a HTTP load balancer for giving one address for all instances.

like image 84
OneCricketeer Avatar answered Jan 23 '26 13:01

OneCricketeer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!