on ``mon.a``).
#. Create the default directory on the machine that will host your
- new monitor. ::
+ new monitor:
+
+ .. prompt:: bash $
ssh {new-mon-host}
sudo mkdir /var/lib/ceph/mon/ceph-{mon-id}
#. Create a temporary directory ``{tmp}`` to keep the files needed during
this process. This directory should be different from the monitor's default
directory created in the previous step, and can be removed after all the
- steps are executed. ::
+ steps are executed:
+
+ .. prompt:: bash $
mkdir {tmp}
#. Retrieve the keyring for your monitors, where ``{tmp}`` is the path to
the retrieved keyring, and ``{key-filename}`` is the name of the file
- containing the retrieved monitor key. ::
+ containing the retrieved monitor key:
+
+ .. prompt:: bash $
- ceph auth get mon. -o {tmp}/{key-filename}
+ ceph auth get mon. -o {tmp}/{key-filename}
#. Retrieve the monitor map, where ``{tmp}`` is the path to
the retrieved monitor map, and ``{map-filename}`` is the name of the file
- containing the retrieved monitor map. ::
+ containing the retrieved monitor map:
+
+ .. prompt:: bash $
- ceph mon getmap -o {tmp}/{map-filename}
+ ceph mon getmap -o {tmp}/{map-filename}
#. Prepare the monitor's data directory created in the first step. You must
specify the path to the monitor map so that you can retrieve the
information about a quorum of monitors and their ``fsid``. You must also
- specify a path to the monitor keyring::
+ specify a path to the monitor keyring:
+
+ .. prompt:: bash $
- sudo ceph-mon -i {mon-id} --mkfs --monmap {tmp}/{map-filename} --keyring {tmp}/{key-filename}
+ sudo ceph-mon -i {mon-id} --mkfs --monmap {tmp}/{map-filename} --keyring {tmp}/{key-filename}
#. Start the new monitor and it will automatically join the cluster.
The daemon needs to know which address to bind to, via either the
``--public-addr {ip}`` or ``--public-network {network}`` argument.
- For example::
+ For example:
+
+ .. prompt:: bash $
- ceph-mon -i {mon-id} --public-addr {ip:port}
+ ceph-mon -i {mon-id} --public-addr {ip:port}
.. _removing-monitors:
monitor until you have a number of ``ceph-mon`` daemons that can achieve a
quorum.
-#. Stop the monitor. ::
+#. Stop the monitor:
+
+ .. prompt:: bash $
- service ceph -a stop mon.{mon-id}
+ service ceph -a stop mon.{mon-id}
-#. Remove the monitor from the cluster. ::
+#. Remove the monitor from the cluster:
- ceph mon remove {mon-id}
+ .. prompt:: bash $
+
+ ceph mon remove {mon-id}
#. Remove the monitor entry from ``ceph.conf``.
quorum.
-#. Stop all ``ceph-mon`` daemons on all monitor hosts. ::
+#. Stop all ``ceph-mon`` daemons on all monitor hosts:
+
+ .. prompt:: bash $
+
+ ssh {mon-host}
+ systemctl stop ceph-mon.target
+
+ Repeat for all monitor hosts.
+
+#. Identify a surviving monitor and log in to that host:
- ssh {mon-host}
- systemctl stop ceph-mon.target
- # and repeat for all mons
+ .. prompt:: bash $
-#. Identify a surviving monitor and log in to that host. ::
+ ssh {mon-host}
- ssh {mon-host}
+#. Extract a copy of the monmap file:
-#. Extract a copy of the monmap file. ::
+ .. prompt:: bash $
- ceph-mon -i {mon-id} --extract-monmap {map-path}
- # in most cases, that's
- ceph-mon -i `hostname` --extract-monmap /tmp/monmap
+ ceph-mon -i {mon-id} --extract-monmap {map-path}
+
+ In most cases, this command will be:
+
+ .. prompt:: bash $
+
+ ceph-mon -i `hostname` --extract-monmap /tmp/monmap
#. Remove the non-surviving or problematic monitors. For example, if
you have three monitors, ``mon.a``, ``mon.b``, and ``mon.c``, where
- only ``mon.a`` will survive, follow the example below::
+ only ``mon.a`` will survive, follow the example below:
+
+ .. prompt:: bash $
+
+ monmaptool {map-path} --rm {mon-id}
+
+ For example,
- monmaptool {map-path} --rm {mon-id}
- # for example,
- monmaptool /tmp/monmap --rm b
- monmaptool /tmp/monmap --rm c
+ .. prompt:: bash $
+
+ monmaptool /tmp/monmap --rm b
+ monmaptool /tmp/monmap --rm c
#. Inject the surviving map with the removed monitors into the
surviving monitor(s). For example, to inject a map into monitor
- ``mon.a``, follow the example below::
+ ``mon.a``, follow the example below:
+
+ .. prompt:: bash $
+
+ ceph-mon -i {mon-id} --inject-monmap {map-path}
+
+ For example:
+
+ .. prompt:: bash $
- ceph-mon -i {mon-id} --inject-monmap {map-path}
- # for example,
- ceph-mon -i a --inject-monmap /tmp/monmap
+ ceph-mon -i a --inject-monmap /tmp/monmap
#. Start only the surviving monitors.