How does the `--join` option process DNS records with multiple IP addresses

Hi all,

I asked this question on Slack and was encouraged to ask on the forum as well.

Does the --join option process the hostname and use all the IP addresses returned?

e.g. resolves to,, , if is specified in the --join flag, will CockroachDB use only the first IP address or will it use all provided IP addresses?

I took a look at the source code and it looks like it only uses the first IP address, but I don’t have experience with Go so I could be wrong.


Hi Stefan,
thanks for your question.
When there are multiple A records for a name in --join, the behavior might be what you want but we did not intended it to be—i.e., if it works the way you want, it’d be an unsupported happy accident and be suboptimal.

Before I go into details, note that CockroachDB does support something like what you want, via SRV records. When the flag --experimental-dns-srv is specified, CockroachDB will first perform a SRV lookup on each value in the --join flag. If multiple SRV records are found, all of them are used side-by-side as if they had been specified one by one in the --join flag. This is closer to what you’d like.

Internally, CockroachDB will consider a name with multiple A/AAAA records to be just 1 peer address. The moment that peer address is considered, CockroachDB will perform a DNS lookup and use the first address returned, which depending on your DNS implementation could be randomized by the DNS server (this is why I mentioned it could do something like what you want as a happy accident). However, because it’s considered internally as just 1 peer address, it does not increase the ability of the gossip protocol to discover multiple nodes.

If you’d like us to consider expanding multiple A (or AAAA) records like we do for SRV, please file an issue on github and tag me (@knz). I’ll route it appropriately.