In order for our client to have access to Ceph FS, we need to configure the client for accessing the cluster and mounting Ceph FS. Let's review how this is done:
- Check your client's Linux kernel version:
root@client-node1 # uname -r
- Create a mount point directory in which you want to mount the filesystem:
# mkdir /mnt/cephfs
- Get the keys for the client.cephfs user, which we created in the last section. Execute the following command from the Ceph monitor node to get the user keys:
# ceph auth get-key client.cephfs
- Mount Ceph FS using the native Linux mount call with the following syntax:
Syntax: # mount -t ceph <monitor _IP:Monitor_port>:/ <mount_point_name> -o name=admin,secret=<admin_user_key>
# mount -t ceph ceph-node1:6789:/ /mnt/cephfs
-o name=cephfs,secret=AQAimbFZAFAVOBAAsksSA09rtD9+dVWoj0CDDA==
- To mount Ceph FS more securely and avoid the admin key being visible in the command history, store the admin keyring as plain text in a separate file and use this file as a mount option for secretkey:
# echo AQAimbFZAFAVOBAAsksSA09rtD9+dVWoj0CDDA==
> /etc/ceph/cephfskey
# mount -t ceph ceph-node1:6789:/ /mnt/cephfs
-o name=cephfs,secretfile=/etc/ceph/cephfskey
- To allow the Ceph FS mount during the OS startup, add the following lines in the /etc/fstab file on client-node1:
Syntax: <Mon_ipaddress>:<Monitor_port>:/ <mount_point> <filesystem_name> [name=username,secret=secretkey|secretfile=/<path/to/secretfile],[{mount.options}]
# echo "ceph-node1:6789:/ /mnt/cephfs ceph
name=cephfs,secretfile=/etc/ceph/
cephfskey,_netdev,noattime 0 0" >>
/etc/fstab
Use the _netdev option to ensure that the filesystem is mounted after the networking subsystem to prevent networking issues.
- umount and mount the Ceph FS again to validate clean mount:
# umount /mnt/cephfs
# mount /mnt/cephfs
- Perform some I/O on the Ceph Filesystem and then umount it:
# dd if=/dev/zero of=/mnt/cephfs/file1 bs=1M count=1024
# umount /mnt/cephfs