2020-03-15 13:45:46 +00:00
============================
Deploying a new Ceph cluster
============================
2020-03-16 13:12:36 +00:00
Cephadm creates a new Ceph cluster by "bootstrapping" on a single
host, expanding the cluster to encompass any additional hosts, and
then deploying the needed services.
2020-03-15 13:45:46 +00:00
.. highlight :: console
2021-03-23 17:50:33 +00:00
.. _cephadm-host-requirements:
2020-03-15 13:45:46 +00:00
Requirements
============
2021-01-29 19:15:26 +00:00
- Python 3
2020-03-15 13:45:46 +00:00
- Systemd
2020-03-17 13:45:10 +00:00
- Podman or Docker for running containers
2020-03-15 13:45:46 +00:00
- Time synchronization (such as chrony or NTP)
- LVM2 for provisioning storage devices
Any modern Linux distribution should be sufficient. Dependencies
are installed automatically by the bootstrap process below.
2021-03-30 15:31:28 +00:00
See the section :ref:`Compatibility With Podman
Versions<cephadm-compatibility-with-podman>` for a table of Ceph versions that
are compatible with Podman. Not every version of Podman is compatible with
Ceph.
2020-03-17 13:23:26 +00:00
.. _get-cephadm:
2020-03-15 13:45:46 +00:00
2020-03-17 13:45:10 +00:00
Install cephadm
===============
2020-10-28 04:31:41 +00:00
The `` cephadm `` command can
#. bootstrap a new cluster
2021-02-28 12:13:39 +00:00
#. launch a containerized shell with a working Ceph CLI
#. aid in debugging containerized Ceph daemons
2020-03-15 13:45:46 +00:00
2021-02-28 12:13:39 +00:00
There are two ways to install `` cephadm `` :
#. a :ref: `curl-based installation<cephadm_install_curl>` method
#. :ref: `distribution-specific installation methods<cephadm_install_distros>`
.. _cephadm_install_curl:
curl-based installation
-----------------------
2020-03-15 13:45:46 +00:00
2020-03-17 13:45:10 +00:00
* Use `` curl `` to fetch the most recent version of the
2020-10-28 04:31:41 +00:00
standalone script.
.. prompt :: bash #
2021-01-29 19:15:26 +00:00
:substitutions:
2020-10-28 04:31:41 +00:00
2021-01-29 19:15:26 +00:00
curl --silent --remote-name --location https://github.com/ceph/ceph/raw/|stable-release|/src/cephadm/cephadm
2020-10-28 04:31:41 +00:00
Make the `` cephadm `` script executable:
.. prompt :: bash #
2020-03-15 16:10:50 +00:00
2020-10-28 04:31:41 +00:00
chmod +x cephadm
2020-03-15 16:10:50 +00:00
2020-10-28 04:31:41 +00:00
This script can be run directly from the current directory:
2020-03-16 13:12:36 +00:00
2020-10-28 04:31:41 +00:00
.. prompt :: bash #
./cephadm <arguments...>
2020-03-16 13:12:36 +00:00
* Although the standalone script is sufficient to get a cluster started, it is
convenient to have the `` cephadm `` command installed on the host. To install
2021-06-16 14:34:10 +00:00
the packages that provide the `` cephadm `` command, run the following
commands:
2020-10-28 04:31:41 +00:00
.. prompt :: bash #
2021-01-29 19:15:26 +00:00
:substitutions:
2020-10-28 04:31:41 +00:00
2021-01-29 19:15:26 +00:00
./cephadm add-repo --release |stable-release|
./cephadm install
2020-03-15 16:10:50 +00:00
2020-10-28 04:31:41 +00:00
Confirm that `` cephadm `` is now in your PATH by running `` which `` :
2020-03-15 16:10:50 +00:00
2020-10-28 04:31:41 +00:00
.. prompt :: bash #
which cephadm
A successful `` which cephadm `` command will return this:
.. code-block :: bash
/usr/sbin/cephadm
2020-03-15 13:45:46 +00:00
2021-02-28 12:13:39 +00:00
.. _cephadm_install_distros:
distribution-specific installations
-----------------------------------
.. important :: The methods of installing `` cephadm `` in this section are distinct from the curl-based method above. Use either the curl-based method above or one of the methods in this section, but not both the curl-based method and one of these.
Some Linux distributions may already include up-to-date Ceph packages. In
that case, you can install cephadm directly. For example:
2020-03-15 13:45:46 +00:00
2021-02-28 12:13:39 +00:00
In Ubuntu:
2020-10-28 04:31:41 +00:00
.. prompt :: bash #
2021-03-07 03:59:46 +00:00
apt install -y cephadm
2022-02-13 01:05:44 +00:00
In CentOS Stream:
.. prompt :: bash #
:substitutions:
dnf search release-ceph
dnf install --assumeyes centos-release-ceph-|stable-release|
dnf install --assumeyes cephadm
2021-03-07 03:59:46 +00:00
In Fedora:
.. prompt :: bash #
dnf -y install cephadm
2020-03-15 13:45:46 +00:00
2021-02-28 12:13:39 +00:00
In SUSE:
2020-10-28 04:31:41 +00:00
.. prompt :: bash #
zypper install -y cephadm
2020-03-15 13:45:46 +00:00
Bootstrap a new cluster
=======================
2021-03-01 14:01:05 +00:00
What to know before you bootstrap
---------------------------------
The first step in creating a new Ceph cluster is running the `` cephadm
bootstrap`` command on the Ceph cluster's first host. The act of running the
`` cephadm bootstrap `` command on the Ceph cluster's first host creates the Ceph
cluster's first "monitor daemon", and that monitor daemon needs an IP address.
You must pass the IP address of the Ceph cluster's first host to the `` ceph
bootstrap`` command, so you'll need to know the IP address of that host.
.. note :: If there are multiple networks and interfaces, be sure to choose one
that will be accessible by any host accessing the Ceph cluster.
Running the bootstrap command
-----------------------------
2020-03-15 13:45:46 +00:00
2021-01-07 11:06:30 +00:00
Run the `` ceph bootstrap `` command:
2020-10-28 04:31:41 +00:00
.. prompt :: bash #
cephadm bootstrap --mon-ip *<mon-ip>*
2020-03-15 13:45:46 +00:00
2020-03-17 13:45:10 +00:00
This command will:
2020-03-15 13:45:46 +00:00
2020-03-17 13:45:10 +00:00
* Create a monitor and manager daemon for the new cluster on the local
host.
2021-03-01 14:01:05 +00:00
* Generate a new SSH key for the Ceph cluster and add it to the root
2020-03-17 13:45:10 +00:00
user's `` /root/.ssh/authorized_keys `` file.
2021-04-22 17:32:50 +00:00
* Write a copy of the public key to `` /etc/ceph/ceph.pub `` .
2021-03-01 14:01:05 +00:00
* Write a minimal configuration file to `` /etc/ceph/ceph.conf `` . This
file is needed to communicate with the new cluster.
2020-03-17 13:45:10 +00:00
* Write a copy of the `` client.admin `` administrative (privileged!)
secret key to `` /etc/ceph/ceph.client.admin.keyring `` .
2021-04-22 17:32:50 +00:00
* Add the `` _admin `` label to the bootstrap host. By default, any host
with this label will (also) get a copy of `` /etc/ceph/ceph.conf `` and
`` /etc/ceph/ceph.client.admin.keyring `` .
2021-03-01 14:01:05 +00:00
Further information about cephadm bootstrap
-------------------------------------------
The default bootstrap behavior will work for most users. But if you'd like
immediately to know more about `` cephadm bootstrap `` , read the list below.
2020-03-15 13:45:46 +00:00
2021-03-01 14:01:05 +00:00
Also, you can run `` cephadm bootstrap -h `` to see all of `` cephadm `` 's
available options.
2020-03-15 13:45:46 +00:00
2021-07-07 16:14:36 +00:00
* By default, Ceph daemons send their log output to stdout/stderr, which is picked
up by the container runtime (docker or podman) and (on most systems) sent to
journald. If you want Ceph to write traditional log files to `` /var/log/ceph/$fsid `` ,
2021-10-20 14:42:02 +00:00
use the `` --log-to-file `` option during bootstrap.
2021-07-07 16:14:36 +00:00
2021-03-01 14:01:05 +00:00
* Larger Ceph clusters perform better when (external to the Ceph cluster)
public network traffic is separated from (internal to the Ceph cluster)
cluster traffic. The internal cluster traffic handles replication, recovery,
and heartbeats between OSD daemons. You can define the :ref:`cluster
network<cluster-network>` by supplying the ` `--cluster-network` ` option to the ` `bootstrap` `
subcommand. This parameter must define a subnet in CIDR notation (for example
`` 10.90.90.0/24 `` or `` fe80::/64 `` ).
2021-01-14 22:08:48 +00:00
2021-03-01 14:01:05 +00:00
* `` cephadm bootstrap `` writes to `` /etc/ceph `` the files needed to access
the new cluster. This central location makes it possible for Ceph
packages installed on the host (e.g., packages that give access to the
cephadm command line interface) to find these files.
2020-03-16 13:12:36 +00:00
Daemon containers deployed with cephadm, however, do not need
`` /etc/ceph `` at all. Use the `` --output-dir *<directory>* `` option
2021-03-01 14:01:05 +00:00
to put them in a different directory (for example, `` . `` ). This may help
avoid conflicts with an existing Ceph configuration (cephadm or
2020-03-16 13:12:36 +00:00
otherwise) on the same host.
2020-03-15 13:45:46 +00:00
2020-03-15 16:10:50 +00:00
* You can pass any initial Ceph configuration options to the new
cluster by putting them in a standard ini-style configuration file
2021-04-21 17:06:21 +00:00
and using the `` --config *<config-file>* `` option. For example::
$ cat <<EOF > initial-ceph.conf
[global]
osd crush chooseleaf type = 0
EOF
$ ./cephadm bootstrap --config initial-ceph.conf ...
2020-03-15 13:45:46 +00:00
2021-03-01 14:01:05 +00:00
* The `` --ssh-user *<user>* `` option makes it possible to choose which ssh
user cephadm will use to connect to hosts. The associated ssh key will be
added to `` /home/*<user>*/.ssh/authorized_keys `` . The user that you
designate with this option must have passwordless sudo access.
2020-06-11 14:28:44 +00:00
2020-07-10 12:09:39 +00:00
* If you are using a container on an authenticated registry that requires
2021-11-10 16:18:06 +00:00
login, you may add the argument:
2021-03-01 14:01:05 +00:00
2021-11-10 16:18:06 +00:00
* `` --registry-json <path to json file> ``
2021-03-01 14:01:05 +00:00
2021-11-10 16:18:06 +00:00
example contents of JSON file with login info::
2021-03-01 14:01:05 +00:00
2021-11-10 16:18:06 +00:00
{"url":"REGISTRY_URL", "username":"REGISTRY_USERNAME", "password":"REGISTRY_PASSWORD"}
2021-03-01 14:01:05 +00:00
Cephadm will attempt to log in to this registry so it can pull your container
and then store the login info in its config database. Other hosts added to
the cluster will then also be able to make use of the authenticated registry.
2020-03-16 13:12:36 +00:00
2021-10-26 06:46:37 +00:00
* See :ref: `cephadm-deployment-scenarios` for additional examples for using `` cephadm bootstrap `` .
2021-02-15 13:43:31 +00:00
.. _cephadm-enable-cli:
2020-03-17 13:45:10 +00:00
Enable Ceph CLI
===============
2020-03-16 13:12:36 +00:00
2020-03-17 13:45:10 +00:00
Cephadm does not require any Ceph packages to be installed on the
2020-04-27 14:11:56 +00:00
host. However, we recommend enabling easy access to the `` ceph ``
2020-03-17 13:45:10 +00:00
command. There are several ways to do this:
2020-03-16 13:12:36 +00:00
2020-03-17 13:45:10 +00:00
* The `` cephadm shell `` command launches a bash shell in a container
2020-04-24 09:59:21 +00:00
with all of the Ceph packages installed. By default, if
2020-03-17 13:45:10 +00:00
configuration and keyring files are found in `` /etc/ceph `` on the
host, they are passed into the container environment so that the
2020-04-24 09:59:21 +00:00
shell is fully functional. Note that when executed on a MON host,
`` cephadm shell `` will infer the `` config `` from the MON container
2020-04-27 14:11:56 +00:00
instead of using the default configuration. If `` --mount <path> ``
is given, then the host `` <path> `` (file or directory) will appear
2020-10-28 04:31:41 +00:00
under `` /mnt `` inside the container:
.. prompt :: bash #
2020-03-16 13:12:36 +00:00
2020-10-28 04:31:41 +00:00
cephadm shell
2020-03-16 13:12:36 +00:00
2020-10-28 04:31:41 +00:00
* To execute `` ceph `` commands, you can also run commands like this:
2020-03-16 13:12:36 +00:00
2020-10-28 04:31:41 +00:00
.. prompt :: bash #
cephadm shell -- ceph -s
2020-03-16 13:12:36 +00:00
* You can install the `` ceph-common `` package, which contains all of the
ceph commands, including `` ceph `` , `` rbd `` , `` mount.ceph `` (for mounting
2020-10-28 04:31:41 +00:00
CephFS file systems), etc.:
.. prompt :: bash #
2021-01-29 19:15:26 +00:00
:substitutions:
2020-10-28 04:31:41 +00:00
2021-01-29 19:15:26 +00:00
cephadm add-repo --release |stable-release|
cephadm install ceph-common
2020-03-16 13:12:36 +00:00
2020-10-28 04:31:41 +00:00
Confirm that the `` ceph `` command is accessible with:
2020-03-16 13:12:36 +00:00
2020-10-28 04:31:41 +00:00
.. prompt :: bash #
ceph -v
2020-03-16 13:12:36 +00:00
Confirm that the `` ceph `` command can connect to the cluster and also
2020-10-28 04:31:41 +00:00
its status with:
2020-03-15 13:45:46 +00:00
2020-10-28 04:31:41 +00:00
.. prompt :: bash #
ceph status
2020-03-15 13:45:46 +00:00
2021-02-18 12:43:09 +00:00
Adding Hosts
============
2020-03-15 13:45:46 +00:00
2021-02-18 12:43:09 +00:00
Next, add all hosts to the cluster by following :ref: `cephadm-adding-hosts` .
2020-03-15 13:45:46 +00:00
2021-04-22 17:32:50 +00:00
By default, a `` ceph.conf `` file and a copy of the `` client.admin `` keyring
are maintained in `` /etc/ceph `` on all hosts with the `` _admin `` label, which is initially
applied only to the bootstrap host. We usually recommend that one or more other hosts be
given the `` _admin `` label so that the Ceph CLI (e.g., via `` cephadm shell `` ) is easily
accessible on multiple hosts. To add the `` _admin `` label to additional host(s),
.. prompt :: bash #
ceph orch host label add *<host>* _admin
2021-02-18 14:39:59 +00:00
Adding additional MONs
======================
2020-03-15 13:45:46 +00:00
2020-03-17 13:45:10 +00:00
A typical Ceph cluster has three or five monitor daemons spread
across different hosts. We recommend deploying five
2020-03-15 13:45:46 +00:00
monitors if there are five or more nodes in your cluster.
2021-02-18 14:39:59 +00:00
Please follow :ref: `deploy_additional_monitors` to deploy additional MONs.
2020-07-14 13:51:08 +00:00
2021-02-18 13:48:33 +00:00
Adding Storage
==============
2020-03-15 16:10:50 +00:00
2021-02-18 13:48:33 +00:00
To add storage to the cluster, either tell Ceph to consume any
available and unused device:
2020-10-28 04:31:41 +00:00
.. prompt :: bash #
2020-03-15 13:45:46 +00:00
2020-10-28 04:31:41 +00:00
ceph orch apply osd --all-available-devices
2020-03-15 13:45:46 +00:00
2021-11-04 15:49:21 +00:00
See :ref: `cephadm-deploy-osds` for more detailed instructions.
2021-11-16 11:52:20 +00:00
Enabling OSD memory autotuning
------------------------------
2021-12-23 22:16:07 +00:00
.. warning :: By default, cephadm enables `` osd_memory_target_autotune `` on bootstrap, with `` mgr/cephadm/autotune_memory_target_ratio `` set to `` .7 `` of total host memory.
2021-11-16 11:52:20 +00:00
2021-12-23 22:16:07 +00:00
See :ref: `osd_autotune` .
To deploy hyperconverged Ceph with TripleO, please refer to the TripleO documentation: `Scenario: Deploy Hyperconverged Ceph <https://docs.openstack.org/project-deploy-guide/tripleo-docs/latest/features/cephadm.html#scenario-deploy-hyperconverged-ceph> `_
In other cases where the cluster hardware is not exclusively used by Ceph (hyperconverged),
reduce the memory consumption of Ceph like so:
2021-11-16 11:52:20 +00:00
.. prompt :: bash #
# hyperconverged only:
ceph config set mgr mgr/cephadm/autotune_memory_target_ratio 0.2
Then enable memory autotuning:
2021-11-04 15:49:21 +00:00
.. prompt :: bash #
ceph config set osd osd_memory_target_autotune true
2020-03-15 13:45:46 +00:00
2021-02-25 14:14:36 +00:00
Using Ceph
==========
2020-03-15 13:45:46 +00:00
2021-02-25 14:14:36 +00:00
To use the *Ceph Filesystem* , follow :ref: `orchestrator-cli-cephfs` .
2020-03-15 13:45:46 +00:00
2021-02-18 14:17:07 +00:00
To use the *Ceph Object Gateway* , follow :ref: `cephadm-deploy-rgw` .
2020-03-08 23:27:54 +00:00
2021-02-18 16:36:11 +00:00
To use *NFS* , follow :ref: `deploy-cephadm-nfs-ganesha`
2020-04-22 10:38:13 +00:00
2021-02-18 17:07:44 +00:00
To use *iSCSI* , follow :ref: `cephadm-iscsi`
2021-10-26 06:46:37 +00:00
.. _cephadm-deployment-scenarios:
Different deployment scenarios
==============================
Single host
-----------
To configure a Ceph cluster to run on a single host, use the `` --single-host-defaults `` flag when bootstrapping. For use cases of this, see :ref: `one-node-cluster` .
The `` --single-host-defaults `` flag sets the following configuration options::
2022-03-23 09:07:05 +00:00
global/osd_crush_chooseleaf_type = 0
2021-10-26 06:46:37 +00:00
global/osd_pool_default_size = 2
mgr/mgr_standby_modules = False
2022-03-23 09:07:05 +00:00
2021-10-26 06:46:37 +00:00
For more information on these options, see :ref: `one-node-cluster` and `` mgr_standby_modules `` in :ref: `mgr-administrator-guide` .
Deployment in an isolated environment
-------------------------------------
You can install Cephadm in an isolated environment by using a custom container registry. You can either configure Podman or Docker to use an insecure registry, or make the registry secure. Ensure your container image is inside the registry and that you have access to all hosts you wish to add to the cluster.
Run a local container registry:
.. prompt :: bash #
podman run --privileged -d --name registry -p 5000:5000 -v /var/lib/registry:/var/lib/registry --restart=always registry:2
If you are using an insecure registry, configure Podman or Docker with the hostname and port where the registry is running.
.. note :: For every host which accesses the local insecure registry, you will need to repeat this step on the host.
Next, push your container image to your local registry.
Then run bootstrap using the `` --image `` flag with your container image. For example:
.. prompt :: bash #
cephadm --image *<hostname>* :5000/ceph/ceph bootstrap --mon-ip *<mon-ip>*
2021-01-14 22:08:48 +00:00
2022-02-13 01:05:44 +00:00
.. _cluster network: ../rados/configuration/network-config-ref#cluster-network