Ceph 手把手教你部署ceph集群
1、Ceph版本选择
Ceph版本来源介绍
Ceph 社区最新版本是 14,而 Ceph 12 是市面用的最广的稳定版本。
第一个 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 - 稳定、修正版(给用户们)
x 将从 9 算起,它代表 Infernalis ( I 是第九个字母),这样第九个发布周期的第一个开发版就是 9.0.0 ;后续的开发版依次是 9.0.1 、 9.0.2 等等。
| 版本名称 | 版本号 | 发布时间 |
| ------ | ------ | ------ |
| Argonaut | 0.48版本(LTS) | 2012年6月3日 |
| Bobtail | 0.56版本(LTS) | 2013年5月7日 |
| Cuttlefish | 0.61版本 | 2013年1月1日 |
| Dumpling | 0.67版本(LTS) | 2013年8月14日 |
| Emperor | 0.72版本 | 2013年11月9 |
| Firefly | 0.80版本(LTS) | 2014年5月 |
| Giant | Giant | October 2014 - April 2015 |
| Hammer | Hammer | April 2015 - November 2016|
| Infernalis | Infernalis | November 2015 - June 2016 |
| Jewel | 10.2.9 | 2016年4月 |
| Kraken | 11.2.1 | 2017年10月 |
| Luminous |12.2.12 | 2017年10月 |
| mimic | 13.2.7 | 2018年5月 |
| nautilus | 14.2.5 | 2019年2月 |
Luminous新版本特性
- Bluestore
* ceph-osd的新后端存储BlueStore已经稳定,是新创建的OSD的默认设置。BlueStore通过直接管理物理HDD或SSD而不使用诸如XFS的中间文件系统(直接管理裸盘),来管理每个OSD存储的数据,这提供了更大的性能和功能。
* BlueStore支持Ceph存储的所有的完整的数据和元数据校验。
* BlueStore内嵌支持使用zlib,snappy或LZ4进行压缩。(Ceph还支持zstd进行RGW压缩,但由于性能原因,不为BlueStore推荐使用zstd)
- 集群的总体可扩展性有所提高。我们已经成功测试了多达10,000个OSD的集群。
- ceph-mgr
* ceph-mgr是一个新的后台进程,这是任何Ceph部署的必须部分。虽然当ceph-mgr停止时,IO可以继续,但是度量不会刷新,并且某些与度量相关的请求(例如,ceph df)可能会被阻止。我们建议您多部署ceph-mgr的几个实例来实现可靠性。
* ceph-mgr守护进程daemon包括基于REST的API管理。注:API仍然是实验性质的,目前有一些限制,但未来会成为API管理的基础。
* ceph-mgr还包括一个Prometheus插件。
* ceph-mgr现在有一个Zabbix插件。使用zabbix_sender,它可以将集群故障事件发送到Zabbix Server主机。这样可以方便地监视Ceph群集的状态,并在发生故障时发送通知。
2、安装前准备
1. 安装要求
- 最少三台Centos7系统虚拟机用于部署Ceph集群。硬件配置:2C 4G,另外每台机器最少挂载三块硬盘(每块盘5G)
cephnode01 192.168.179.102
cephnode02 192.168.179.103
cephnode03 192.168.179.104
2. 环境准备(在Ceph三台机器上操作)
```
(1)关闭防火墙:
systemctl stop firewalld systemctl disable firewalld
(2)关闭selinux:
sed -i 's/enforcing/disabled/' /etc/selinux/config setenforce 0
(3)关闭NetworkManager
systemctl disable NetworkManager && systemctl stop NetworkManager
(4)添加主机名与IP对应关系:
vim /etc/hosts 192.168.179.102 cephnode01 192.168.179.103 cephnode02 192.168.179.104 cephnode03
(5)设置主机名:
hostnamectl set-hostname cephnode01 hostnamectl set-hostname cephnode02 hostnamectl set-hostname cephnode03
(6)同步网络时间和修改时区
yum install chrony -y systemctl restart chronyd.service && systemctl enable chronyd.service
(7)设置文件描述符
echo "ulimit -SHn 102400" >> /etc/rc.local cat >> /etc/security/limits.conf << EOF * soft nofile 65535 * hard nofile 65535 EOF
(8)内核参数优化
cat >> /etc/sysctl.conf << EOF kernel.pid_max = 4194303 vm.swappiness = 0 EOF sysctl -p
(9)在cephnode01上配置免密登录到cephnode02、cephnode03
[root@cephnode01 ~]# ssh-keygen [root@cephnode01 ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub root@cephnode02 [root@cephnode01 ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub root@cephnode03
(10)read_ahead,通过数据预读并且记载到随机访问内存方式提高磁盘读操作
echo "8192" > /sys/block/sda/queue/read_ahead_kb
(11) I/O Scheduler,SSD要用noop,SATA/SAS使用deadline
echo "deadline" >/sys/block/sd[x]/queue/scheduler echo "noop" >/sys/block/sd[x]/queue/scheduler
```
最后三台机器准备三块5G盘 [root@cephnode01 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 12G 0 disk ?..sda1 8:1 0 512M 0 part /boot ?..sda2 8:2 0 512M 0 part [SWAP] ?..sda3 8:3 0 11G 0 part / sdb 8:16 0 5G 0 disk sr0 11:0 1 1024M 0 rom [root@cephnode02 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 10G 0 disk ?..sda1 8:1 0 500M 0 part /boot ?..sda2 8:2 0 512M 0 part [SWAP] ?..sda3 8:3 0 9G 0 part / sdb 8:16 0 5G 0 disk sr0 11:0 1 1024M 0 rom [root@cephnode03 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 10G 0 disk ?..sda1 8:1 0 1G 0 part /boot ?..sda2 8:2 0 9G 0 part ?..centos-root 253:0 0 8G 0 lvm / ?..centos-swap 253:1 0 1G 0 lvm [SWAP] sdb 8:16 0 5G 0 disk sr0 11:0 1 1024M 0 rom
3、安装Ceph集群
1、编辑内网yum源,将yum源同步到其它节点并提前做好yum makecache
这里使用阿里云的源来安装ceph(注意这个在每个节点上都需要去配置,安装epel源是因为ceph会依赖很多该源里面的包)
[root@cephnode01 ~]# vim /etc/yum.repos.d/ceph.repo [Ceph] name=Ceph packages for $basearch baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el7/$basearch gpgcheck=0 priority=1 [Ceph-noarch] name=Ceph noarch packages baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el7/noarch gpgcheck=0 priority=1 [ceph-source] name=Ceph source packages baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el7/SRPMS gpgcheck=0 priority=1
2、安装ceph-deploy,在node01执行(确认ceph-deploy版本是否为2.0.1,)
#这个工具ceph-deploy相对于kubeadm一样,方便在一个节点推送远程安装 Installed: ceph-deploy.noarch 0:2.0.1-0 [root@cephnode01 ~]# yum install -y ceph-deploy [root@cephnode01 ~]# ceph-deploy version Traceback (most recent call last): File "/usr/bin/ceph-deploy", line 18, in <module> from ceph_deploy.cli import main File "/usr/lib/python2.7/site-packages/ceph_deploy/cli.py", line 1, in <module> import pkg_resources ImportError: No module named pkg_resources [root@cephnode03 ~]# ceph-deploy --help Traceback (most recent call last): File "/usr/bin/ceph-deploy", line 18, in <module> from ceph_deploy.cli import main File "/usr/lib/python2.7/site-packages/ceph_deploy/cli.py", line 1, in <module> import pkg_resources [root@cephnode01 ~]# yum install python-setuptools -y [root@cephnode01 ~]# ceph-deploy --version 2.0.1
3、创建一个my-cluster目录,所有命令在此目录下进行,在node01执行(文件位置和名字可以随意)
以后ceph-deploy执行的命令都在my-cluster目录下执行,以后设计推送文件和密钥都在这个目录下面,相对于这个是最核心的
[root@cephnode01 ~]# mkdir /my-cluster [root@cephnode01 ~]# cd /my-cluster [root@cephnode01 my-cluster]#
4、创建一个Ceph集群,在node01执行
[root@cephnode01 my-cluster]# ceph-deploy new cephnode01 cephnode02 cephnode03 [ceph_deploy.new][DEBUG ] Creating a random mon key... [ceph_deploy.new][DEBUG ] Writing monitor keyring to ceph.mon.keyring... [ceph_deploy.new][DEBUG ] Writing initial config to ceph.conf... [root@cephnode01 my-cluster]# ls ceph.conf ceph-deploy-ceph.log ceph.mon.keyring
这里会生成ceph默认的配置文件
[root@cephnode01 my-cluster]# cat ceph.conf [global] fsid = 406e0c23-755f-4378-bbc9-13548c4d3d64 mon_initial_members = cephnode01, cephnode02, cephnode03 mon_host = 192.168.179.102,192.168.179.103,192.168.179.104 auth_cluster_required = cephx auth_service_required = cephx auth_client_required = cephx
这里写了key推送到哪个节点上面,也就是有权限访问mon,allow*代表所有,集群当中组件通信每个组件都有自己的key
[root@cephnode01 my-cluster]# cat ceph.mon.keyring [mon.] key = AQA3xoNgAAAAABAAEt2YBhfUbUq7I0AYIxWYmA== caps mon = allow *
5、安装Ceph软件(每个节点执行)
在每个节点上安装epel源,包含了
[root@cephnode01 my-cluster]# yum -y install epel-release [root@cephnode02 ~]# yum -y install epel-release [root@cephnode03 ~]# yum -y install epel-release [root@cephnode01 my-cluster]# yum install -y ceph [root@cephnode02 ~]# yum -y install ceph -y [root@cephnode03 ~]# yum -y install ceph -y
官方网站是通过ceph-delopy install 在每个节点安装ceph的,和yum install是一样的,如果使用官网这种方式安装就会将你之前配置的yum源就行修改,改变成官网的源,这样连接官网的源会特别慢,版本也不可以去指定,自己写的配置文件可以指定yum源。有的时候网络不好还会造成安装失败。
[root@cephnode01 my-cluster]# ceph --version ceph version 14.2.20 (36274af6eb7f2a5055f2d53ad448f2694e9046a0) nautilus (stable)
上面安装的源里面很多包都是python因为有些管理组件是python写的
Installing: ceph x86_64 2:14.2.20-0.el7 Ceph 3.0 k Installing for dependencies: ceph-base x86_64 2:14.2.20-0.el7 Ceph 5.4 M ceph-common x86_64 2:14.2.20-0.el7 Ceph 19 M ceph-mds x86_64 2:14.2.20-0.el7 Ceph 1.9 M ceph-mgr x86_64 2:14.2.20-0.el7 Ceph 1.8 M ceph-mon x86_64 2:14.2.20-0.el7 Ceph 4.3 M ceph-osd
6、生成monitor检测集群所使用的的秘钥
[root@cephnode01 my-cluster]# ceph-deploy mon create-initial ..................................... [ceph_deploy.gatherkeys][INFO ] Storing ceph.client.admin.keyring [ceph_deploy.gatherkeys][INFO ] Storing ceph.bootstrap-mds.keyring [ceph_deploy.gatherkeys][INFO ] Storing ceph.bootstrap-mgr.keyring [ceph_deploy.gatherkeys][INFO ] keyring 'ceph.mon.keyring' already exists [ceph_deploy.gatherkeys][INFO ] Storing ceph.bootstrap-osd.keyring [ceph_deploy.gatherkeys][INFO ] Storing ceph.bootstrap-rgw.keyring [ceph_deploy.gatherkeys][INFO ] Destroy temp directory /tmp/tmpMG6FQz
生成了这么多key保存在这里monitor要和所有的组件进行通信,所有的组件都是上报给monitor,monitor会通过这些密钥去访问这些组件
[root@cephnode01 my-cluster]# ls ceph.bootstrap-mds.keyring ceph.bootstrap-rgw.keyring ceph-deploy-ceph.log ceph.bootstrap-mgr.keyring ceph.client.admin.keyring ceph.mon.keyring ceph.bootstrap-osd.keyring ceph.conf
7、安装Ceph CLI,方便执行一些管理命令
[root@cephnode01 my-cluster]# ceph-deploy admin cephnode01 cephnode02 cephnode03
8、配置mgr,用于管理集群
[root@cephnode01 my-cluster]# ceph-deploy mgr create cephnode01 cephnode02 cephnode03 ............................................ [cephnode03][INFO ] Running command: ceph --cluster ceph --name client.bootstrap-mgr --keyring /var/lib/ceph/bootstrap-mgr/ceph.keyring auth get-or-create mgr.cephnode03 mon allow profile mgr osd allow * mds allow * -o /var/lib/ceph/mgr/ceph-cephnode03/keyring [cephnode03][INFO ] Running command: systemctl enable ceph-mgr@cephnode03 [cephnode03][WARNIN] Created symlink from /etc/systemd/system/ceph-mgr.target.wants/ceph-mgr@cephnode03.service to /usr/lib/systemd/system/ceph-mgr@.service. [cephnode03][INFO ] Running command: systemctl start ceph-mgr@cephnode03 [cephnode03][INFO ] Running command: systemctl enable ceph.target
9、部署rgw
[root@cephnode01 my-cluster]# yum install -y ceph-radosgw [root@cephnode01 my-cluster]# ceph-deploy rgw create cephnode01 .................................................... [cephnode01][INFO ] Running command: ceph --cluster ceph --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/ceph.keyring auth get-or-create client.rgw.cephnode01 osd allow rwx mon allow rw -o /var/lib/ceph/radosgw/ceph-rgw.cephnode01/keyring [cephnode01][INFO ] Running command: systemctl enable ceph-radosgw@rgw.cephnode01 [cephnode01][WARNIN] Created symlink from /etc/systemd/system/ceph-radosgw.target.wants/ceph-radosgw@rgw.cephnode01.service to /usr/lib/systemd/system/ceph-radosgw@.service. [cephnode01][INFO ] Running command: systemctl start ceph-radosgw@rgw.cephnode01 [cephnode01][INFO ] Running command: systemctl enable ceph.target [ceph_deploy.rgw][INFO ] The Ceph Object Gateway (RGW) is now running on host cephnode01 and default port 7480
如果以后要添加rgw,在找一台机器安装ceph rgw,然后creat一下就加入到集群里面了,其他组件也是一样,这里端口为7480
10、部署MDS(CephFS)
[root@cephnode01 my-cluster]# ceph-deploy mds create cephnode01 cephnode02 cephnode03 ........................................... [cephnode03][INFO ] Running command: ceph --cluster ceph --name client.bootstrap-mds --keyring /var/lib/ceph/bootstrap-mds/ceph.keyring auth get-or-create mds.cephnode03 osd allow rwx mds allow mon allow profile mds -o /var/lib/ceph/mds/ceph-cephnode03/keyring [cephnode03][INFO ] Running command: systemctl enable ceph-mds@cephnode03 [cephnode03][WARNIN] Created symlink from /etc/systemd/system/ceph-mds.target.wants/ceph-mds@cephnode03.service to /usr/lib/systemd/system/ceph-mds@.service. [cephnode03][INFO ] Running command: systemctl start ceph-mds@cephnode03 [cephnode03][INFO ] Running command: systemctl enable ceph.target
4、Ceph集群服务
可以看到现在启动了哪些服务,ceph-mon,ceph-mgr,ceph-mds,radosgw
[root@cephnode01 my-cluster]# ps -ef | grep ceph | grep -v grep root 11230 1 0 15:26 ? 00:00:00 /usr/bin/python2.7 /usr/bin/ceph-crash ceph 11995 1 0 15:32 ? 00:00:06 /usr/bin/ceph-mon -f --cluster ceph --id cephnode01 --setuser ceph --setgroup ceph ceph 12410 1 1 15:37 ? 00:00:06 /usr/bin/ceph-mgr -f --cluster ceph --id cephnode01 --setuser ceph --setgroup ceph ceph 12735 1 0 15:43 ? 00:00:00 /usr/bin/ceph-mds -f --cluster ceph --id cephnode01 --setuser ceph --setgroup ceph root 12782 1 0 15:45 ? 00:00:00 /usr/bin/radosgw -f --cluster ceph --name client.rgw.cephnode01 --setuser ceph --setgroup ceph
二节点,ceph-mon,ceph-mgr,ceph-mds,三节点也一样
[root@cephnode02 ~]# ps -ef | grep ceph | grep -v grep root 2647 1 0 15:29 ? 00:00:00 /usr/bin/python2.7 /usr/bin/ceph-crash ceph 3420 1 0 15:32 ? 00:00:04 /usr/bin/ceph-mon -f --cluster ceph --id cephnode02 --setuser ceph --setgroup ceph ceph 3598 1 0 15:38 ? 00:00:02 /usr/bin/ceph-mgr -f --cluster ceph --id cephnode02 --setuser ceph --setgroup ceph ceph 3750 1 0 15:43 ? 00:00:00 /usr/bin/ceph-mds -f --cluster ceph --id cephnode02 --setuser ceph --setgroup ceph [root@cephnode03 ~]# ps -ef | grep ceph | grep -v grep root 15497 1 0 15:28 ? 00:00:00 /usr/bin/python2.7 /usr/bin/ceph-crash ceph 15657 1 0 15:32 ? 00:00:04 /usr/bin/ceph-mon -f --cluster ceph --id cephnode03 --setuser ceph --setgroup ceph ceph 15829 1 0 15:38 ? 00:00:01 /usr/bin/ceph-mgr -f --cluster ceph --id cephnode03 --setuser ceph --setgroup ceph ceph 15979 1 0 15:43 ? 00:00:00 /usr/bin/ceph-mds -f --cluster ceph --id cephnode03 --setuser ceph --setgroup ceph
查看集群状态,如果有问题都会在上面展示
[root@cephnode01 my-cluster]# ceph -s 这个就是monitor检查的状态,现在集群里面没有osd cluster: id: 406e0c23-755f-4378-bbc9-13548c4d3d64 health: HEALTH_WARN Reduced data availability: 32 pgs inactive OSD count 0 < osd_pool_default_size 3 mons are allowing insecure global_id reclaim 集群里面有哪些服务 services: mon: 3 daemons, quorum cephnode01,cephnode02,cephnode03 (age 15m) mgr: cephnode01(active, since 10m), standbys: cephnode02, cephnode03 mds: 3 up:standby osd: 0 osds: 0 up, 0 in 有哪些数据,都展示在这里 data: pools: 1 pools, 32 pgs objects: 0 objects, 0 B usage: 0 B used, 0 B / 0 B avail pgs: 100.000% pgs unknown 32 unknown
没有osd的话,那么这个集群是存储不了数据的,这个时候就需要往里面添加数据
[root@cephnode01 my-cluster]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 12G 0 disk ?..sda1 8:1 0 512M 0 part /boot ?..sda2 8:2 0 512M 0 part [SWAP] ?..sda3 8:3 0 11G 0 part / sdb 8:16 0 5G 0 disk sr0 11:0 1 1024M 0 rom [root@cephnode01 my-cluster]# ceph-deploy osd create --data /dev/sdb cephnode01 ........................... [cephnode01][WARNIN] Running command: /usr/bin/systemctl start ceph-osd@0 [cephnode01][WARNIN] --> ceph-volume lvm activate successful for osd ID: 0 [cephnode01][WARNIN] --> ceph-volume lvm create successful for: /dev/sdb [cephnode01][INFO ] checking OSD status... [cephnode01][DEBUG ] find the location of an executable [cephnode01][INFO ] Running command: /bin/ceph --cluster=ceph osd stat --format=json [ceph_deploy.osd][DEBUG ] Host cephnode01 is now ready for osd use.
[cephnode01][WARNIN] --> ceph-volume lvm activate successful for osd ID: 0 [cephnode01][WARNIN] --> ceph-volume lvm create successful for: /dev/sdb
osd添加完了,osd的编号为0,用的盘为sdb
[root@cephnode01 my-cluster]# ceph -s cluster: id: 406e0c23-755f-4378-bbc9-13548c4d3d64 health: HEALTH_WARN Reduced data availability: 32 pgs inactive Degraded data redundancy: 32 pgs undersized OSD count 1 < osd_pool_default_size 3 mons are allowing insecure global_id reclaim services: mon: 3 daemons, quorum cephnode01,cephnode02,cephnode03 (age 22m) mgr: cephnode01(active, since 17m), standbys: cephnode02, cephnode03 mds: 3 up:standby osd: 1 osds: 1 up (since 2m), 1 in (since 2m) data: pools: 1 pools, 32 pgs objects: 0 objects, 0 B usage: 1.0 GiB used, 4.0 GiB / 5.0 GiB avail pgs: 100.000% pgs not active 32 undersized+peered 等一下下 [root@cephnode01 my-cluster]# ceph -s cluster: id: 406e0c23-755f-4378-bbc9-13548c4d3d64 health: HEALTH_OK services: mon: 3 daemons, quorum cephnode01,cephnode02,cephnode03 (age 8m) mgr: cephnode01(active, since 71m), standbys: cephnode03, cephnode02 mds: 3 up:standby osd: 3 osds: 3 up (since 11m), 3 in (since 47m) rgw: 1 daemon active (cephnode01) task status: data: pools: 4 pools, 128 pgs objects: 187 objects, 1.2 KiB usage: 3.0 GiB used, 12 GiB / 15 GiB avail pgs: 128 active+clean
osd: 1 osds: 1 up (since 2m), 1 in (since 2m)
有一个osd,状态为up,in代表在集群里面
OSD count 1 < osd_pool_default_size 3
osd默认是三副本,最少需要三个osd,因为一份数据要放在三个osd节点上,把另外两个加进来,这样集群才是健康状态
[root@cephnode01 my-cluster]# ceph-deploy osd create --data /dev/sdb cephnode02 ............................. [cephnode02][WARNIN] Running command: /bin/systemctl start ceph-osd@1 [cephnode02][WARNIN] --> ceph-volume lvm activate successful for osd ID: 1 [cephnode02][WARNIN] --> ceph-volume lvm create successful for: /dev/sdb [cephnode02][INFO ] checking OSD status... [cephnode02][DEBUG ] find the location of an executable [cephnode02][INFO ] Running command: /bin/ceph --cluster=ceph osd stat --format=json [ceph_deploy.osd][DEBUG ] Host cephnode02 is now ready for osd use. [root@cephnode02 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 10G 0 disk ?..sda1 8:1 0 500M 0 part /boot ?..sda2 8:2 0 512M 0 part [SWAP] ?..sda3 8:3 0 9G 0 part / sdb 8:16 0 5G 0 disk ?..ceph--4e10b4f2--109a--4907--ac37--0d7a842dac3d-osd--block--e064194a--00b0--47d5--80a7--a2cddcb5faf0 253:0 0 5G 0 lvm sr0 11:0 1 1024M 0 rom [root@cephnode02 ~]# ps -ef | grep osd ceph 4105 1 0 16:00 ? 00:00:02 /usr/bin/ceph-osd -f --cluster ceph --id 1 --setuser ceph --setgroup ceph
[root@cephnode01 my-cluster]# ceph-deploy osd create --data /dev/sdb cephnode03 [cephnode03][WARNIN] Running command: /bin/systemctl start ceph-osd@2 [cephnode03][WARNIN] --> ceph-volume lvm activate successful for osd ID: 2 [cephnode03][WARNIN] --> ceph-volume lvm create successful for: /dev/sdb [cephnode03][INFO ] checking OSD status... [cephnode03][DEBUG ] find the location of an executable [cephnode03][INFO ] Running command: /bin/ceph --cluster=ceph osd stat --format=json [ceph_deploy.osd][DEBUG ] Host cephnode03 is now ready for osd use. [root@cephnode03 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 10G 0 disk ?..sda1 8:1 0 1G 0 part /boot ?..sda2 8:2 0 9G 0 part ?..centos-root 253:0 0 8G 0 lvm / ?..centos-swap 253:1 0 1G 0 lvm [SWAP] sdb 8:16 0 5G 0 disk ?..ceph--a0ddd031--8214--401c--8aea--497c843d0af2-osd--block--18b6a24a--631f--4d50--aea8--1d4c9cad975d 253:2 0 5G 0 lvm sr0 11:0 1 1024M 0 rom [root@cephnode03 ~]# ps -ef | grep osd ceph 16341 1 0 16:02 ? 00:00:02 /usr/bin/ceph-osd -f --cluster ceph --id 2 --setuser ceph --setgroup ceph
查看一下节点状态,刚刚加完所有盘数据还需要花时间平衡
[root@cephnode01 my-cluster]# ceph -s cluster: id: 406e0c23-755f-4378-bbc9-13548c4d3d64 health: HEALTH_WARN mons are allowing insecure global_id reclaim services: mon: 3 daemons, quorum cephnode01,cephnode02,cephnode03 (age 30m) mgr: cephnode01(active, since 25m), standbys: cephnode02, cephnode03 mds: 3 up:standby osd: 3 osds: 3 up (since 76s), 3 in (since 76s) rgw: 1 daemon active (cephnode01) task status: data: pools: 4 pools, 128 pgs objects: 187 objects, 1.2 KiB usage: 3.0 GiB used, 12 GiB / 15 GiB avail pgs: 128 active+clean
查看osd
[root@cephnode01 my-cluster]# ceph osd df ID CLASS WEIGHT REWEIGHT SIZE RAW USE DATA OMAP META AVAIL %USE VAR PGS STATUS 0 hdd 0.00490 1.00000 5.0 GiB 1.0 GiB 3.9 MiB 0 B 1 GiB 4.0 GiB 20.09 1.00 128 up 1 hdd 0.00490 1.00000 5.0 GiB 1.0 GiB 3.9 MiB 0 B 1 GiB 4.0 GiB 20.09 1.00 128 up 2 hdd 0.00490 1.00000 5.0 GiB 1.0 GiB 3.9 MiB 0 B 1 GiB 4.0 GiB 20.09 1.00 128 up TOTAL 15 GiB 3.0 GiB 12 MiB 0 B 3 GiB 12 GiB 20.09 [root@cephnode01 my-cluster]# ceph osd tree ID CLASS WEIGHT TYPE NAME STATUS REWEIGHT PRI-AFF -1 0.01469 root default -3 0.00490 host cephnode01 0 hdd 0.00490 osd.0 up 1.00000 1.00000 -5 0.00490 host cephnode02 1 hdd 0.00490 osd.1 up 1.00000 1.00000 -7 0.00490 host cephnode03 2 hdd 0.00490 osd.2 up 1.00000 1.00000
生产环境加盘,插入盘。让系统可以识别到lsblk查看,之后对着盘符,对着机器名加进来就可以了(ceph-deploy osd create --data /dev/sdb cephnode03),生产环境都是一块盘,两块盘,三块盘加。一次性加太多盘容易产生大量读写,使得集群性能降低,容易hang住,在ceph -s里面可以看到,盘大一块一块加。
这个是集群时间不同步
加盘要额外小心,TB级别的盘恢复起来速度非常慢,不像应用重启一下就行。
目录 返回
首页