1 创建一个nfs集群
ceph nfs cluster create < cluster_id> [ < placement> ]
# ceph nfs cluster create mycluster ceph- nfs- server
2. 在ceph- 164 , ceph- 165 host建立一个高可用的nfs
# ceph nfs cluster create mycluster -- placement= ceph- 164 , ceph- 165
3. 导出nfs集群
# ceph nfs export create cephfs -- cluster- id mycluster -- pseudo- path / my- nfs00/ abc/ data -- fsname cephfs01 -- path= / -- squash no_root_squash
# 输出以下信息
{
"bind" : "/my-nfs00/abc/data" ,
"cluster" : "mycluster" ,
"fs" : "cephfs01" ,
"mode" : "RW" ,
"path" : "/"
}
# ceph fs ls
name : cephfs01, metadata pool: fs_kube_metadata, data pools: [ fs_kube_data ]
查询
查看导出
ceph nfs export ls mycluster
ceph nfs export ls mycluster --detailed
NAME PORTS RUNNING REFRESHED AGE PLACEMENT
nfs.mycluster ?:2049 2 /2 9m ago 28h ceph-164; ceph-165
ceph nfs export info mycluster /my-nfs00/abc/data
{
"access_type" : "RW" ,
"clients" : [ ] ,
"cluster_id" : "mycluster" ,
"export_id" : 1 ,
"fsal" : {
"fs_name" : "cephfs01" ,
"name" : "CEPH" ,
"user_id" : "nfs.mycluster.1"
} ,
"path" : "/" ,
"protocols" : [
4
] ,
"pseudo" : "/my-nfs00/abc/data" ,
"security_label" : false,
"squash" : "no_root_squash" ,
"transports" : [
"TCP"
]
}
ceph nfs export info mycluster /my-nfs00/abc/data > my.json
Vim my.json
ceph nfs export apply mycluster -i my.json
最后客户端测试
# nfs挂载方式
mount -t nfs -o port=2049 192.168.0.164:/my-nfs00/abc/data /mnt/
# df -h | grep my-nfs
192.168.0.164:/my-nfs00/abc/data 222G 0 222G 0% /mnt
NFS的挂载方式
## 注意挂载必须是根目录
# mount - t ceph 192.168 .0 .165 : 6789 , 192.168 .0 .164 : 6789 , 192.168 .0 .163 : 6789 : / / mnt - o name= admin, secret= AQASMz9mgVCqNxAABEAu/ WYy0gaEcTC5zC60Ug==
root@kvm- 196 : / etc/ ceph# df - h
Filesystem Size Used Avail Use% Mounted on
udev 3 . 8G 0 3 . 8G 0 % / dev
tmpfs 778M 1 . 1M 777M 1 % / run
/ dev/ vda3 296G 23G 273G 8 % /
tmpfs 3 . 8G 0 3 . 8G 0 % / dev/ shm
tmpfs 5 . 0M 0 5 . 0M 0 % / run/ lock
/ dev/ vda2 921M 78M 780M 10 % / boot
overlay 296G 23G 273G 8 % / var / lib/ docker/ overlay2/ 7b9f90e9e9451cc44e53566d5222c4eb8e448daedf4220eae5e3db7c16809da2/ merged
tmpfs 778M 76K 778M 1 % / run/ user/ 0
192.168 .0 .165 : 6789 , 192.168 .0 .164 : 6789 , 192.168 .0 .163 : 6789 : / 222G 0 222G 0 % / mnt
# 获取key 方式
# ceph auth get client. admin
[ client. admin]
key = AQASMz9mgVCqNxAABEAu/ WYy0gaEcTC5zC60Ug==
caps mds = "allow *"
caps mgr = "allow *"
caps mon = "allow *"
caps osd = "allow *"
文明挂载方式
# mount - t ceph 192.168 .0 .165 : 6789 , 192.168 .0 .164 : 6789 , 192.168 .0 .163 : 6789 : / / mnt - o name= admin, secretfile= / etc/ key. file
其他查询
#资源使用情况
ceph orch ps
#磁盘情况
ceph df