Ceph集群2025(Squid版)导出高可用NFS集群(上集)

#创建一个CephFS 文件系统
ceph fs volume create cephfs02

#创建子卷
ceph fs subvolumegroup create cephfs02  myfsg2


#查看子卷
ceph fs subvolumegroup ls cephfs02

[
    {
        "name": "myfsg2"
    }
]

创建 NFS Ganesha 集群

#例子
$ ceph nfs cluster create <cluster_id> [<placement>] [--ingress] [--virtual_ip <value>] [--ingress-mode {default|keepalive-only|haproxy-standard|haproxy-protocol}] [--port <int>]



ceph nfs cluster create my-ha-nfs \  ---集群id 
  --placement="ceph-100,ceph-102,ceph-103" \ -- 使用3个节点
  --ingress \
  --virtual_ip=172.16.8.99 \ -----这个虚拟IP必须要和你的客户端挂载IP一致
  --ingress-mode=haproxy-standard \
  --port=2049
  
#查看集群
ceph nfs cluster ls
[
  "my-ha-nfs"
]

创建完之后查看集群是否正常

Ceph集群2025(Squid版)导出高可用NFS集群(上集)_第1张图片

最后导出NFS

导出nfs
ceph nfs export create cephfs \
  --cluster-id my-ha-nfs \
  --pseudo-path /my-nfs \
  --fsname cephfs02 \ 
  --squash no_root_squash


这个参数是伪路径。系统不存在的目录
--pseudo-path /my-nfs

获取cluster-id 
ceph nfs cluster ls 

获取fsname
ceph fs ls

这句是死的,因为nfs建立在cephfs之上的 
ceph nfs export create cephfs 

这段就不解释大家都懂的
--squash no_root_squash

Ceph集群2025(Squid版)导出高可用NFS集群(上集)_第2张图片

⚠️⚠️注意假如你又想增加挂载目录

删除配置
ceph nfs export rm my-ha-nfs /my-nfs

再查看为空
# ceph nfs export get my-ha-nfs /my-nfs
{}
重新创建
ceph nfs export create cephfs  \
 --cluster-id my-ha-nfs \ 
 --pseudo-path /my-nfs \
 --fsname cephfs02 \
 --path=/volumes/myfsg2 \
 --squash no_root_squash

新增了
--path=/volumes/myfsg2

这个不是目录是一个子卷 挂载到子卷,
--path=/volumes/myfsg2
# 如果觉得麻烦可以跳过这步直接挂载根目录

修改完之后
Ceph集群2025(Squid版)导出高可用NFS集群(上集)_第3张图片
Ceph集群2025(Squid版)导出高可用NFS集群(上集)_第4张图片

客户端测试
我的系统是debian12
apt install -y nfs-common

使用刚才的虚拟IP挂载
mkdir /mnt/nfs-client
mount -t nfs 172.16.8.99:/my-nfs /mnt/nfs-client/

测试
echo 2222222222222 > /mnt/nfs-client/2.txt 

Ceph集群2025(Squid版)导出高可用NFS集群(上集)_第5张图片

好多网友以前都是这样创建其实不是高可用的,

ceph nfs cluster create my-nfs --placement="node1,node2" --port=2049

更多权限

# 高级导出命令(含访问控制与安全配置)
ceph nfs export create cephfs \
  --cluster-id my-nfs \
  --pseudo-path /secure-nfs \
  --fsname cephfs01 \
  --path=/secure-data \
  --readonly \
  --client_addr 192.168.1.100 \
  --client_addr 10.0.0.0/24 \
  --sectype sys,krb5i \
  --squash none

更多原理概念你们自己看官网

你可能感兴趣的:(存储,system,ceph,java,服务器)