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.
Mục Lục
[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@glus01:~# gluster volume get vol_distributed nfs.disable
Option Value
------ -----
nfs.disable on
# if [nfs.disable: off], turn to disable
root@glus01:~# gluster volume set vol_distributed nfs.disable on
volume set: success
# if NFS server is running, disable it
root@glus01:~# systemctl disable --now nfs-server
[2] Install and Configure NFS-Ganesha on a Node in GlusterFS Cluster.
root@glus01:~# apt -y install nfs-ganesha-gluster
root@glus01:~# mv /etc/ganesha/ganesha.conf /etc/ganesha/ganesha.conf.org
root@glus01:~# 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 {
# uniq 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@glus01:~# systemctl restart nfs-ganesha
root@glus01:~# systemctl enable nfs-ganesha
# show exports list
root@glus01:~# showmount -e localhost
Export list for localhost:
/vfs_distributed (everyone)
[3] Verify NFS mounting on a Client Host.
root@client:~# apt -y install nfs-common
# specify Pseudo path set on [Pseudo=***] in ganesha.conf
root@client:~# mount -t nfs4 glus01.srv.local:/vfs_distributed /mnt
root@client:~# df -hT
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 394M 1.1M 393M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv ext4 25G 3.0G 21G 13% /
tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/vda2 ext4 976M 197M 713M 22% /boot
/dev/loop0 squashfs 55M 55M 0 100% /snap/core18/1880
/dev/loop1 squashfs 55M 55M 0 100% /snap/core18/1754
/dev/loop2 squashfs 72M 72M 0 100% /snap/lxd/16100
/dev/loop3 squashfs 72M 72M 0 100% /snap/lxd/15675
/dev/loop4 squashfs 30M 30M 0 100% /snap/snapd/8542
/dev/loop5 squashfs 30M 30M 0 100% /snap/snapd/8140
tmpfs tmpfs 394M 0 394M 0% /run/user/0
glus01.srv.local:/vfs_distributed nfs4 50G 6.5G 42G 14% /mnt