From 18062fa3042f2719e82ea2b6251fc608dfba3d9e Mon Sep 17 00:00:00 2001 From: Zac Dover Date: Mon, 21 Nov 2022 14:28:46 +1000 Subject: [PATCH] doc/rados: add prompts to add-or-rm-prompts.rst Add unselectable prompts to add-or-rm-prompts.rst. This commit covers the first 300 lines of the file. This is part 1 of 2. Signed-off-by: Zac Dover (cherry picked from commit 6f4b64df349320a3c4cf7bf355c646f6b458525f) --- doc/rados/operations/add-or-rm-mons.rst | 105 ++++++++++++++++-------- 1 file changed, 72 insertions(+), 33 deletions(-) diff --git a/doc/rados/operations/add-or-rm-mons.rst b/doc/rados/operations/add-or-rm-mons.rst index 124076d6e4aee..ae4742d1d2767 100644 --- a/doc/rados/operations/add-or-rm-mons.rst +++ b/doc/rados/operations/add-or-rm-mons.rst @@ -95,7 +95,9 @@ without the ``mon.`` prefix (i.e., ``{mon-id}`` should be the ``a`` 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} @@ -103,36 +105,46 @@ on ``mon.a``). #. 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: @@ -154,13 +166,17 @@ procedure results in only two monitor daemons, you may add or remove another 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``. @@ -174,38 +190,61 @@ cluster, for example a cluster where the monitors cannot form a 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. -- 2.39.5