5 .. _deploy_additional_monitors:
7 Deploying additional monitors
8 -----------------------------
10 A typical Ceph cluster has three or five monitor daemons that are spread
11 across different hosts. We recommend deploying five monitors if there are
12 five or more nodes in your cluster.
14 .. _CIDR: https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation
16 Ceph deploys monitor daemons automatically as the cluster grows and Ceph
17 scales back monitor daemons automatically as the cluster shrinks. The
18 smooth execution of this automatic growing and shrinking depends upon
19 proper subnet configuration.
21 The cephadm bootstrap procedure assigns the first monitor daemon in the
22 cluster to a particular subnet. ``cephadm`` designates that subnet as the
23 default subnet of the cluster. New monitor daemons will be assigned by
24 default to that subnet unless cephadm is instructed to do otherwise.
26 If all of the ceph monitor daemons in your cluster are in the same subnet,
27 manual administration of the ceph monitor daemons is not necessary.
28 ``cephadm`` will automatically add up to five monitors to the subnet, as
29 needed, as new hosts are added to the cluster.
31 Designating a Particular Subnet for Monitors
32 --------------------------------------------
34 To designate a particular IP subnet for use by ceph monitor daemons, use a
35 command of the following form, including the subnet's address in `CIDR`_
36 format (e.g., ``10.1.2.0/24``):
40 ceph config set mon public_network *<mon-cidr-network>*
46 ceph config set mon public_network 10.1.2.0/24
48 Cephadm deploys new monitor daemons only on hosts that have IP addresses in
49 the designated subnet.
51 Changing the number of monitors from the default
52 ------------------------------------------------
54 If you want to adjust the default of 5 monitors, run this command:
58 ceph orch apply mon *<number-of-monitors>*
60 Deploying monitors only to specific hosts
61 -----------------------------------------
63 To deploy monitors on a specific set of hosts, run this command:
67 ceph orch apply mon *<host1,host2,host3,...>*
69 Be sure to include the first (bootstrap) host in this list.
74 You can control which hosts the monitors run on by making use of host labels.
75 To set the ``mon`` label to the appropriate hosts, run this command:
79 ceph orch host label add *<hostname>* mon
81 To view the current hosts and labels, run this command:
91 ceph orch host label add host1 mon
92 ceph orch host label add host2 mon
93 ceph orch host label add host3 mon
98 HOST ADDR LABELS STATUS
105 Tell cephadm to deploy monitors based on the label by running this command:
109 ceph orch apply mon label:mon
111 See also :ref:`host labels <orchestrator-host-labels>`.
113 Deploying Monitors on a Particular Network
114 ------------------------------------------
116 You can explicitly specify the IP address or CIDR network for each monitor and
117 control where each monitor is placed. To disable automated monitor deployment,
122 ceph orch apply mon --unmanaged
124 To deploy each additional monitor:
128 ceph orch daemon add mon *<host1:ip-or-network1> [<host1:ip-or-network-2>...]*
130 For example, to deploy a second monitor on ``newhost1`` using an IP
131 address ``10.1.2.123`` and a third monitor on ``newhost2`` in
132 network ``10.1.2.0/24``, run the following commands:
136 ceph orch apply mon --unmanaged
137 ceph orch daemon add mon newhost1:10.1.2.123
138 ceph orch daemon add mon newhost2:10.1.2.0/24
141 The **apply** command can be confusing. For this reason, we recommend using
144 Each ``ceph orch apply mon`` command supersedes the one before it.
145 This means that you must use the proper comma-separated list-based
146 syntax when you want to apply monitors to more than one host.
147 If you do not use the proper syntax, you will clobber your work
154 ceph orch apply mon host1
155 ceph orch apply mon host2
156 ceph orch apply mon host3
158 This results in only one host having a monitor applied to it: host 3.
160 (The first command creates a monitor on host1. Then the second command
161 clobbers the monitor on host1 and creates a monitor on host2. Then the
162 third command clobbers the monitor on host2 and creates a monitor on
163 host3. In this scenario, at this point, there is a monitor ONLY on
166 To make certain that a monitor is applied to each of these three hosts,
167 run a command like this:
171 ceph orch apply mon "host1,host2,host3"
173 There is another way to apply monitors to multiple hosts: a ``yaml`` file
174 can be used. Instead of using the "ceph orch apply mon" commands, run a
175 command of this form:
179 ceph orch apply -i file.yaml
181 Here is a sample **file.yaml** file::