CentOS Stream 8
Sponsored Link

GlusterFS 7 : GlusterFS + NFS-Ganesha2021/04/02

 
Install NFS-Ganesha and integrate with GlusterFS to mount Gluster Volume with NFS protocol.
The supported NFS protocols by NFS-Ganesha are v3, v4.0, v4.1, pNFS.
[1] Disable NFS feature in Gluster first.
The NFS feature in Gluster is officially deprecated.
Also if NFS server is running, stop and disable it, too.
# OK if [nfs.disable: on] (default setting)

[root@node01 ~]#
gluster volume get vol_distributed nfs.disable

Option                                  Value
------                                  -----
nfs.disable                             on

# if [nfs.disable: off], turn to disable

[root@node01 ~]#
gluster volume set vol_distributed nfs.disable on

volume set: success
# if NFS server is running, disable it

[root@node01 ~]#
systemctl disable --now nfs-server

[2] Install and Configure NFS-Ganesha on a Node in GlusterFS Cluster.
[root@node01 ~]#
dnf -y install centos-release-nfs-ganesha30
[root@node01 ~]#
sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/CentOS-NFS-Ganesha-3.repo
[root@node01 ~]#
dnf --enablerepo=centos-nfs-ganesha3 -y install nfs-ganesha-gluster
[root@node01 ~]#
mv /etc/ganesha/ganesha.conf /etc/ganesha/ganesha.conf.org

[root@node01 ~]#
vi /etc/ganesha/ganesha.conf
# create new

NFS_CORE_PARAM {
    # possible to mount with NFSv3 to NFSv4 Pseudo path
    mount_path_pseudo = true;
    # NFS protocol
    Protocols = 3,4;
}
EXPORT_DEFAULTS {
    # default access mode
    Access_Type = RW;
}
EXPORT {
    # unique ID
    Export_Id = 101;
    # mount path of Gluster Volume
    Path = "/vol_distributed";
    FSAL {
    	# any name
        name = GLUSTER;
        # hostname or IP address of this Node
        hostname="10.0.0.51";
        # Gluster volume name
        volume="vol_distributed";
    }
    # config for root Squash
    Squash="No_root_squash";
    # NFSv4 Pseudo path
    Pseudo="/vfs_distributed";
    # allowed security options
    SecType = "sys";
}
LOG {
    # default log level
    Default_Log_Level = WARN;
}

[root@node01 ~]#
systemctl enable --now nfs-ganesha
# verify Export list

[root@node01 ~]#
showmount -e localhost

Export list for localhost:
/vfs_distributed (everyone)
[3] If SELinux is enabled, change polocy.
[root@dlp ~]#
vi nfs-ganesha.te
# create new

module nfs-ganesha 1.0;

require {
        type var_lib_nfs_t;
        type init_t;
        class dir create;
}

#============= init_t ==============
allow init_t var_lib_nfs_t:dir create;

[root@dlp ~]#
checkmodule -m -M -o nfs-ganesha.mod nfs-ganesha.te

checkmodule: loading policy configuration from nfs-ganesha.te
checkmodule: policy configuration loaded
checkmodule: writing binary representation (version 19) to nfs-ganesha.mod
[root@dlp ~]#
semodule_package --outfile nfs-ganesha.pp --module nfs-ganesha.mod

[root@dlp ~]#
semodule -i nfs-ganesha.pp

[4] If Firewalld is running, allow NFS service.
[root@node01 ~]#
firewall-cmd --add-service=nfs --permanent

success
[root@node01 ~]#
firewall-cmd --reload

success
[5] Verify NFS mounting on a Client Host.
[root@client ~]#
dnf -y install nfs-utils
# specify Pseudo path set on [Pseudo=***] in ganesha.conf

[root@client ~]#
mount -t nfs4 node01.srv.world:/vfs_distributed /mnt

[root@client ~]#
df -hT

Filesystem                        Type      Size  Used Avail Use% Mounted on
devtmpfs                          devtmpfs  1.9G     0  1.9G   0% /dev
tmpfs                             tmpfs     1.9G     0  1.9G   0% /dev/shm
tmpfs                             tmpfs     1.9G  8.6M  1.9G   1% /run
tmpfs                             tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/mapper/cs-root               xfs        26G  2.4G   24G   9% /
/dev/vda1                         xfs      1014M  322M  693M  32% /boot
tmpfs                             tmpfs     374M     0  374M   0% /run/user/0
node01.srv.world:/vfs_distributed nfs4       52G  5.2G   47G  10% /mnt
Matched Content