Ceph FS导出成NFS

创建NFS导出目录

在任意一个该Ceph集群的 cephfs 客户端节点,进入cephfs的挂载点创建一个需要导出的目录

假如需要导出iso目录,需要确保/cephfs存在,如没有则需要创建

df -h |grep cephfs
10.0.0.56:6789,10.0.0.57:6789:/   59T  328G   59T   1% /cephfs
cd  /cephfs
mkdir  iso

mds节点操作

10.0.0.57 mds节点

安装ganesha相关包

yum install -y nfs-utils nfs-ganesha nfs-ganesha-ceph
rpm -qa |grep ganesha
nfs-ganesha-2.7.4-10.el7cp.x86_64
nfs-ganesha-ceph-2.7.4-10.el7cp.x86_64
rpm -ql nfs-ganesha
/etc/ganesha/ganesha.conf
/usr/lib/systemd/system/nfs-ganesha.service
...

配置

vi /etc/ganesha/ganesha.conf

# Please do not change this file directly since it is managed by Ansible and will be overwritten

%include /etc/ganesha/export.d/INDEX.conf

NFS_Core_Param
{
    
    
       Bind_Addr=0.0.0.0;
}

EXPORT_DEFAULTS {
    
    
        Attr_Expiration_Time = 0;
}

CACHEINODE {
    
    
        Dir_Max = 1;
        Dir_Chunk = 0;

        Cache_FDs = false;

        NParts = 1;
        Cache_Size = 1;
}


EXPORT
{
    
    
        Export_id=20133;
        Path = "/";
        Pseudo = /cephnfs;
        Access_Type = RW;
        Protocols = 3,4;
        Transports = TCP;
        SecType = sys,krb5,krb5i,krb5p;
        Squash = Root_Squash;
        Attr_Expiration_Time = 0;
        FSAL {
    
    
                Name = CEPH;
                User_Id = "admin";
        }

}

EXPORT
{
    
    
        Export_id=29999;
        Path = /dcs;
        Pseudo = /dcs;
        Access_Type = RW;
        Protocols = 3,4;
        Transports = TCP;
        SecType = sys,krb5,krb5i,krb5p;
        #Squash = Root_Squash;
        Squash = no_root_squash;
        Attr_Expiration_Time = 0;
        FSAL {
    
    
                Name = CEPH;
                User_Id = "admin";
        }
}

EXPORT
{
    
    
        Export_id=26666;
        Path = /iso;
        Pseudo = /iso;
        Access_Type = RW;
        Protocols = 3,4;
        Transports = TCP;
        SecType = sys,krb5,krb5i,krb5p;
        #Squash = Root_Squash;
        Squash = no_root_squash;
        Attr_Expiration_Time = 0;
        FSAL {
    
    
                Name = CEPH;
                User_Id = "admin";
        }
}

LOG {
    
    
        Facility {
    
    
                name = FILE;
                destination = "/var/log/ganesha/ganesha.log";
                enable = active;
        }


}

启动

systemctl start nfs-ganesha

手动启动

/usr/bin/ganesha.nfsd -L /var/log/ganesha/ganesha.log -f /etc/ganesha/ganesha.conf -N NIV_EVENT

测试

showmount -e
Export list for xxxxxxx:
/      (everyone)
/dcs   (everyone)
/iso   (everyone)

客户端挂载

mkdir /mnt/test
mount -o rw,noatime 10.0.0.57:/iso /mnt/test