]> git.proxmox.com Git - ceph.git/blame - ceph/doc/rados/configuration/mon-lookup-dns.rst
update ceph source to reef 18.2.0
[ceph.git] / ceph / doc / rados / configuration / mon-lookup-dns.rst
CommitLineData
05a536ef
TL
1.. _mon-dns-lookup:
2
7c673cae 3===============================
9f95a23c 4Looking up Monitors through DNS
7c673cae
FG
5===============================
6
1e59de90
TL
7Since Ceph version 11.0.0 (Kraken), RADOS has supported looking up monitors
8through DNS.
7c673cae 9
1e59de90
TL
10The addition of the ability to look up monitors through DNS means that daemons
11and clients do not require a *mon host* configuration directive in their
12``ceph.conf`` configuration file.
7c673cae 13
1e59de90
TL
14With a DNS update, clients and daemons can be made aware of changes
15in the monitor topology. To be more precise and technical, clients look up the
16monitors by using ``DNS SRV TCP`` records.
7c673cae 17
1e59de90
TL
18By default, clients and daemons look for the TCP service called *ceph-mon*,
19which is configured by the *mon_dns_srv_name* configuration directive.
7c673cae 20
31f18b77 21
20effc67 22.. confval:: mon_dns_srv_name
31f18b77 23
7c673cae
FG
24Example
25-------
26When the DNS search domain is set to *example.com* a DNS zone file might contain the following elements.
27
28First, create records for the Monitors, either IPv4 (A) or IPv6 (AAAA).
29
30::
31
32 mon1.example.com. AAAA 2001:db8::100
33 mon2.example.com. AAAA 2001:db8::200
34 mon3.example.com. AAAA 2001:db8::300
35
36::
37
38 mon1.example.com. A 192.168.0.1
39 mon2.example.com. A 192.168.0.2
40 mon3.example.com. A 192.168.0.3
41
42
43With those records now existing we can create the SRV TCP records with the name *ceph-mon* pointing to the three Monitors.
44
45::
46
9f95a23c
TL
47 _ceph-mon._tcp.example.com. 60 IN SRV 10 20 6789 mon1.example.com.
48 _ceph-mon._tcp.example.com. 60 IN SRV 10 30 6789 mon2.example.com.
49 _ceph-mon._tcp.example.com. 60 IN SRV 20 50 6789 mon3.example.com.
7c673cae 50
9f95a23c 51Now all Monitors are running on port *6789*, with priorities 10, 10, 20 and weights 20, 30, 50 respectively.
7c673cae 52
9f95a23c
TL
53Monitor clients choose monitor by referencing the SRV records. If a cluster has multiple Monitor SRV records
54with the same priority value, clients and daemons will load balance the connections to Monitors in proportion
55to the values of the SRV weight fields.
56
57For the above example, this will result in approximate 40% of the clients and daemons connecting to mon1,
5860% of them connecting to mon2. However, if neither of them is reachable, then mon3 will be reconsidered as a fallback.