dns_cluster icon indicating copy to clipboard operation
dns_cluster copied to clipboard

Support SRV records

Open feld opened this issue 2 years ago • 5 comments

Would you be willing to entertain supporting SRV records so hostnames are used for the node connections instead of IP addresses?

There is no use for the priority field in the SRV records but it would be nice if we could automagically leverage the port field. Unfortunately it appears Erlang doesn't allow you to specify the port when making a connection and you need to use ERL_EPMD_PORT environment variable or maybe a vm.args setting to modify it?

feld avatar Nov 02 '23 21:11 feld

Hey I would love to help get this in, as we use this at work. In fact this is the suggested path for Fargate containers (although they also suggest a records).

krainboltgreene avatar Sep 17 '24 16:09 krainboltgreene

This is the payload from a srv record:

{:ok,
 {:hostent, ~c"x.local", [], :srv, 3,
  [
    {1, 1, 4369, ~c"sfasdfsadfaes4f4.x.local"},
    {1, 1, 4369, ~c"3fq32r23fa3fa23f.x.local"},
    {1, 1, 4369, ~c"aw3faw34r234234r.x.local"}
  ]}}

krainboltgreene avatar Sep 17 '24 16:09 krainboltgreene

This looks good to me but we should make the types of queries customizable, with the default of :a or :aaaa. WDYT?

josevalim avatar Jan 24 '25 15:01 josevalim

Personally that makes sense to me, as an future end-user of this API.

krainboltgreene avatar Jan 26 '25 20:01 krainboltgreene

In case @feld does not have time to update this (which is very understandable since it took us forever to reply), someone else is welcome to send a PR on top with the changes proposed above. :)

josevalim avatar Feb 18 '25 18:02 josevalim