一.配置filesystem
1.1 配置mds服务
[root@master ceph-cluster]# ceph-deploy mds create node
---
[node][WARNIN] Created symlink from /etc/systemd/system/ceph-mds.target.wants/ceph-mds@node.service to /usr/lib/systemd/system/ceph-mds@.service.
[node][INFO ] Running command: systemctl start ceph-mds@node
[node][INFO ] Running command: systemctl enable ceph.target
1.2 创建pool
#需要创建两个pool分别存储metadata和data
[root@master ceph-cluster]# ceph osd pool create cephfs_metadata 16 16
[root@master ceph-cluster]# ceph osd pool create cephfs_data 10 10
#查看pool
[root@master ceph-cluster]# ceph osd pool ls
huhuhahei
.rgw.root
default.rgw.control
default.rgw.meta
default.rgw.log
default.rgw.buckets.index
default.rgw.buckets.data
cephfs_metadata
cephfs_data
#创建文件系统
[root@master ceph-cluster]# ceph fs new cephfs-demo cephfs_metadata cephfs_data
[root@master ceph-cluster]# ceph fs ls
name: cephfs-demo, metadata pool: cephfs_metadata, data pools: [cephfs_data ]
1.3 内核态挂载
客户端需要这个包 可以yum安装
[root@master cephfs]# rpm -qf /usr/sbin/mount.ceph
ceph-common-14.2.22-0.el7.x86_64
#创建目录挂载
[root@master ceph-cluster]# mkdir /cephfs
[root@master ceph-cluster]# mount -t ceph master:6789:/ /cephfs -o name=admin
#确认
[root@master ceph-cluster]# df -Th
/dev/rbd1 xfs 10G 87M 10G 1% /backup
10.46.8.18:6789:/ ceph 47G 0 47G 0% /cephfs
#这里默认的空间大小就是ceph集群的总空间
1.4 用户态挂载
需要安装包
[root@master cephfuse]# yum -y install ceph-fuse
[root@master cephfuse]# rpm -qa ceph-fuse
ceph-fuse-14.2.22-0.el7.x86_64
#挂载
[root@master cephfs]# mkdir /cephfuse
[root@master cephfs]# ceph-fuse -n client.admin -m node:6789 /cephfuse
ceph-fuse[3688325]: starting ceph client
2021-12-06 14:58:36.599 7fb6268e0f80 -1 init, newargv = 0x556cff6153e0 newargc=9
#查看
[root@master cephfs]# df -h
/dev/rbd1 10G 87M 10G 1% /backup
10.46.8.18:6789:/ 47G 0 47G 0% /cephfs
ceph-fuse 47G 0 47G 0% /cephfuse
#之前挂载的文件也是共享的
[root@master cephfuse]# ll
total 1
-rw-r--r-- 1 root root 10 Dec 6 14:50 test