Ceph 分布式存储详解
Ceph 分布式存储系统详解,从版本演进到安装部署,覆盖对象、块和文件存储。
前言
Ceph 是一个统一的分布式存储系统,可以提供对象存储、块存储和文件系统存储。这篇文章从版本介绍开始,逐步讲解 Ceph 的安装和部署过程。
Ceph 版本历史
第一个 Ceph 版本是 0.1,要回溯到 2008 年 1 月。多年来,版本号方案一直没变,直到 2015 年 4 月 0.94.1(Hammer 的第一个修正版)发布后,为了避免 0.99(以及 0.100 或 1.00?),制定了新策略:
x.0.z- 开发版(给早期测试者)x.1.z- 候选版(用于测试集群)x.2.z- 稳定版(给用户)
| 版本名称 | 版本号 | 发布时间 |
|---|---|---|
| Argonaut | 0.48 (LTS) | 2012-06-03 |
| Bobtail | 0.56 (LTS) | 2013-05-07 |
| Cuttlefish | 0.61 | 2013-01-01 |
| Dumpling | 0.67 (LTS) | 2013-08-14 |
| Emperor | 0.72 | 2013-11-09 |
| Firefly | 0.80 (LTS) | 2014-05 |
| Giant | 0.87 | 2014-10 |
| Hammer | 0.94 (LTS) | 2015-04 |
| Infernalis | 9.2.0 | 2015-11 |
| Jewel | 10.2.9 | 2016-04 |
| Kraken | 11.2.1 | 2017-10 |
| Luminous | 12.2.12 | 2017-10 |
| Mimic | 13.2.7 | 2018-05 |
| Nautilus | 14.2.5 | 2019-02 |
| Octopus | 15.2.17 | 2020-03-23 |
| Pacific | 16.2.15 | 2021-03-31 |
| Quincy | 17.2.7 | 2022-04-19 |
| Reef | 18.2.1 | 2023-08-07 |
根据 官网 给出的消息,从 O 版(Octopus)开始(包括 O 版)之前的版本都不会再进行维护更新。
安装方式介绍
| 工具 | 说明 |
|---|---|
| ceph-ansible | 使用 Ansible 部署和管理 Ceph 集群 |
| ceph-deploy | 快速部署集群的工具 |
| Cephadm | 安装和管理 Ceph 集群(推荐) |
Cephadm 特点:
- 只支持 Octopus 及更新版本
- 与编排 API 完全集成
- 需要容器支持(Podman 或 Docker)和 Python 3
- 需要 systemd
环境准备
主机规划
| 主机名 | IP 地址 | 配置 |
|---|---|---|
| center | 192.168.10.100 | 2核2G +20G |
| ceph-node1 | 192.168.10.11 | 2核2G +20G+30G×3 |
| ceph-node2 | 192.168.10.12 | 2核2G +20G+30G×3 |
| ceph-node3 | 192.168.10.13 | 2核2G +20G+30G×3 |
关闭防火墙和 SELinux
# 所有节点执行
systemctl stop firewalld && systemctl disable firewalld && setenforce 0
sed -i 's/enforcing/disabled/' /etc/selinux/config
配置主机名和 hosts
# 各节点分别执行
hostnamectl set-hostname center
hostnamectl set-hostname ceph-1
hostnamectl set-hostname ceph-2
hostnamectl set-hostname ceph-3
# 所有节点添加 hosts 映射
cat >>/etc/hosts <<EOF
192.168.10.100 center
192.168.10.11 ceph-1
192.168.10.12 ceph-2
192.168.10.13 ceph-3
EOF
配置时间同步
# 安装 NTP
yum -y install ntp
# 编辑配置文件(ceph-1/2/3 节点)
vi /etc/ntp.conf
server center iburst # 添加的内容(将原来的注释掉)
# 启动服务
systemctl restart ntpd
systemctl enable ntpd
# 验证时间同步
ntpdate -q <主机IP>
配置免密登录
# 在 center 节点执行
ssh-keygen -t rsa
ssh-copy-id ceph-1
ssh-copy-id ceph-2
ssh-copy-id ceph-3
常见问题
❌ OSD 启动失败
原因:磁盘未正确格式化或权限问题。
解决:
# 检查磁盘状态
ceph disk list
# 格式化磁盘
ceph-volume lvm create --data /dev/sdb
❌ 集群健康状态异常
原因:OSD 数量不足或网络问题。
解决:
# 查看集群状态
ceph -s
ceph health detail
以上就是 Ceph 分布式存储的基础介绍。后续文章会继续深入讲解 Ceph 的高级配置。