Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Zookeeper >> mail # dev >> RFC: srv records for zookeeper

Copy link to this message
RFC: srv records for zookeeper
Hi everyone,

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:
$ORIGIN dc.prod.example.com
zookeeper        A
zookeeper        A
zookeeper        A
zookeeper        A
zookeeper        A
_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:
$ORIGIN dc.prod.example.com
zookeeper-5551   A
zookeeper-5552   A
zookeeper-5553   A
zookeeper-5554   A
zookeeper-5554   A
_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.