解决:调整ceph集群的限制比例,消除写锁,然后再进行删除。
# 查看集群osd详细状态
$ ceph health detail
HEALTH_ERR 1 full osd(s); 3 near full osd(s); full flag(s) set
osd.19 is full at 80%
osd.6 is near full at 75%
osd.7 is near full at 76%
osd.15 is near full at 71%
full flag(s) set
# 修改osd最大可写容量比例
## 修改前为80%,修改后为85%
$ ceph tell osd.* injectargs '--mon-osd-full-ratio 85'
$ ceph tell osd.* injectargs '--mon-osd-full-ratio 0.85'
$ ceph pg set_full_ratio 0.85
# 此时再查看集群状态,已经恢复。删除无用的数据
# 例子:rbd rm volumes/volume-fb2eb4e8-9871-4048-b7fa-d6494be06b44 3、调整osd权重
通常osd full发生时,并不是全部osd都达到full的比例。此时可以调整full的osd的存储比重,从而降低该osd存储数据的比例,实现数据的自动平衡(按设定的比例,移动部分数据到其他的osd)。
默认安装时,ceph集群会按磁盘容量自动设置osd比重,范围0~1。
# 查看集群osd的比重
$ ceph osd tree
ID WEIGHT TYPE NAME UP/DOWN REWEIGHT PRIMARY-AFFINITY
-1 18.43690 root default
-2 2.63699 host controller-3
0 0.87900 osd.0 up 1.00000 1.00000
2 0.87900 osd.2 up 1.00000 1.00000
3 0.87900 osd.3 up 1.00000 1.00000
-3 2.63699 host controller-1
1 0.87900 osd.1 up 1.00000 1.00000
4 0.87900 osd.4 up 1.00000 1.00000
15 0.87900 osd.15 up 1.00000 1.00000
# 例:调整osd15的比重为0.7
$ ceph osd crush reweight osd.15 0.7
# 查看集群osd的比重
$ ceph osd tree
ID WEIGHT TYPE NAME UP/DOWN REWEIGHT PRIMARY-AFFINITY
-1 18.43690 root default
-2 2.63699 host controller-3
0 0.87900 osd.0 up 1.00000 1.00000
2 0.87900 osd.2 up 1.00000 1.00000
3 0.87900 osd.3 up 1.00000 1.00000
-3 2.63699 host controller-1
1 0.87900 osd.1 up 1.00000 1.00000
4 0.87900 osd.4 up 1.00000 1.00000
15 0.87900 osd.15 up 1.00000 1.00000
# 例:调整osd15的比重为0.7
$ ceph osd crush reweight osd.15 0.7 调整后集群会根据比重,自动移动数据进行平衡。调整的比重可以通过计算得出,也可以逐步降低比重,查看集群状况再进行调整。
直到full的osd状态改变为nearfull,集群可以进行写操作。
ceph osd crush reweight 和 ceph osd reweight 的区别:
"ceph osd crush reweight" sets the CRUSH weight of the OSD. This
weight is an arbitrary value (generally the size of the disk in TB or
something) and controls how much data the system tries to allocate to
the OSD.
"ceph osd reweight" sets an override weight on the OSD. This value is
in the range 0 to 1, and forces CRUSH to re-place (1-weight) of the
data that would otherwise live on this drive. It does *not* change the
weights assigned to the buckets above the OSD, and is a corrective
measure in case the normal CRUSH distribution isn't working out quite
right. (For instance, if one of your OSDs is at 90% and the others are
at 50%, you could reduce this weight to try and compensate for it.)