Exporting Ceph Filesystem as NFS

The Network Filesystem (NFS) is one of the most popular sharable filesystem protocols that can be used with every Unix-based system. Unix-based clients that do not understand the CephFS type can still access the Ceph Filesystem using NFS. To do this, we would require an NFS server in place that can re-export CephFS as an NFS share. NFS-Ganesha is an NFS server that runs in user space and supports the CephFS FSAL (File System Abstraction Layer) using libcephfs.

In this recipe, we will demonstrate creating ceph-node1 as an NFS-Ganesha server and exporting CephFS as an NFS and mounting it on client-node1.

How to do it…

  1. On ceph-node1, install packages required for nfs-ganesha:
    # yum install -y  nfs-utils nfs-ganesha nfs-ganesha-fsal-ceph
    
  2. Since this is a test setup, disable firewall. For the production setup, you might consider enabling the required ports over a firewall, which is generally 2049:
    # systemctl stop firewalld; systemctl disable firewalld
    
  3. Enable the rpc services required by NFS:
    # systemctl start rpcbind; systemctl enable rpcbind
    # systemctl start rpc-statd.service
    
  4. Create the NFS-Ganesha configuration file, /etc/ganesha.conf, with the following contents:
    EXPORT
    {
        Export_ID = 1;
        Path = "/";
        Pseudo = "/";
        Access_Type = RW;
        NFS_Protocols = "3";
        Squash = No_Root_Squash;
        Transport_Protocols = TCP;
        SecType = "none";
    
        FSAL {
            Name = CEPH;
        }
    }
  5. Finally, start the ganesha nfs daemon by providing the ganesha.conf file that we created in the last step. You can verify the exported NFS share using the showmount command:
    # ganesha.nfsd -f /etc/ganesha.conf -L /var/log/ganesha.log -N NIV_DEBUG -d
    # showmount -e
    
    How to do it…

Let's recall the steps that we have taken: ceph-node2 has been configured as Ceph MDS, and ceph-node1 has been configured as the NFS-Ganesha server.

Next, in order to mount the NFS share on client machines, we just need to install the NFS client packages and mount the share exported by ceph-node1, as shown next:

Install the nfs client packages on client-node1 and mount:

# apt-get install nfs-common
# mkdir /mnt/cephfs
# mount -o rw,noatime 192.168.1.101:/ /mnt/cephfs
How to do it…
..................Content has been hidden....................

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