Ceph 通过 ganesha 将 cephfs 导出为 NFS:【十二】
#在mgr节点配置 并提前mgr准备好ceph.conf 和 ceph.client.admin.keyring 认证文件
#
cephadmin@ceph-deploy:~$ scp ceph.client.admin.keyring 192.168.40.154:/etc/ceph/
#
root@ceph-mgr1:/#apt install -y nfs-ganesha-ceph
#
root@ceph-mgr1:/# cat /etc/ganesha/ganesha.conf
NFS_CORE_PARAM {
#disable NLM
Enable_NLM = false;
#disable RQUOTA(not supported on CephFS)
Enable_RQUOTA = false;
#NFS Protocol
Protocols = 4;
}
EXPORT_DEFAULTS {
# default access mode
Access_Type = RW;
}
EXPORT
{
## Export Id (mandatory, each EXPORT must have a unique Export_Id)
Export_Id = 1;
## Exported path (mandatory)
Path = "/";
## Pseudo Path (required for NFSv4 or if mount_path_pseudo = true)
Pseudo = "/sheca";
## Whether to squash various users.
Squash = "No_root_squash";
## Allowed security types for this export
Sectype = sys;
## Exporting FSAL
FSAL {
Name = CEPH;
hostname = "192.168.40.154";
}
Access_Type = RW;
}
## Configure logging. Default is to log to Syslog. Basic logging can also be
## configured from the command line
LOG {
## Default log level for all components
Default_Log_Level = WARN;
}
root@ceph-mgr1:/etc/ganesha# systemctl restart nfs-ganesha
root@ceph-mgr1:/etc/ganesha# systemctl status nfs-ganesha
● nfs-ganesha.service - NFS-Ganesha file server
Loaded: loaded (/lib/systemd/system/nfs-ganesha.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2024-03-15 09:17:37 CST; 9s ago
Docs: http://github.com/nfs-ganesha/nfs-ganesha/wiki
Process: 4322 ExecStop=/usr/bin/dbus-send --system --dest=org.ganesha.nfsd --type=method_call /org/ganesha/nfsd/admin org.ganesha.nfsd.admin.shutdown (code=exited, status=0/SUCCESS)
Process: 4335 ExecStart=/bin/bash -c ${NUMACTL} ${NUMAOPTS} /usr/bin/ganesha.nfsd ${OPTIONS} ${EPOCH} (code=exited, status=0/SUCCESS)
Main PID: 4338 (ganesha.nfsd)
Tasks: 280 (limit: 4631)
CGroup: /system.slice/nfs-ganesha.service
└─4338 /usr/bin/ganesha.nfsd -L /var/log/ganesha/ganesha.log -f /etc/ganesha/ganesha.conf -N NIV_EVENT
Mar 15 09:17:37 ceph-mgr1.sheca.com systemd[1]: Starting NFS-Ganesha file server...
Mar 15 09:17:37 ceph-mgr1.sheca.com systemd[1]: Started NFS-Ganesha file server.
root@ceph-mgr1:/etc/ganesha# tail -f /var/log/ganesha/ganesha.log
15/03/2024 09:17:37 : epoch 65f3a1b1 : ceph-mgr1.sheca.com : ganesha.nfsd-4338[main] nfs_Start_threads :THREAD :EVENT :Starting delayed executor.
15/03/2024 09:17:37 : epoch 65f3a1b1 : ceph-mgr1.sheca.com : ganesha.nfsd-4338[main] nfs_Start_threads :THREAD :EVENT :9P/TCP dispatcher thread was started successfully
15/03/2024 09:17:37 : epoch 65f3a1b1 : ceph-mgr1.sheca.com : ganesha.nfsd-4338[main] nfs_Start_threads :THREAD :EVENT :gsh_dbusthread was started successfully
15/03/2024 09:17:37 : epoch 65f3a1b1 : ceph-mgr1.sheca.com : ganesha.nfsd-4338[main] nfs_Start_threads :THREAD :EVENT :admin thread was started successfully
15/03/2024 09:17:37 : epoch 65f3a1b1 : ceph-mgr1.sheca.com : ganesha.nfsd-4338[main] nfs_Start_threads :THREAD :EVENT :reaper thread was started successfully
15/03/2024 09:17:37 : epoch 65f3a1b1 : ceph-mgr1.sheca.com : ganesha.nfsd-4338[main] nfs_Start_threads :THREAD :EVENT :General fridge was started successfully
15/03/2024 09:17:37 : epoch 65f3a1b1 : ceph-mgr1.sheca.com : ganesha.nfsd-4338[_9p_disp] _9p_dispatcher_thread :9P DISP :EVENT :9P dispatcher started
15/03/2024 09:17:37 : epoch 65f3a1b1 : ceph-mgr1.sheca.com : ganesha.nfsd-4338[main] nfs_start :NFS STARTUP :EVENT :-------------------------------------------------
15/03/2024 09:17:37 : epoch 65f3a1b1 : ceph-mgr1.sheca.com : ganesha.nfsd-4338[main] nfs_start :NFS STARTUP :EVENT : NFS SERVER INITIALIZED
15/03/2024 09:17:37 : epoch 65f3a1b1 : ceph-mgr1.sheca.com : ganesha.nfsd-4338[main] nfs_start :NFS STARTUP :EVENT :-------------------------------------------------
##客户端挂载测试:
[root@k8s-haproxy02 ceph]# mount -t nfs 192.168.40.154:/sheca /sheca
[root@k8s-haproxy02 ceph]# df -TH
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 1.1G 0 1.1G 0% /dev
tmpfs tmpfs 1.1G 0 1.1G 0% /dev/shm
tmpfs tmpfs 1.1G 11M 1.1G 1% /run
tmpfs tmpfs 1.1G 0 1.1G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 19G 3.1G 16G 17% /
/dev/sda1 xfs 1.1G 144M 920M 14% /boot
tmpfs tmpfs 208M 0 208M 0% /run/user/0
192.168.40.154:/sheca nfs4 91G 0 91G 0% /sheca
[root@k8s-haproxy02 ceph]# echo "Ganesha success" >> /sheca/sheca.txt
[root@k8s-haproxy02 ceph]# cat /sheca/sheca.txt
Ganesha success