2012-09-05 00:16:23 +00:00
|
|
|
==========================
|
|
|
|
Adding/Removing Monitors
|
|
|
|
==========================
|
|
|
|
|
|
|
|
When you have a cluster up and running, you may add or remove monitors
|
|
|
|
from the cluster at runtime.
|
|
|
|
|
|
|
|
Adding Monitors
|
|
|
|
===============
|
|
|
|
|
|
|
|
Ceph monitors are light-weight processes that maintain a master copy of the
|
|
|
|
cluster map. You can run a cluster with 1 monitor. We recommend at least 3
|
|
|
|
monitors for a production cluster. Ceph monitors use PAXOS to establish
|
2012-11-08 19:59:15 +00:00
|
|
|
consensus about the master cluster map, which requires a majority of
|
|
|
|
monitors running to establish a quorum for consensus about the cluster map
|
|
|
|
(e.g., 1; 3 out of 5; 4 out of 6; etc.).
|
2012-09-05 00:16:23 +00:00
|
|
|
|
|
|
|
Since monitors are light-weight, it is possible to run them on the same
|
|
|
|
host as an OSD; however, we recommend running them on separate hosts.
|
|
|
|
|
2012-11-08 19:59:15 +00:00
|
|
|
.. important:: A *majority* of monitors in your cluster must be able to
|
|
|
|
reach each other in order to establish a quorum.
|
2012-09-05 00:16:23 +00:00
|
|
|
|
|
|
|
Deploy your Hardware
|
|
|
|
--------------------
|
|
|
|
|
2012-11-08 19:59:15 +00:00
|
|
|
If you are adding a new host when adding a new monitor, see `Hardware
|
|
|
|
Recommendations`_ for details on minimum recommendations for monitor hardware.
|
|
|
|
To add a monitor host to your cluster, first make sure you have an up-to-date
|
|
|
|
version of Linux installed (typically Ubuntu 12.04 precise).
|
2012-09-05 00:16:23 +00:00
|
|
|
|
|
|
|
Add your monitor host to a rack in your cluster, connect it to the network
|
|
|
|
and ensure that it has network connectivity.
|
|
|
|
|
|
|
|
.. _Hardware Recommendations: ../../install/hardware-recommendations
|
|
|
|
|
|
|
|
Install the Required Software
|
|
|
|
-----------------------------
|
|
|
|
|
|
|
|
For manually deployed clusters, you must install Ceph packages
|
|
|
|
manually. See `Installing Debian/Ubuntu Packages`_ for details.
|
|
|
|
You should configure SSH to a user with password-less authentication
|
|
|
|
and root permissions.
|
|
|
|
|
|
|
|
.. _Installing Debian/Ubuntu Packages: ../../install/debian
|
|
|
|
|
|
|
|
For clusters deployed with Chef, create a `chef user`_, `configure
|
|
|
|
SSH keys`_, `install Ruby`_ and `install the Chef client`_ on your host. See
|
|
|
|
`Installing Chef`_ for details.
|
|
|
|
|
|
|
|
.. _chef user: ../../install/chef#createuser
|
|
|
|
.. _configure SSH keys: ../../install/chef#genkeys
|
|
|
|
.. _install the Chef client: ../../install/chef#installchef
|
|
|
|
.. _Installing Chef: ../../install/chef
|
|
|
|
.. _install Ruby: ../../install/chef#installruby
|
|
|
|
|
|
|
|
.. _adding-mon:
|
|
|
|
|
|
|
|
Adding a Monitor (Manual)
|
|
|
|
-------------------------
|
|
|
|
|
|
|
|
This procedure creates a ``ceph-mon`` data directory, retrieves the monitor map
|
2012-11-08 19:59:15 +00:00
|
|
|
and monitor keyring, and adds a ``ceph-mon`` daemon to your cluster. If
|
|
|
|
this results in only two monitor daemons, you may add more monitors by
|
|
|
|
repeating this procedure until you have a sufficient number of ``ceph-mon``
|
|
|
|
daemons to achieve a quorum.
|
2012-09-05 00:16:23 +00:00
|
|
|
|
2012-12-19 16:48:37 +00:00
|
|
|
At this point you should define your monitor's id. Traditionally, monitors
|
|
|
|
have been named with single letters (``a``, ``b``, ``c``, ...), but you are
|
|
|
|
free to define the id as you see fit. For the purpose of this document,
|
|
|
|
please take into account that ``{mon-id}`` should be the id you chose,
|
|
|
|
without the ``mon.`` prefix (i.e., ``{mon-id}`` should be the ``a``
|
|
|
|
on ``mon.a``).
|
|
|
|
|
2012-09-05 00:16:23 +00:00
|
|
|
#. Create the default directory on your new monitor. ::
|
|
|
|
|
|
|
|
ssh {new-mon-host}
|
2012-12-19 16:48:37 +00:00
|
|
|
sudo mkdir /var/lib/ceph/mon/ceph-{mon-id}
|
2012-09-05 00:16:23 +00:00
|
|
|
|
2012-11-09 03:14:36 +00:00
|
|
|
#. Create a temporary directory ``{tmp}`` to keep the files needed during
|
|
|
|
this process. This directory should be different from monitor's default
|
|
|
|
directory created in the previous step, and can be removed after all the
|
2012-11-09 17:18:19 +00:00
|
|
|
steps are taken. ::
|
2012-11-09 03:14:36 +00:00
|
|
|
|
2012-11-09 17:18:19 +00:00
|
|
|
mkdir {tmp}
|
2012-11-09 03:14:36 +00:00
|
|
|
|
|
|
|
#. Retrieve the keyring for your monitors, where ``{tmp}`` is the path to
|
2012-09-05 00:16:23 +00:00
|
|
|
the retrieved keyring, and ``{filename}`` is the name of the file containing
|
|
|
|
the retrieved monitor key. ::
|
|
|
|
|
2012-11-09 03:14:36 +00:00
|
|
|
ceph auth get mon. -o {tmp}/{filename}
|
2012-09-05 00:16:23 +00:00
|
|
|
|
2012-11-09 03:14:36 +00:00
|
|
|
#. Retrieve the monitor map, where ``{tmp}`` is the path to
|
|
|
|
the retrieved monitor map, and ``{filename}`` is the name of the file
|
|
|
|
containing the retrieved monitor monitor map. ::
|
2012-09-05 00:16:23 +00:00
|
|
|
|
2012-11-09 03:14:36 +00:00
|
|
|
ceph mon getmap -o {tmp}/{filename}
|
2012-09-05 00:16:23 +00:00
|
|
|
|
2012-11-09 03:14:36 +00:00
|
|
|
#. 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::
|
2012-09-05 00:16:23 +00:00
|
|
|
|
2012-12-19 16:48:37 +00:00
|
|
|
sudo ceph-mon -i {mon-id} --mkfs --monmap {tmp}/{filename} --keyring {tmp}/{filename}
|
2012-09-05 00:16:23 +00:00
|
|
|
|
|
|
|
|
2012-12-19 16:48:37 +00:00
|
|
|
#. Add a ``[mon.{mon-id}]`` entry for your new monitor in your ``ceph.conf`` file. ::
|
2012-09-05 00:16:23 +00:00
|
|
|
|
|
|
|
[mon.c]
|
|
|
|
host = new-mon-host
|
|
|
|
addr = ip-addr:6789
|
|
|
|
|
|
|
|
#. Add the new monitor to the list of monitors for you cluster (runtime). This enables
|
|
|
|
other nodes to use this monitor during their initial startup. ::
|
|
|
|
|
2012-12-19 16:48:37 +00:00
|
|
|
ceph mon add <mon-id> <ip>[:<port>]
|
2012-09-05 00:16:23 +00:00
|
|
|
|
|
|
|
#. Start the new monitor and it will automatically join the cluster.
|
|
|
|
The daemon needs to know which address to bind to, either via
|
|
|
|
``--public-addr {ip:port}`` or by setting ``mon addr`` in the
|
|
|
|
appropriate section of ``ceph.conf``. For example::
|
|
|
|
|
2012-12-19 16:48:37 +00:00
|
|
|
ceph-mon -i {mon-id} --public-addr {ip:port}
|
2012-09-05 00:16:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
Removing Monitors
|
|
|
|
=================
|
|
|
|
|
2012-11-08 19:59:15 +00:00
|
|
|
When you remove monitors from a cluster, consider that Ceph monitors use
|
|
|
|
PAXOS to establish consensus about the master cluster map. You must have
|
|
|
|
a sufficient number of monitors to establish a quorum for consensus about
|
|
|
|
the cluster map.
|
2012-09-05 00:16:23 +00:00
|
|
|
|
|
|
|
Removing a Monitor (Manual)
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
This procedure removes a ``ceph-mon`` daemon from your cluster. If this
|
2012-11-08 19:59:15 +00:00
|
|
|
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.
|
2012-09-05 00:16:23 +00:00
|
|
|
|
|
|
|
#. Stop the monitor. ::
|
|
|
|
|
2012-12-19 16:48:37 +00:00
|
|
|
service ceph -a stop mon.{mon-id}
|
2012-09-05 00:16:23 +00:00
|
|
|
|
|
|
|
#. Remove the monitor from the cluster. ::
|
|
|
|
|
2012-12-19 16:48:37 +00:00
|
|
|
ceph mon remove {mon-id}
|
2012-09-05 00:16:23 +00:00
|
|
|
|
|
|
|
#. Remove the monitor entry from ``ceph.conf``.
|
|
|
|
|
|
|
|
|
|
|
|
Removing Monitors from an Unhealthy Cluster
|
|
|
|
-------------------------------------------
|
|
|
|
|
|
|
|
This procedure removes a ``ceph-mon`` daemon from an unhealhty cluster--i.e.,
|
|
|
|
a cluster that has placement groups that are persistently not ``active + clean``.
|
|
|
|
|
|
|
|
|
|
|
|
#. Identify a surviving monitor. ::
|
|
|
|
|
|
|
|
ceph mon dump
|
|
|
|
|
|
|
|
#. Navigate to a surviving monitor's ``monmap`` directory. ::
|
|
|
|
|
|
|
|
ssh {mon-host}
|
2012-12-19 16:48:37 +00:00
|
|
|
cd /var/lib/ceph/mon/ceph-{mon-id}/monmap
|
2012-09-05 00:16:23 +00:00
|
|
|
|
|
|
|
#. List the directory contents and identify the last commmitted map.
|
|
|
|
Directory contents will show a numeric list of maps. ::
|
|
|
|
|
|
|
|
ls
|
|
|
|
1 2 3 4 5 first_committed last_committed last_pn latest
|
|
|
|
|
|
|
|
|
|
|
|
#. Identify the most recently committed map. ::
|
|
|
|
|
|
|
|
sudo cat last_committed
|
|
|
|
|
|
|
|
#. Copy the most recently committed file to a temporary directory. ::
|
|
|
|
|
2012-12-19 16:48:37 +00:00
|
|
|
cp /var/lib/ceph/mon/ceph-{mon-id}/monmap/{last_committed} /tmp/surviving_map
|
2012-09-05 00:16:23 +00:00
|
|
|
|
|
|
|
#. Remove the non-surviving 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::
|
|
|
|
|
2012-12-19 16:48:37 +00:00
|
|
|
monmaptool /tmp/surviving_map --rm {mon-id}
|
2012-09-05 00:16:23 +00:00
|
|
|
#for example
|
|
|
|
monmaptool /tmp/surviving_map --rm b
|
|
|
|
monmaptool /tmp/surviving_map --rm c
|
|
|
|
|
|
|
|
#. Stop all monitors. ::
|
|
|
|
|
|
|
|
service ceph -a stop mon
|
|
|
|
|
|
|
|
#. Inject the surviving map with the removed monitors into the surviving monitors.
|
|
|
|
For example, to inject a map into monitor ``mon.a``, follow the example below::
|
|
|
|
|
2012-12-19 16:48:37 +00:00
|
|
|
ceph-mon -i {mon-id} --inject-monmap {map-path}
|
2012-09-05 00:16:23 +00:00
|
|
|
#for example
|
|
|
|
ceph-mon -i a --inject-monmap /etc/surviving_map
|