不管你是想为云平台提供Ceph 对象存储和/或 Ceph 块设备,还是想部署一个 Ceph 文件系统或者把 Ceph 作为他用,所有 Ceph 存储集群的部署都始于部署一个个 Ceph 节点、网络和 Ceph 存储集群。 Ceph 存储集群至少需要一个 Ceph Monitor 和两个 OSD 守护进程。而运行 Ceph 文件系统客户端时,则必须要有元数据服务器( Metadata Server )。
- Ceph OSDs: Ceph OSD 守护进程( Ceph OSD )的功能是存储数据,处理数据的复制、恢复、回填、再均衡,并通过检查其他OSD 守护进程的心跳来向 Ceph Monitors 提供一些监控信息。当 Ceph 存储集群设定为有2个副本时,至少需要2个 OSD 守护进程,集群才能达到 active+clean 状态( Ceph 默认有3个副本,但你可以调整副本数)。
- Monitors: Ceph Monitor维护着展示集群状态的各种图表,包括监视器图、 OSD 图、归置组( PG )图、和 CRUSH 图。 Ceph 保存着发生在Monitors 、 OSD 和 PG上的每一次状态变更的历史信息(称为 epoch )。
- MDSs: Ceph 元数据服务器( MDS )为 Ceph 文件系统存储元数据(也就是说,Ceph 块设备和 Ceph 对象存储不使用MDS )。元数据服务器使得 POSIX 文件系统的用户们,可以在不对 Ceph 存储集群造成负担的前提下,执行诸如 ls、find 等基本命令。
Ceph 把客户端数据保存为存储池内的对象。通过使用 CRUSH 算法, Ceph 可以计算出哪个归置组(PG)应该持有指定的对象(Object),然后进一步计算出哪个 OSD 守护进程持有该归置组。 CRUSH 算法使得 Ceph 存储集群能够动态地伸缩、再均衡和修复。
Ceph消除了对系统单一中心节点的依赖,从而实现可真正的无中心节点结果的设计思想,这种设计思想是其他分布式存储系统所不能相比的。
Ceph之所以能那么火,与OpenStack有莫大的关系;OpenStack是目前比较流行的开源云管理平台;OpenStack与Ceph的集成已成为开源云平台的标配。
Ceph中文文档,请参考链接:
http://docs.ceph.org.cn/start/intro/
Ceph设计思想
- 每个组件可线性扩展
- 无任何单点故障
- 解决方案必须是基于软件的、开源的、适应性强的
- 运行在现有商业硬件之上,商业硬件一般是指x86服务器
- 每个组件必须尽可能拥有自我管理和自我修复功能
高可用性指的是系统某个组件失效后,系统依然可以提供正常的服务的功能。可以采用设备部件和数据冗余来提高可靠性。在Ceph集群中可通过数据多副本、纠删码这两种方式提供数据冗余。
可线性扩展指的是可以灵活的应对集群伸缩。这里可以指两方面:
1、指集群的存储容量可以伸缩、可以任意添加、删除存储节点和存储设备;
2、指系统的性能随集群的扩充而线性增加。
Ceph应用场景
Ceph可以提供对象存储、块设备存储和文件系统存储,其对象存储可以对接网盘应用业务;其块设备可以对接IaaS云平台软件。IaaS云平台软件包括:OpenStack、CloudStack、Zstack等;其文件系统存储目前还未成熟,官方不建议在生产环境中使用。
Ceph发行版本
Ceph正处于持续开发、快速发展中。debian系列,发行了9个版本。分别是firefly,giant,hammer,infernalis,jewel,kraken,luminous,mimic,testing。
访问下载网站:
就可以到对应的版本中,下载你需要的软件包。
本文所使用的是jewel版本,也称之为候选版本!
二、环境准备
本文所用的环境和具体节点配置如下:
| 操作系统 | 主机名 | IP地址 | 功能 | ceph版本 |
| ubuntu-16.04.5-server-amd64 | jqb-node128 | 192.168.91.128 | MDS,MON,OSDS | 10.2.10 |
| ubuntu-16.04.5-server-amd64 | jqb-node129 | 192.168.91.129 | MON,OSDS | 10.2.10 |
| ubuntu-16.04.5-server-amd64 | jqb-node131 | 192.168.91.131 | MON,OSDS | 10.2.10 |
由于官方要求:至少需要一个 Ceph Monitor 和两个 OSD 守护进程。
所以使用了3台服务器来安装ceph集群。
注意mds只有一台
注意:3台Ubuntu系统,需要启动root账户登录。
接下来的操作,都是以root用户执行的!
主机名
这个非常重要,决定ceph搭建成败就在这里,务必注意!!!
我踩了很多坑,说多了都是泪...!下面说具体操作!
登录3台服务器,查看主机名
cat /etc/hostname
如果输出不是上面表格中的主机名,请务必修改!
修改完成之后,必须要重启服务器才行!
由于这里并没有使用私有的DNS,所以直接用hosts文件来强制解析。
务必保证3台服务器的hosts文件有如下3条记录
192.168.91.128 jqb-node128 192.168.91.129 jqb-node129 192.168.91.131 jqb-node131
更新源
阿里云更新源
由于默认的更新源太慢了,调整为阿里云的更新源
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted deb http://mirrors.aliyun.com/ubuntu/ xenial universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu xenial-security main restricted deb http://mirrors.aliyun.com/ubuntu xenial-security universe deb http://mirrors.aliyun.com/ubuntu xenial-security multiverse
ceph更新源
添加 release key
wget -q -O- 'https://download.ceph.com/keys/release.asc' | sudo apt-key add -
添加Ceph软件包源,用Ceph稳定版(如 cuttlefish 、 dumpling 、 emperor 、 firefly 等等)替换掉 {ceph-stable-release}
deb http://download.ceph.com/debian-{ceph-stable-release}/ $(lsb_release -sc) main
ceph-stable-release 我选择的是jewel版本
那么在ubuntu服务器上面执行命令
echo "deb http://download.ceph.com/debian-jewel/ $(lsb_release -sc) main"
就可以得到结果:
deb http://download.ceph.com/debian-jewel/ xenial main
将这条信息写入/etc/apt/sources.list中,那么文件sources.list完整内容如下:
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted deb http://mirrors.aliyun.com/ubuntu/ xenial universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu xenial-security main restricted deb http://mirrors.aliyun.com/ubuntu xenial-security universe deb http://mirrors.aliyun.com/ubuntu xenial-security multiverse deb http://download.ceph.com/debian-jewel/ xenial main