当前版本
ceph version 15.2.16 octopus (stable)
1,创建池报错
方法1
#以下错
[ceph: root@ceph25 /]# ceph osd pool create kubernetes 64 64
Error ERANGE: pg_num 64 size 3 would mean 939 total pgs, which exceeds max 750 (mon_max_pg_per_osd 250 * num_in_osds 3)
#解决方法
[root@ceph25 ~]# ceph config show-with-defaults osd.0 | grep mon_max_pg_per_osd
mon_max_pg_per_osd 250
#OSD 的最大 PG(默认为 250)设置为500
ceph config set mon mon_max_pg_per_osd 500
方法2
自动缩放
在少于50个OSD的情况下也可以使用自动的方式。
每一个Pool都有一个pg_autoscale_mode参数,有三个值:
off:禁用自动缩放。
on:启用自动缩放。
warn:在应该调整PG数量时报警
对现有的pool启用自动缩放
ceph osd pool set <pool-name> pg_autoscale_mode <mode>
ceph osd pool set nfs-pools pg_autoscale_mode on
为了防止Pool中PG数量在数据多了以后再自动调整,可以提前指定一个大小。
ceph osd pool set mypool target_size_bytes 100T
[root@ceph1 ~]# ceph osd pool create test1 100 100
pool 'test1' created
[root@ceph ~]# ceph osd pool set test1 target_size_bytes 10G
set pool 7 target_size_bytes to 10G
[root@ceph ~]# ceph osd pool set test1 pg_autoscale_mode on
set pool 7 pg_autoscale_mode to on
查看一下状态:
查看自动缩放状态
需要启用mgr里的pg_autoscaler模块。
ceph mgr module enable pg_autoscaler
- SIZE: 存储在Pool中的数据量。
- TARGET SIZE: 指定的数据量。自动调整会根据SIZE与TARGET SIZE中大的值做计算。
RATE: - RAW CAPACITY: 集群存储的总容量
- TARGET RATIO: 与其他Pool的存储比率。如果同时指定了SIZE与TARGET RATIO,则TARGET RATIO优先。
EFFECTIVE RATIO: - PG_NUM: 当前Pool中的PG数量。
- NEW PG_NUM: 将要更改的值,将要变成PG_NUM。 只有在计算的PG数量与PG_NUM差异大于3倍是才会出现。
- AUTOSCALE: pg_autoscale_mode的值。