CEPHFS文件系统基本操作
1.查看cephfs文件系统信息
# ceph fs ls
name: cephfs, metadata pool: metadata, data pools: [data ]
# ceph mds stat
e109: 1/1/1 up {0=node202=up:active}, 2 up:standby
# ceph mds dump
dumped fsmap epoch 109
fs_name cephfs
epoch 109
flags 0
created 2022-01-14 17:15:40.058584
modified 2022-01-14 17:15:40.058584
tableserver 0
root 0
session_timeout 150
session_autoclose 60
max_file_size 8796093022208
last_failure 0
last_failure_osd_epoch 0
compat compat={},rocompat={},incompat={1=base v0.20,2=client writeable ranges,3=default file layouts on dirs,4=dir inode in separate object,5=mds uses versioned encoding,6=dirfrag is stored in omap,8=file layout v2}
max_mds 1
in 0
up {0=12500564118}
failed
damaged
stopped
data_pools 1
metadata_pool 2
inline_data disabled
12500564118: 192.168.8.202:6800/3708189740 'node202' mds.0.108 up:active seq 21
2.删除cephfs文件系统
1.停止mds服务并解挂
#每个文件系统的内核客户端都需要停止mds服务并解挂文件系统目录
# systemctl stop ceph-mds@{node-ip}
# umount /cephfs
2.删除文件系统
# ceph fs rm cephfs --yes-i-really-mean-it
3.创建cephfs文件系统
1.启动mds服务
#每个需要挂载文件系统内核客户端的节点都需要启动mds服务
# systemctl start ceph-mds@{node-ip}
# systemctl status ceph-mds@{node-ip}
2.创建文件系统
格式:ceph fs new {cephfs-name} {metadata-name} {data-name}
#ceph fs new cephfs metadata data
3.查看文件系统信息
# ceph mds dump
4.挂载文件系统
#每个需要挂载文件系统内核客户端的节点都需要
# mkdir /cephfs
# mount -t cephfs 192.168.8.203,192.168.8.202,192.168.8.201:/ /cephfs -o relatime,ceph_quota=3
# df -h
4.cephfs文件系统中增加数据池
1.创建存储池
# ceph osd pool create data1 64 64
pool 'data1' created
# ceph osd dump | grep data1
pool 3 'data1' replicated size 2 min_size 1 crush_ruleset 0 object_hash rjenkins pg_num 64 pgp_num 64 last_change 164 flags hashpspool stripe_width 0
2.cephfs中增加存储池
格式:ceph fs add_data_pool <fs_name> <pool>
# ceph fs add_data_pool cephfs data1
added data pool 3 to fsmap
# ceph fs ls
name: cephfs, metadata pool: metadata, data pools: [data data1 ]
5.cephfs文件系统中移除数据池
格式:ceph fs rm_data_pool <fs_name> <pool>
# ceph fs rm_data_pool cephfs data1
added data pool 3 to fsmap
# ceph fs ls
name: cephfs, metadata pool: metadata, data pools: [data ]