Notice
This document is for a development version of Ceph.
Setting Up a Ceph Client Host
A client host needs two files to connect to a Ceph cluster: a minimal configuration file and a keyring. This procedure creates both on a cluster host and copies them to the client host. If cephadm manages the client host, it can keep both files there for you: see Management of Client Keyrings and Configs.
Prerequisites
A running Ceph cluster, and a root shell on a cluster host that holds the configuration file and the
client.adminkeyring. With cephadm, by default, these are the hosts that have the_adminlabel, such as the bootstrap host (see Special Host Labels).The
cephcommand on that host. If it is not installed there, putcephadm shell --before eachcephcommand that you run on that host (see Enable Ceph CLI).The
ceph-commonpackage on the client host. Most client hosts need only this package and its dependencies. It supplies theceph,rados,rbd, andmount.cephcommands, among others. To get it, add the Ceph repository as described in Getting Ceph Packages, then installceph-commonwith the package manager of the client host.Root access on the client host, which the examples call
client1701. The steps copy the files withscpover a root SSH login from the cluster host; you can copy them another way instead.For the example in step 2, the name of a CephFS file system, to use in place of
cephfs1701.ceph fs lslists the file systems of the cluster.
Procedure
On the cluster host, write a minimal configuration file:
ceph config generate-minimal-conf > /root/minimal-ceph.confThe command prints nothing. With
cephadm shell --, cephadm prints lines such asInferring fsidon the terminal; they do not go into the file. The file holds a comment line with the cluster ID and a[global]section with anfsidline and amon_hostline, which tells the client how to reach the Monitors. If the command fails, it prints an error and leaves the file empty: correct the error and run the command again before you go on.Create a CephX user for the client, with the capabilities that the client needs, and write its keyring to a file. Choose a name that no user has yet: if the user exists, the command changes its capabilities. This example creates
client.user1701with read and write access to the file systemcephfs1701:ceph fs authorize cephfs1701 client.user1701 / rw > /root/ceph.client.user1701.keyringThe command prints nothing. The file holds a
[client.user1701]section with akeyline and threecapslines. If the command fails, it prints an error and leaves the file empty: correct the error and run the command again before you go on.Most clusters run with authentication (CephX) enabled, so a client cannot connect without a key. To create a user for another kind of client, run
ceph auth get-or-createwith the capabilities that the client needs: see User Management.On the cluster host, make the keyring readable by
rootonly, because the key in it is a secret:chmod 600 /root/ceph.client.user1701.keyringThe command prints nothing on success.
Copy the configuration file to the client host as
/etc/ceph/ceph.conf.Warning
This step and the next one replace
/etc/ceph/ceph.confand/etc/ceph/ceph.client.user1701.keyringon the client host if they exist. If the client host already has an/etc/ceph/ceph.conf, for example because it is a client of another cluster, copy that file to another place first.scp /root/minimal-ceph.conf root@client1701:/etc/ceph/ceph.confscpmay first ask you to accept the host key ofclient1701and for the password ofroot. On success, it then prints at most a progress line, such asminimal-ceph.conf 100%.Copy the keyring to
/etc/cephon the client host, under the same name:scp -p /root/ceph.client.user1701.keyring root@client1701:/etc/ceph/On success, the command prints at most a progress line. The
-poption keeps the file mode, so that onlyrootcan read the keyring on the client host too. A client looks for the key ofclient.user1701in/etc/ceph/ceph.client.user1701.keyringfirst, then in/etc/ceph/ceph.keyring.
Verification
On the client host, connect to the cluster as the new user:
ceph -n client.user1701 -sThe output starts with
cluster:and anid:line that shows the cluster ID from thefsidline of/etc/ceph/ceph.conf.Check who can read the keyring:
ls -l /etc/ceph/ceph.client.user1701.keyringThe line starts with
-rw-------and showsrootas the owner.
Troubleshooting
“ceph: command not found”. The
cephcommand is not installed on the host. On the cluster host, putcephadm shell --before the command. On the client host, install theceph-commonpackage. Both are listed in Prerequisites.“filesystem cephfs1701 does not exist”. The cluster has no file system with the name from the example. In step 2, replace
cephfs1701with a name thatceph fs lsprints, then run the command again.“no update for caps of client.user1701”, and the keyring file is empty. Step 2 ran again for a user that already has these capabilities, and in that case it prints no keyring. Write the keyring with
ceph auth get client.user1701 > /root/ceph.client.user1701.keyring.“Permission denied” from “scp”. Root cannot log in over SSH from the cluster host to the client host. Set up a root SSH login, as listed in Prerequisites, or copy the two files another way.
“No such file or directory” or “Failure” from “scp”, for a path under “/etc/ceph”. The client host has no
/etc/cephdirectory. Install theceph-commonpackage, which creates it, as listed in Prerequisites.“error calling conf_read_file”. The
cephcommand found no configuration file that it can read. Check that/etc/ceph/ceph.confexists on the client host and that the user who runs the command can read it.“cannot identify monitors to contact”, then “RADOS object not found (error connecting to the cluster)”.
/etc/ceph/ceph.confon the client host has no usablemon_hostline. If the file is empty, step 1 failed: run step 1 again, then copy the file again.“no keyring found; disabled cephx authentication”, then “RADOS permission denied (error connecting to the cluster)”. The command found no keyring that it can read. Without
-n, it runs asclient.adminand looks for/etc/ceph/ceph.client.admin.keyring: add-n client.user1701. Otherwise check the name of the keyring file, and run the command asroot, because onlyrootcan read the file. If you keep the two files outside/etc/ceph, pass both paths, with--confand--keyring: the minimal configuration file does not name a keyring. Older releases also print “unable to find a keyring on” and the paths that the command tried.“RADOS permission denied (error connecting to the cluster)”, with no “no keyring found” line before it. The Monitors rejected the key. Either the keyring does not hold the key that the cluster holds for the user, or the user has no Monitor capability, as happens when a user is created with
ceph auth get-or-createand no capabilities. On the cluster host, compare the keyring with the output ofceph auth get client.user1701.The command prints nothing for five minutes, then “RADOS timed out (error connecting to the cluster)”. The client cannot reach a Monitor. Check that the client host can reach the addresses on the
mon_hostline of/etc/ceph/ceph.confon ports 3300 and 6789.
Next Steps
Mount the file system on the client host. See Mount CephFS using Kernel Driver.
Give another client host the same two files: repeat steps 4 and 5 only.
Have cephadm write
ceph.confto the hosts that have a label such asbare_config. See Using Placement Specs to Specify which Hosts Get ceph.conf.
Additional Resources
Brought to you by the Ceph Foundation
The Ceph Documentation is a community resource funded and hosted by the non-profit Ceph Foundation. If you would like to support this and our other efforts, please consider joining now.