ceph常用操作

//修复一批数据不一致的pg

ceph health detail|grep acting|awk -F' ' '{print $2}'|xargs -n1 ceph pg repair

//修复osd上too many repair read

ceph tell osd.* clear_shards_repaired

//查看ceph集群的健康状态

ceph health

//查看ceph集群的健康详情信息

ceph health detail

ceph -w可以查看日志

ceph -s

//打印ceph 集群上的osd

ceph osd dump|grep kubernetes

//打印ceph 集群上的pg

ceph pg dump|head -10

打印pool列表

ceph osd lspools

创建pool

ceph osd pool create test-pool 128

设置pool最大允许的对象

ceph osd pool set-quota test-pool max_objects 100

设置pool最大容量

ceph osd pool set-quota test-pool max_bytes  $((10 * 1024 * 1024 * 1024))

重命名pool

ceph osd pool rename test-pool test-pool-new

删除pool

ceph osd pool delete test-pool test-pool --yes-i-really-really-mean-it

查看pool状态信息

rados df 

通过以下语法可以设置pool的元数据

ceph osd pool set {pool-name} {key} {value}

比如设置pool的冗余副本数量为:3

ceph osd pool set test-pool size 3

通过get操作能够获取pool的配置值,比如获取当前pg_num

ceph osd pool get test-pool pg_num

获取当前副本数

ceph osd pool get test-pool size

 

卷操作:

1.   创建新卷:rbd create kubernetes/rbdname -s 100G

2.   扩容新卷:rbd resize kubernetes/rbdname -s 200G

3.   删除新卷:rbd remove kubernetes/rbdname 

rbd info kubernetes/rbdname

rbd ls kubernetes

rbd diff kubernetes/rbdname

rbd showmapped

posted on 2022-01-25 15:57  朱古力88  阅读(352)  评论(0编辑  收藏  举报