013 CephFS文件系统
一、Ceph文件系统简介
CephFS提供兼容POSIX的文件系统,将其数据和与那数据作为对象那个存储在Ceph中
CephFS依靠MDS节点来协调RADOS集群的访问
元数据服务器
MDS管理元数据(文件的所有者、时间戳和模式等),也负责缓存元数据访问权限,管理客户端缓存来维护缓存一致性。
CephFS客户端首先联系MON,进行身份验证后,将查询活跃MDS的文件元数据,并通过直接与OSD通信来访问文件或目录的对象。
Ceph支持一个集群中有一个活跃的MDS,多个备用MDS。目前也支持同时多个活跃MDS,但该功能尚未GA
目前Ceph仅支持一个集群中有一个活跃的CephFS文件系统
目前CephFS的快照功能尚未GA
在ceph2部署mds
二、部署
2.1 安装mds包
[root@ceph2 ~]# yum -y install ceph-mds
授权
[root@ceph2 ~]# ceph auth get-or-create mds.ceph2 mon 'allow profile mds' osd 'allow rwx' msd 'allow' -o /etc/ceph/ceph.mds.ceph2.keyring
[root@ceph2 ~]# systemctl restart ceph-mds@ceph2
[root@ceph2 ~]# mkdir /var/lib/ceph/mds/ceph-ceph2
[root@ceph2 ~]# mv /etc/ceph/ceph.mds.ceph2.keyring /var/lib/ceph/mds/ceph-ceph2/keyring
[root@ceph2 ~]# chown ceph.ceph /var/lib/ceph/mds/ceph-ceph2/keyring
[root@ceph2 ~]# /usr/bin/ceph-mds -f --cluster ceph --id ceph2 --setuser ceph --setgroup ceph
- starting mds.ceph2 at -
[root@ceph2 ~]# systemctl restart ceph-mds@ceph2
[root@ceph2 ~]# ps -ef |grep mds
- ceph : ? :: /usr/bin/ceph-mds -f --cluster ceph --id ceph2 --setuser ceph --setgroup ceph
2.2 创建Ceph文件系统
CephFS文件系统需要两个存储池,一个用于存储CephFS数据,一个用于存储CephFS元数据
- [root@ceph2 ~]# ceph osd pool create cephfs_metadata
- pool 'cephfs_metadata' created
- [root@ceph2 ~]# ceph osd pool create cephfs_data
- pool 'cephfs_data' created
创建一个名叫cephfs的文件系统
- [root@ceph2 ~]# ceph fs new cephfs cephfs_metadata cephfs_data
- new fs with metadata pool and data pool
- [root@ceph2 ~]# ceph -s
- cluster:
- id: 35a91e48--4e96-a7ee-980ab989d20d
- health: HEALTH_OK
- services:
- mon: daemons, quorum ceph2,ceph3,ceph4
- mgr: ceph4(active), standbys: ceph2, ceph3
- mds: cephfs-// up {=ceph2=up:active}
- osd: osds: up, in
- rbd-mirror: daemon active
- data:
- pools: pools, pgs
- objects: objects, MB
- usage: MB used, GB / GB avail
- pgs: active+clean
- io:
- client: B/s rd, B/s wr, op/s rd, op/s wr
2.4 查看
[root@ceph2 ~]# ceph fs status
2.5 在ceoh3上安装MDS
- [root@ceph3 ~]# yum -y install ceph-mds
- [root@ceph3 ~]# mkdir /var/lib/ceph/mds/ceph-ceph3
- [root@ceph3 ~]# ceph auth get-or-create mds.ceph3 mon 'allow profile mds' osd 'allow rwx' mds 'allow' -o /var/lib/ceph/mds/ceph-ceph3/keyring
- [root@ceph3 ~]# chown ceph.ceph /var/lib/ceph/mds/ceph-ceph3/keyring
- [root@ceph3 ~]# systemctl restart ceph-mds@ceph3
- [root@ceph3 ~]# ps -ef|grep mds
- ceph : ? :: /usr/bin/ceph-mds -f --cluster ceph --id ceph3 --setuser ceph --setgroup ceph
[root@ceph3 ~]# ceph fs status
注:默认情况下,ceph只支持一个活跃的mds,其他的作为备用mds,但目前在实验性质下也可以同时开启多个活跃的mds,生产环境不保证数据的完整性
2.5 创建授权用户进行挂载操作
- [root@ceph2 ~]# ceph auth get-or-create client.cephfs mon 'allow r' osd 'allow rw pool=cephfs_metadata,allow rw pool=cephfs_data' -o /etc/ceph/ceph.client.cephfs.keyring
- [root@ceph2 ~]# ll /etc/ceph/ceph.client.cephfs.keyring
- -rw-r--r-- root root Mar : /etc/ceph/ceph.client.cephfs.keyring
- [root@ceph2 ~]# scp /etc/ceph/ceph.client.cephfs.keyring root@ceph1:/etc/ceph/
- root@ceph1's password:
- ceph.client.cephfs.keyring
2.6 在ceph1上测试秘钥环是否可用
- [root@ceph1 ~]# ceph -s --id cephfs
- cluster:
- id: 35a91e48--4e96-a7ee-980ab989d20d
- health: HEALTH_OK
- services:
- mon: daemons, quorum ceph2,ceph3,ceph4
- mgr: ceph4(active), standbys: ceph2, ceph3
- mds: cephfs-// up {=ceph2=up:active}, up:standby #一个主,一个备
- osd: osds: up, in
- rbd-mirror: daemon active
- data:
- pools: pools, pgs
- objects: objects, MB
- usage: MB used, GB / GB avail
- pgs: active+clean
- io:
- client: B/s wr, op/s rd, op/s wr
2.7 使用cephfs挂载
挂载卡住,修改用户权限,再次尝试
- [root@ceph2 ~]# cd /etc/ceph/
- [root@ceph2 ceph]# rm -rf ceph.client.cephfs.keyring
- [root@ceph2 ceph]# ceph auth caps client.cephfs mon 'allow r' mds 'allow' osd 'allow rw pool=cephfs_metadata, allow rw pool=cephfs_data' -o /etc/ceph/ceph.client.cephfs.keyring
- updated caps for client.cephfs
- [root@ceph2 ceph]# ceph auth get-or-create client.cephfs -o /etc/ceph/ceph.client.cephfs.keyring
- [root@ceph2 ceph]# cat /etc/ceph/ceph.client.cephfs.keyring
- [client.cephfs]
- key = AQAl8Zlcdbt/DRAA3cHKjt2BFSCY7cmio6mrXw==
- [root@ceph2 ceph]# scp /etc/ceph/ceph.client.cephfs.keyring ceph1:/etc/ceph/
- root@ceph1's password:
- ceph.client.cephfs.keyring
2.8 挂载
- root@ceph1 ~]# ceph-fuse --keyring /etc/ceph/ceph.client.cephfs.keyring --name client.cephfs -m ceph2:,ceph3:,ceph4: /mnt/cephfs/
- ceph-fuse[]: starting ceph client
- -- ::26.351649 7f4a3242b040 - init, newargv = 0x55bc8e6bba40 newargc=
- ceph-fuse[]: starting fuse
- [root@ceph1 ~]# df -hT
- Filesystem Type Size Used Avail Use% Mounted on
- /dev/vda1 xfs 40G .7G 39G % /
- devtmpfs devtmpfs 893M 893M % /dev
- tmpfs tmpfs 920M 920M % /dev/shm
- tmpfs tmpfs 920M 25M 896M % /run
- tmpfs tmpfs 920M 920M % /sys/fs/cgroup
- /dev/rbd1 xfs .0G 33M .0G % /mnt/ceph2
- /dev/rbd0 xfs .0G 33M .0G % /mnt/ceph
- tmpfs tmpfs 184M 184M % /run/user/
- ceph-fuse fuse.ceph-fuse 43G 43G % /mnt/cephfs #挂载成功
- [root@ceph1 ~]# cd /mnt/cephfs/
- [root@ceph1 cephfs]# touch 111 #尝试写数据,正常
- [root@ceph1 cephfs]# echo sucessfull >>
- [root@ceph1 cephfs]# cat
- sucessfull
2.9 写进启动文件
- [root@ceph1 cephfs]# cd
- [root@ceph1 ~]# umount /mnt/cephfs
- [root@ceph1 ~]# echo "id=cephfs,keyring=/etc/ceph/ceph.client.cephfs.keyring /mnt/cephfs fuse.ceph defaults,_netdev 0 0 " >> /etc/fstab
- [root@ceph1 ~]# mount -a
- mount: special device /dev/rbd/rbd/testimg-copy does not exist
- ceph-fuse[]: starting ceph client
- -- ::57.070081 7f25f0c5c040 - init, newargv = 0x55aa8aab30a0 newargc=
- ceph-fuse[]: starting fuse
- [root@ceph1 ~]# df -hT
- Filesystem Type Size Used Avail Use% Mounted on
- /dev/vda1 xfs 40G .7G 39G % /
- devtmpfs devtmpfs 893M 893M % /dev
- tmpfs tmpfs 920M 920M % /dev/shm
- tmpfs tmpfs 920M 25M 896M % /run
- tmpfs tmpfs 920M 920M % /sys/fs/cgroup
- /dev/rbd1 xfs .0G 33M .0G % /mnt/ceph2
- /dev/rbd0 xfs .0G 33M .0G % /mnt/ceph
- tmpfs tmpfs 184M 184M % /run/user/
- ceph-fuse fuse.ceph-fuse 43G 43G % /mnt/cephfs #成功
- [root@ceph1 ~]# cd /mnt/cephfs/
- [root@ceph1 cephfs]# ll
- total
- -rw-r--r-- root root Mar :
2.10 使用内核挂载
- ceph auth get-key client.cephfs -o /etc/ceph/cephfskey
- [root@ceph2 ceph]# ll /etc/ceph/cephfskey
- -rw-r--r-- root root Mar : /etc/ceph/cephfskey
- [root@ceph2 ceph]# scp /etc/ceph/cephfskey ceph1:/etc/ceph/
- root@ceph1's password:
- cephfskey
- [root@ceph1 ~]# mount -t ceph ceph2:,ceph3:,ceph4::/ /mnt/cephfs -o name=cephfs,secretfile=/etc/ceph/cephfskey
- [root@ceph1 ~]# df -hT
- Filesystem Type Size Used Avail Use% Mounted on
- /dev/vda1 xfs 40G .7G 39G % /
- devtmpfs devtmpfs 893M 893M % /dev
- tmpfs tmpfs 920M 920M % /dev/shm
- tmpfs tmpfs 920M 25M 896M % /run
- tmpfs tmpfs 920M 920M % /sys/fs/cgroup
- /dev/rbd1 xfs .0G 33M .0G % /mnt/ceph2
- /dev/rbd0 xfs .0G 33M .0G % /mnt/ceph
- tmpfs tmpfs 184M 184M % /run/user/
- 172.25.250.11:,172.25.250.12:,172.25.250.13::/ ceph 135G .8G 134G % /mnt/cephfs
- [root@ceph1 ~]# echo "ceph2:6789,ceph3:6789,ceph4:6789:/ /mnt/cephfs ceph name=cephfs,secretfile=/etc/ceph/cephfskey,noatime,_netdev 0 0" >> /etc/fstab
注:
通过内核客户端挂载时,可能出现超时,解决办法:
ceph osd crush tunables hammer
ceph osd crush reweight-all
实验完成!!!
博主声明:本文的内容来源主要来自誉天教育晏威老师,由本人实验完成操作验证,需要的博友请联系誉天教育(http://www.yutianedu.com/),获得官方同意或者晏老师(https://www.cnblogs.com/breezey/)本人同意即可转载,谢谢!
013 CephFS文件系统的更多相关文章
- cephfs文件系统场景
创建cephfs文件系统: [cephfsd@ceph-admin ceph]$ cd /etc/ceph [cephfsd@ceph-admin ceph]$ ceph fs ls No files ...
- ceph 008 ceph多区域网关(ceph对象容灾) cephfs文件系统
clienta作为集群的管理人员.一部分.他是需要秘钥与配置文件的 但真正服务端只需要通过curl就好 ceph 多区域网关 对象存储容灾解决方案 zone与zone会做数据同步. 把会做同步的rgw ...
- 6.Ceph 基础篇 - CephFS 文件系统
文章转载自:https://mp.weixin.qq.com/s?__biz=MzI1MDgwNzQ1MQ==&mid=2247485294&idx=1&sn=e9039504 ...
- Ceph 文件系统 CephFS 的实战配置,等你来学习 -- <4>
Ceph 文件系统 CephFS 的介绍与配置 CephFs介绍 Ceph File System (CephFS) 是与 POSIX 标准兼容的文件系统, 能够提供对 Ceph 存储集群上的文件访问 ...
- Ceph RBD CephFS 存储
Ceph RBD CephFS 存储 环境准备: (这里只做基础测试, ceph-manager , ceph-mon, ceph-osd 一共三台) 10.6.0.140 = ceph-manag ...
- kubernetes多节点的pod挂载同一个cephfs目录
一.安装cephfs 方法一: 直接进入deploy目录,执行: ceph-deploy --overwrite-conf mds create ceph01:mds-daemon- 上面的ceph0 ...
- Centos7部署CephFS
标签(空格分隔): ceph环境,ceph,cephfs cephfs部署之前准备工作: 1. 一个 clean+active 的cluster cluster部署参考:centos7下搭建ceph ...
- IO解惑:cephfs、libaio与io瓶颈
最近笔者在对kernel cephfs客户端进行fio direct随机大io读测试时发现,在numjobs不变的情况下,使用libaio作为ioengine,无论怎么调节iodepth,测试结果都变 ...
- Ubuntu 18.04.5 LTS Ceph集群之 cephx 认证及使用普通用户挂载RBD和CephFS
1.cephx认证和授权 1.1 CephX认证机制 Ceph使用cephx协议对客户端进行身份认证: 1.每个MON都可以对客户端进行身份验正并分发密钥, 不存在单点故障和性能瓶颈 2. MON会返 ...
随机推荐
- C++四:继承与派生
C++四:继承与派生 一.概念 继承就是从先辈处得到属性和行为特性.类的继承,是指新的类从已有类的那里得到的特性.类的派生,就是指已有类产生新类的过程. 二.应用 定义为 class 派生类名: ...
- 大侦探福老师——幽灵Crash谜踪案
闲鱼Flutter技术的基础设施已基本趋于稳定,就在我们准备松口气的时候,一个Crash却异军突起冲击着我们的稳定性防线!闲鱼技术火速成立侦探小组执行嫌犯侦查行动,经理重重磨难终于在一个隐蔽的角落将其 ...
- 4、安装supervisor
1.安装 sudo apt-get install supervisor 2.如果报phthond2.7错误,则执行 easy_install supervisor 3.配置文件位置和配置文件例子 配 ...
- Spark-shell批量命令执行脚本
#!/bin/bash source /etc/profile exec $SPARK_HOME/bin/spark-shell --queue tv --name spark-sql-test -- ...
- Python 3.7.0 For Mac版软件安装教程附下载地址
https://www.jianshu.com/p/f02d6f01eba7
- springboot2动态数据源的绑定
由于springboot2更新了绑定参数的api,部分springboot1用于绑定的工具类如RelaxedPropertyResolver已经无法在新版本中使用.本文实现参考了https://blo ...
- HOSt ip is not allowed to connect to this MySql server, MYSQL添加远程用户或允许远程访问三种方法
HOSt ip is not allowed to connect to this MySql server 报错:1130-host ... is not allowed to connect to ...
- PHP两个变量值互换(不用第三变量)
<?php /** * 双方变量为数字或者字符串时 * 使用list()和array()方法可以达到交换变量值得目的 */ $a = "This is A"; // a ...
- Python--day41--thread1.join()
在 Python 的多线程编程中,在实例代码中经常有 thread1.join()这样的代码.那么今天咱们用实际代码来解释一下 join 函数的作用. join的原理就是依次检验线程池中的线程是否结束 ...
- LOGO的浮空显示-Verilog
为了方便生成准确的mif数据,以实现特定的透明效果.使用Photoshop将网上下载的Logo修改颜色,保存大小为120*120像素,如图1所示. 图1 ps修改后的Logo 使用Pic2mif软件, ...