「Ceph」- 部署 CephFS(文件系统)

  CREATED BY JENKINSBOT

解决方案

第一步、运行 mds 服务

for ceph-node-01

# ceph fs volume create <fs_name> --placement="<placement spec>"
# ceph fs volume create foo-fs --placement="ceph-node-01 ceph-node-02 ceph-node-03"

# ceph mds stat                                                                                                                                                                                                 
foo-fs:1 {0=foo-fs.ceph-node-03.lcyldy=up:active} 2 up:standby

# ceph fs ls
name: foo-fs, metadata pool: cephfs.foo-fs.meta, data pools: [cephfs.foo-fs.data ]

第二步、创建 Keyring 文件

for ceph-node-0

# ceph auth get-or-create client.cephfs -o /etc/ceph/client.cephfs.keyring     \
    osd 'allow rwx pool=cephfs.foo-fs.meta,allow rwx pool=cephfs.foo-fs.data'  \
    mon 'allow r'                                                              \
    mds 'allow r'

# cat /etc/ceph/client.cephfs.keyring
[client.cephfs]
        key = AQDunnxjNd/fMxAAR0KPJ+TROGLIPGRN9sLnAw==

第三步、客户端挂载访问

# mount -t ceph -o 'name=cephfs,secretfile=/path/to/secretfile' ...
mount -t ceph  -o 'name=cephfs,secret=AQDunnxjNd/fMxAAR0KPJ+TROGLIPGRN9sLnAw==' 192.168.200.3:6789:/ /mnt/ceph/

// for old versions of Linux,旧版本的内核没有 ceph 模块,需要通过 fuse 来挂载
ceph-fuse --keyring /path/to/keyring --name client.cephfs -m 192.168.200.3:6789:/ /mnt/ceph/

// for Windows, use ceph-dokan
// https://docs.ceph.com/en/latest/cephfs/ceph-dokan/

参考文献

MDS Service — Ceph Documentation