1. 创建元数据服务器

1.1 安装mds

#ceph-deploy install mds_server

$ ceph-deploy install ceph-bench-osd03.gz01

1.2 拷贝ceph配置及秘钥

$ cd /etc/ceph/
$ ceph-deploy admin ceph-bench-osd03.gz01

1.3 修改秘钥文件权限,保证有可读权限

sudo chmod +r /etc/ceph/ceph.client.admin.keyring

1.4 创建元数据服务器

$ ceph-deploy --overwrite-conf mds create ceph-bench-osd03.gz01

2. 存储池

2.1 创建存储池数据

#ceph osd pool create cephfs_data <pg_num>

$ ceph osd pool create cephfs_data 128
pool 'cephfs_data' created

2.2 创建存储池元数据

#ceph osd pool create cephfs_metadata <pg_num>

$ ceph osd pool create cephfs_data 128
pool 'cephfs_metadata' created

2.3 查看存储池

$ ceph osd lspools
1 rbd,2 test_data,3 test_metadata,5 test,6 benmark_test,7 .rgw.root,8 default.rgw.control,9 default.rgw.meta,10 default.rgw.log,11 default.rgw.buckets.index,12 web-services,13 test_pool,15 cephfs_data,16 cephfs_metadata,

3. 文件系统

3.1 创建文件系统

#ceph fs new <fs_name> cephfs_metadata cephfs_data

$ ceph fs flag set enable_multiple true
Warning! This feature is experimental.It may cause problems up to and including data loss.Consult the documentation at ceph.com, and if unsure, do not proceed.Add --yes-i-really-mean-it if you are certain.

$ ceph fs new test1_fs cephfs_metadata cephfs_data
new fs with metadata pool 16 and data pool 15

#查看文件系统
$ ceph fs ls
name: test_fs, metadata pool: test_metadata, data pools: [test_data ]
name: test1_fs, metadata pool: cephfs_metadata, data pools: [cephfs_data ]

3.2 查看文件系统

$ ceph fs ls
name: test_fs, metadata pool: test_metadata, data pools: [test_data ]
name: test1_fs, metadata pool: cephfs_metadata, data pools: [cephfs_data ]

4. mds状态

4.1 查看mds状态

$ ceph mds stat
test_fs-1/1/1 up test1_fs-1/1/1 up  {[test1_fs:0]=ceph-bench-osd03.gz01=up:active,[test_fs:0]=ceph-bench-osd00=up:active}

对输出解释如下:

  • e8 : e标识epoch,8是epoch号
  • tstfs-1/1/1 up : tstfs是cephfs名字,后面的三个1分别是mds_map.in/mds_map.up/mds_map.max_mdsup是cephfs状态
  • {[tstfs:0]=mds-daemon-1=up:active}: [tstfs:0]指tstfs的rank 0,mds-daemon-1是服务tstfs的mds daemon name, up:active是cephfs的状态为 up &active

从上面的输出可以看出:(添加新的mds daemon后,它会自动服务于一个没有mds daemon的cephfs)

  • test_fs-1是active的,它的mds daemon为ceph-bench-osd03.gz01
  • test1_fs-1是active的,它的mds daemon为ceph-bench-osd00.gz01

又添加一个新的mds daemon后,它会处于standby状态,若前两个mds daemon出问题,它会顶替上去,顶替的规则可以配置,

详情参考文章:

http://docs.ceph.com/docs/master/cephfs/standby/#configuring-standby-daemons

5. 内核驱动挂载ceph文件系统

5.1 查看秘钥

$ cat /etc/ceph/ceph.client.admin.keyring
[client.admin]
key = AQBpxadZjXLcBxAArU8dYn75aAZYfdGdogYRYg==

5.2 创建目录

$ sudo mkdir /mnt/mycephfs

5.3 挂载文件系统

#指定用户名、密钥
#sudo mount -t {ip-address-of-monitor}:6789 /mycephfs -o name=xxxx,secret=xxxx

$ sudo mount -t ceph 10.69.18.32:6789:/ /mnt/mycephfs -o name=admin,secret=AQBpxadZjXLcBxAArU8dYn75aAZYfdGdogYRYg==
$ df -h
tmpfs                 3.2G     0  3.2G   0% /run/user/50831
10.69.18.32:6789:/  201T  1.9T  199T   1% /mnt/mycephfs

6. 用户空间挂载ceph文件系统

6.1 安装ceph-fuse

$ yum install ceph-fuse

6.2 创建目录

$ sudo mkdir /mnt/mycephfs-fuse

6.3 挂载文件系统

#Ceph 存储集群默认要求认证,需指定相应的密钥环文件
#sudo ceph-fuse -k keyring -m {ip-address-of-monitor}:6789 /mycephfs

$ sudo ceph-fuse -k /etc/ceph/ceph.client.admin.keyring -m 100.69.178.32:6789 /mnt/mycephfs-fuse
2017-11-15 14:26:45.323695 7fef1e1e2ec0 -1 init, newargv = 0x7fef29cb68a0 newargc=11ceph-fuse[3300741]:
starting ceph client

$ df -h
ceph-fuse[3300741]: starting fuse$ df -htmpfs 3.2G 0 3.2G 0% /run/user/50831
ceph-fuse 201T 1.9T 199T 1% /mnt/mycephfs-fuse

results matching ""

    No results matching ""