#例如修改时钟参数
ceph daemon /var/run/ceph/ceph-mon.ceph-01.asok help|grep config
#查看config可以直接的命令"config diff":"dump diff of current config and default config",
"config diff get":"dump diff get <field>: dump diff of current and default config setting <field>",
"config get":"config get <field>: get the config value",
"config help":"get config setting schema and descriptions",
"config set":"config set <field> <val> [<val> ...]: set a config variable",
"config show":"dump current config settings",
"config unset":"config unset <field>: unset a config variable",
# 通过config set替换对应的值
ceph daemon /var/run/ceph/ceph-mon.ceph-01.asok config set 变量名 值
2.4 Ceph Pool 资源池管理
pool是我们的逻辑资源池
# 创建pool# 格式如下
ceph osd pool create {pool-name}[{pg-num}[{pgp-num}]][replicated]\[crush-rule-name][expected-num-objects]
ceph osd pool create {pool-name}[{pg-num}[{pgp-num}]] erasure \[erasure-code-profile][crush-rule-name][expected_num_objects][--autoscale-mode=<on,off,warn>]# 创建一个名称为test_i4t# pg大小为16# pgp大小为16
ceph osd pool create test_i4t 1616
ceph osd lspools
# 查看副本数量
ceph osd pool get test_i4t size
# 将size改成pg_num和pgp_num可以看到ceph中pg和pgp的数量,我们创建的时候定义的
ceph osd pool get test_i4t pg_num
ceph osd pool get test_i4t pgp_num
# 刚刚我们获取到pool的一些参数变量,我们可以来进行修改这些# 比如讲副本数由3个修改为5个
ceph osd pool set test_i4t size 5
ceph osd pool get test_i4t size
# 将Pool关联到Application上# pool创建完成后,需要初始化。将相关的pool关联到application上。类似一个别名# CephFS 使用应用程序名称cephfs,RBD 使用应用程序名称rbd,RGW 使用应用程序名称rgw。
ceph osd pool application get test_i4t
ceph osd pool application enable test_i4t rdb #支持的类型为rdb、rgw、以及cephfs
ceph osd pool application get test_i4t
# 还可以给pool限制配额,指pool可以允许使用多少个ojbect或者是允许使用多少空间
ceph osd pool set-quota test_i4t max_objects 100
ceph osd pool get-quota test_i4t
quotas for pool 'test_i4t':
max objects: 100 objects
max bytes : N/A
# 通过get-quota和set-quota变量来查看我们修改的变量# pool存储空间占用率查看# 除了使用ceph df查看,还可以使用rados df查看ceph pool空间使用率的情况
ceph df
rados df# pool使用命令可以参考https://docs.ceph.com/en/latest/rados/operations/pools/# 删除pool
ceph osd lspools
ceph osd pool rm test_i4t test_i4t
ceph osd pool rm test_i4t test_i4t --yes-i-really-really-mean-it
# 如果无法删除pool可以设置一下 这三个节点参数都要调整一下 也是临时的调整
ceph daemon /var/run/ceph/ceph-mon.ceph-01.asok config show|grep mon_allow_pool_delete
ceph daemon /var/run/ceph/ceph-mon.ceph-01.asok config set mon_allow_pool_delete true# 或者在ceph.conf中添加下面的配置
mon_allow_pool_delete =true# Ceph PG数据调整# 下面的命令可以动态调整pg和pgp的大小
ceph osd pool set{pool-name} pg_num {pg_num}
ceph osd pool set{pool-name} pgp_num {pgp_num}# 同步配置文件 同步配置文件可以使用下面的命令cd ceph-deploy
ceph-deploy --overwrite-conf config push ceph-01 ceph-02 ceph-03