I use to configure bootstrap.servers
in my kafka producer/consumer/stream apps with a list of broker ips. But I’d like to move to a single url entry that will be resolved by the DNS lookup to a broker ip currently known as up (DNS actively check the brokers in the cluster and responds to lookup with an IP short TTL [10s]). This gives me more flexibility to add brokers in the future, and I can keep the same config in my apps across all the environments/stages. Is this a recommended approach, or this remove resiliency on the client side to not have a strict list of brokers? I assume this config would only be used to initially “discover” the cluster and the partition leader brokers.
0
votes
1 Answers
0
votes
If anything, I'd say this adds a single point of failure on the single address you're providing, unless it's actually a load balanced, reverse proxy.
Another possibility that's worked somewhat well internally is using Consul service discovery, with Consul agents running on each broker. This way, you can do service discovery as well as health checks and easier monitoring setup, e.g. having Prometheus jmx_exporter
on the brokers, and Prometheus Server scraping those values for all kafka.service.consul
addresses
bootstrap.server
config is, to be resilient to broker outages by providing at least 3 broker URLs -- it's very unlikely, that all three brokers won't be available at the same time. If you want more resilience, you can also go with more brokers in the list. This avoid the necessity of the DNS service. It's your personal decision I guess. – Matthias J. Sax