-RFC: srv records for zookeeper
Warren Turkal 2011-09-14, 16:32
I have an interest in using srv records to allow the discovery of the port
of the zookeeper in addition to the address. I have prototyped some code for
the java client lib in Java JNDI (to avoid extra deps), but I was wondering
if others were also interested in this functionality.
To be more concrete, I want to have the following records in my DNS:
zookeeper A 10.10.10.11
zookeeper A 10.10.10.12
zookeeper A 10.10.10.13
zookeeper A 10.10.10.14
zookeeper A 10.10.10.15
_zookeeper._tcp SRV 0 5 5555 zookeeper
I then want to be able to specify "dc.prod.example.com" as my zookeeper
"realm" (or maybe "domain") and have it discover the server and port for the
zookeeper service. Basically, it will look up the SRV record by prefixing
"_zookeeper._tcp" to the realm (i.e. "_zookeeper._tcp.dc.prod.example.com"
in this example). Presuming there is a SRV record, it can discover the port
and lookup A records for the target identified ("
zookeeper.dc.prod.example.com" in this example). For the record, I don't
think it's okay for SRV records to be IP addresses, so there should always
be a resolution of the name identified. If it were to run on different ports
of different machines, there could be multiple SRV records, like so:
zookeeper-5551 A 10.10.10.11
zookeeper-5552 A 10.10.10.12
zookeeper-5553 A 10.10.10.13
zookeeper-5554 A 10.10.10.14
zookeeper-5554 A 10.10.10.15
_zookeeper._tcp SRV 0 5 5551 zookeeper-5551
_zookeeper._tcp SRV 0 5 5552 zookeeper-5552
_zookeeper._tcp SRV 0 5 5553 zookeeper-5553
_zookeeper._tcp SRV 0 5 5554 zookeeper-5554
Of course, if there is no SRV record, it would fallback on the current
behavior of resolving the A record with the default port of 2181.
Anyone have any interest or opposition to this feature?
If there is sufficient interest, I can probably get it working pretty
quickly for the java client. I don't know what it would take to get the C
client lib working, but that would be a goal as well. I presume that getting
the C lib working would also bring in the other client lib bindings.