The Ceph filesystem

The Ceph filesystem is also known as CephFS; it is a POSIX-compliant distributed filesystem that uses Ceph RADOS to store its data. To implement the Ceph filesystem, you need a running Ceph storage cluster and at least one Ceph Metadata Server (MDS). For demonstration purposes, we will use the same metadata server that we deployed in Chapter 3, Ceph Architecture and Components. We can use the Ceph filesystem in two ways: by mounting CephFS using a native kernel driver and by using Ceph FUSE. We will see both these methods one by one.

Mounting CephFS with a kernel driver

Linux kernel 2.6.34 and later natively support Ceph. To use CephFS with kernel level support, clients should use Linux kernel 2.6.34 and above. The following steps will guide you through mounting CephFS with a kernel driver:

  1. Check your client's Linux kernel version:
    # uname -r
    
  2. Create a mount point directory:
    # mkdir /mnt/kernel_cephfs
    
  3. Make a note of the admin secret key:
    # cat /etc/ceph/ceph.client.admin.keyring
    
  4. Mount CephFS using a native Linux mount call. The syntax for this is mount -t ceph <Monitor_IP>:<Monitor_port>:/ <mount_point_name> -o name=admin,secret=<admin_secret_key>.
    # mount -t ceph 192.168.57.101:6789:/ /mnt/kernel_cephfs -o name=admin,secret=AQAinItT8Ip9AhAAS93FrXLrrnVp8/sQhjvTIg==
    
    Mounting CephFS with a kernel driver
  5. To mount CephFS more securely, avoid the admin secret key to be visible in the bash history. Store the admin keyring as a plain text in a separate file and use this new file as a mount option for the secret key. Use the following command:
    # echo AQAinItT8Ip9AhAAS93FrXLrrnVp8/sQhjvTIg== > /etc/ceph/adminkey
    # mount -t ceph 192.168.57.101:6789:/ /mnt/kernel_cephfs -o name=admin,secretfile=/etc/ceph/adminkey
    
    Mounting CephFS with a kernel driver
  6. To mount CephFS in your filesystem table, add the following lines in the /etc/fstab file on the client. The syntax for this is <Mon_ipaddress>:<monitor_port>:/ <mount_point> <filesystem-name> [name=username,secret=secretkey|secretfile=/path/to/secretfile],[{mount.options}]. The following is the command:
    192.168.57.101:6789:/  /mnt/kernel_ceph  ceph name=admin,secretfile=/etc/ceph/adminkey,noatime  0  2
    
  7. Unmount and mount CephFS again:
    # umount /mnt/kernel_cephfs
    # mount /mnt/kernel_cephfs
    
    Mounting CephFS with a kernel driver

Mounting CephFS as FUSE

The Ceph filesystem is natively supported by Linux kernel starting from Version 2.6.34 and above. If your host is running on a lower kernel version, you can use the FUSE (Filesystem in User Space) client for Ceph to mount the Ceph filesystem:

  1. Since we have already added Ceph yum repositories earlier in this chapter, let's install Ceph FUSE on the client machine:
    # yum install ceph-fuse
    
  2. Ensure that the client has the Ceph configuration and keyring file before performing mounting. Create a directory for mounting:
    # mkdir /mnt/cephfs
    
  3. Mount CephFS using the Ceph FUSE client. The syntax for this is ceph-fuse -m <Monitor_IP:Monitor_Port_Number> <mount_point_name>. Use the following command:
    # ceph-fuse -m 192.168.57.101:6789 /mnt/cephfs
    
    Mounting CephFS as FUSE
  4. To mount CephFS in your filesystem table so that CephFS will automatically mount at startup, add the following lines in the /etc/fstab file on client:
    #Ceph ID    #mountpoint    #Type    #Options
    id=admin       /mnt/cephfs  fuse.ceph  defaults  0  0
    
  5. Unmount and mount CephFS again:
    # umount /mnt/cephfs
    # mount /mnt/cephfs
    
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.146.155