Creating SRV records that point to multiple servers

Hi,
Im trying to create an SRV record (to use with mongo) that points to multiple nodes.
An example could be as follows:

Having these servers:
rs1[.]example[.]com
rs2[.]example[.]com
rs3[.]example[.]com

Create a record that provides an answer like this:

_mongodb._tcp.rs.example.com
Server: X.X.X.X
Address: Y.Y.Y.Y

Non-authoritative answer:
_mongodb[.]_tcp[.]rs[.]example[.]com service = 0 0 27022 rs1[.]example[.]com.
_mongodb[.]_tcp[.]rs[.]example[.]com service = 0 0 27022 rs2[.]example[.]com.
_mongodb[.]_tcp[.]rs[.]example[.]com service = 0 0 27022 rs3[.]example[.]com.

My question is this: when you create the SRV record and fill all the fields, you only have one field for the target, therefore, should we create multiple SRV records with the same name pointing to the different nodes in the target field or should we create just one SRV record and input all the nodes in the same target field?

Thanks! :slightly_smiling_face:

Target only takes one hostname. If you want more than one you will need more than one SRV record.

1 Like

I will create multiple SRV records.

Now i just have to get it to work, i cant seem to resolve them either…

Thanks! :upside_down_face:

Whats the domain and can you post screenshots of what you have configured so far?

So far i’ve created the following SRV records:

;; SRV Records
_mongodb._tcp.rsmongossl-int.idboxrt.com.	1	IN	SRV	20 50 27017 mongossl03-int.idboxrt.com.
_mongodb._tcp.rsmongossl-int.idboxrt.com.	1	IN	SRV	20 50 27017 mongossl02-int.idboxrt.com.
_mongodb._tcp.rsmongossl-int.idboxrt.com.	1	IN	SRV	20 50 27017 mongossl01-int.idboxrt.com.

Where the targets point as follows:

mongossl01-int.idboxrt.com. 1 IN A 10.60.173.29
mongossl02-int.idboxrt.com. 1 IN A 10.60.173.30
mongossl03-int.idboxrt.com. 1 IN A 10.60.173.31

The records seem to resolve fine, however you indicated private IP addresses. Is this on purpose?

Yes, this is a development enviroment :slightly_smiling_face:

In that case everything should work fine. Well, you’ll be able to use these records only on your internal network but thats by design :slight_smile:

If i may ask one more question, how did you test it, i cant seem to resolve it.
Im doing the following:

nslookup

set type=SRV
rsmongossl-int.idboxrt.com
Server: 10.0.1.1
Address: 10.0.1.1#53

Non-authoritative answer:
*** Can’t find rsmongossl-int.idboxrt.com: No answer

Authoritative answers can be found from:

rsmongossl-int.idboxrt.com 8.8.8.8
Server: 10.0.1.1
Address: 10.0.1.1#53

Non-authoritative answer:
*** Can’t find rsmongossl-int.idboxrt.com: No answer

Authoritative answers can be found from:

rsmongossl-int.idboxrt.com 1.1.1.1
Server: 10.0.1.1
Address: 10.0.1.1#53

Non-authoritative answer:
*** Can’t find rsmongossl-int.idboxrt.com: No answer

Authoritative answers can be found from:

You will have to resolve _mongodb._tcp.rsmongossl-int.idboxrt.com.

$ dig @cruz.ns.cloudflare.com _mongodb._tcp.rsmongossl-int.idboxrt.com SRV

;; QUESTION SECTION:
;_mongodb._tcp.rsmongossl-int.idboxrt.com. IN SRV

;; ANSWER SECTION:
_mongodb._tcp.rsmongossl-int.idboxrt.com. 300 IN SRV 20 50 27017 mongossl02-int.idboxrt.com.
_mongodb._tcp.rsmongossl-int.idboxrt.com. 300 IN SRV 20 50 27017 mongossl03-int.idboxrt.com.
_mongodb._tcp.rsmongossl-int.idboxrt.com. 300 IN SRV 20 50 27017 mongossl01-int.idboxrt.com.
1 Like

Success!
Thank you so much!!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.