Notice
This document is for a development version of Ceph.
Configuring the Ceph Client on Windows
Create the configuration file and copy the keyring that the Ceph client on Windows reads when it connects to a cluster.
Prerequisites
The Ceph client installed on the host. See Installing the Ceph Client on Windows.
The addresses of the cluster’s Monitors. On a cluster host,
ceph config generate-minimal-confprints them on itsmon_hostline.A keyring that holds the key of a CephX user. To create a user for CephFS and get its key, see Mount CephFS: Prerequisites. For an RBD user, see “Create a Block Device User” in Basic Block Device Commands.
PowerShell opened with Run as administrator. The installer lets only administrators and the SYSTEM account use
C:\ProgramData\ceph.
Procedure
Warning
Back up C:\ProgramData\ceph\keyring and
C:\ProgramData\ceph\ceph.conf first if they exist: steps 2 and 3
replace them. With the sample configuration, every client user on the
host reads its key from that one keyring file, so replacing it removes the
keys of the other users.
Create the directory that the sample configuration uses for socket files and, if you enable it, the log file:
New-Item -ItemType Directory -Force -Path C:\ProgramData\ceph\outPowerShell lists the
outdirectory.Copy the keyring of your CephX user to the path that the sample configuration sets:
Copy-Item .\ceph.client.user1701.keyring C:\ProgramData\ceph\keyringThe command prints nothing on success.
Open
C:\ProgramData\ceph\ceph.confin Notepad from the PowerShell window, so that Notepad can save to the folder:notepad C:\ProgramData\ceph\ceph.confNotepad offers to create the file if it does not exist. Enter the following content, replace the
mon hostaddresses with those of your Monitors, and save the file:[global] mon host = 192.0.2.11,192.0.2.12,192.0.2.13 log to stderr = true ; Uncomment the following in order to use the Windows Event Log ; log to syslog = true run dir = C:/ProgramData/ceph/out ; Use the following to change the cephfs client log level ; debug client = 2 [client] keyring = C:/ProgramData/ceph/keyring ; log file = C:/ProgramData/ceph/out/$name.$pid.log admin socket = C:/ProgramData/ceph/out/$name.$pid.asok ; client_permissions = true ; client_mount_uid = 1000 ; client_mount_gid = 1000
Notepad saves the file without an error.
%ProgramData%\ceph\ceph.confis the default location of the file on Windows and usually expands toC:\ProgramData\ceph\ceph.conf.Only
mon hostandkeyringare needed to connect. The other settings are optional:log to stderrwrites log messages to the console,run dirsets the directory for process ID and socket files, andadmin socketsets the path of the socket thatceph daemoncommands use. Forclient_permissions,client_mount_uid, andclient_mount_gid, see Mount CephFS on Windows.Use forward slashes (
/) as path separators inceph.conf: the parser reads a backslash as an escape character.If you will map RBD images, restart the
ceph-rbdservice so that it reads the new configuration.Warning
If RBD images are mapped on this host, stop the workloads that use them first. Restarting the service disconnects every mapped image and then maps only the persistent ones again. A disk that is still in use is disconnected by force, without waiting for pending writes: data that is not yet written is lost.
Restart-Service ceph-rbdIf no RBD images are mapped, the command prints nothing. Otherwise it can take several seconds to return: the service disconnects the mapped images, then maps the persistent ones again before it reports that it is running, and PowerShell can print “WARNING: Waiting for service ‘Ceph RBD Mapping Service (ceph-rbd)’ to start…” while it waits.
Verification
Check that the client reads the Monitor addresses from the file:
ceph-conf --lookup mon_hostThe output is the addresses from step 3, for example
192.0.2.11,192.0.2.12,192.0.2.13. The command reads the file only and does not contact the cluster.Check the keyring path that the client uses:
ceph-conf --lookup keyringThe output is
C:/ProgramData/ceph/keyring.Check that the keyring file is in place:
Test-Path C:\ProgramData\ceph\keyringThe output is
True.If you will map RBD images, check that the client reaches the cluster and authenticates. This example uses
client.user1701, whose keyring step 2 copies, and a pool namedrbd1701:rbd ls --id user1701 rbd1701The output lists the images in the pool, one per line, or nothing if the pool has none. For a CephFS user, mounting the file system is the first contact with the cluster. See Mount CephFS on Windows.
Troubleshooting
“Cannot find path … because it does not exist.”
Copy-Itemin step 2 looks for the keyring in the current directory, which in PowerShell opened with Run as administrator is oftenC:\Windows\system32. Change to the folder that holds the keyring, for example withSet-Location $HOME\Downloads, or give its full path, and run step 2 again.“did not load config file, using default settings.” The client did not find
C:\ProgramData\ceph\ceph.conf, or could not read it. Check the file name and location, and run the command in PowerShell opened with Run as administrator: other users cannot read the file.“global_init: error reading config file.” The rest of the message gives the line and position of a syntax error in
ceph.conf. Compare the file with the sample in step 3. An error in line 1 at position 1 can mean that the file starts with a byte order mark (BOM): save it again as UTF-8 without a BOM.“no keyring found; disabled cephx authentication”. The client did not find a keyring at the path that
ceph.confsets. Ifceph-conf --lookup keyringprints a path without separators, such asC:ProgramDatacephkeyring, thekeyringline uses backslashes: use forward slashes.“rbd: couldn’t connect to the cluster!” or “failed to fetch mon config”. The client cannot reach a Monitor, or the Monitor rejected its key. A command that cannot reach a Monitor waits up to five minutes before it fails. Check the
mon hostaddresses, that the host can reach them on ports 3300 and 6789, and that the keyring holds the key of the user that the command runs as:client.adminunless you pass--id.
Next Steps
Map RBD images as disks. See RBD on Windows.
Mount CephFS file systems. See Mount CephFS on Windows.
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.