I am trying to run a second instance for Kafka Rest. Here's the properties file for the first one:
id=kafka-rest-test-server-1
schema.registry.url=http://localhost:8081,http://localhost:9081
zookeeper.connect=localhost:2181,localhost:2182,localhost:2183
bootstrap.servers=PLAINTEXT://localhost:9092,PLAINTEXT://localhost:9093,PLAINTEXT://localhost:9094
According to Confluent's docs:
The only requirement for multiple instances is that you set a unique id for each instance.
However, when I run the second instance with other id
, an exception is thrown mentioning that the address is already in use:
WARN FAILED io.confluent.rest.Application$1@41294f8: java.net.BindException: Address already in use (org.eclipse.jetty.util.component.AbstractLifeCycle:212)
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
...
The ID doesn't control the port. "Multiple instances" in the documentation means independent machines
Just like the Schema Registry, configure the listeners
listeners
Comma-separated list of listeners that listen for API requests over either HTTP or HTTPSDefault: “http://0.0.0.0:8082“
https://docs.confluent.io/current/kafka-rest/docs/config.html#kafkarest-config
port
property is deprecated, but if you're running an old version, wouldn't hurt to set it as well
For example, first instance, leave the defaults
Second instance, use any available port
listeners=http://0.0.0.0:18082
It is generally recommended that you use more than one machine for high availability and distributed processing. Running 3 Zookeepers, 3 Brokers, 2 Registries, and 2 Proxies, you're basically begging to run out of RAM