小工具知识网

当前位置: 首页 > 行业知识 > Ceph相关命令

行业知识

Ceph相关命令

2026-11-12 11:10:52 来源:互联网转载

关于osd自动重启

/etc/crontab里面每隔2分钟会调用 /etc/cron.daily/keep_osd.sh

关闭osd

1 mv /etc/cron.daily/keep_osd.sh /etc/cron.daily/keep_osd.sh_back2 systemctl  stop ceph-osd@0.service

查看osd的参数

ceph daemon osd.0 config show  |grep osd_op_num

动态修改osd的配置参数

 ceph tell  osd.* injectargs "--debug_kstore 20" ceph tell  osd.0 injectargs "--debug_osd 20" ceph tell  osd.* injectargs "--debug_rocksdb 0" ceph tell  osd.0 injectargs "--debug_bluestore 20" ceph tell  osd.339 injectargs "--debug_rocksdb 4"

查看osd里面bluestore的kv数据

1 先关闭osd2 建立备份文件夹 mkdir -p /ceph-0/3 把osd的sst文件导出:/usr/local/hstor/ceph_dir/bin/ceph-bluestore-tool bluefs-export --path /var/lib/ceph/osd/ceph-0 --out-dir /ceph-0/4  查看kv记录/usr/local/hstor/ceph_dir/bin/ceph-kvstore-tool  rocksdb /ceph-0/db/ list 

查看rocksdb里面的kv

1 查看单个sst文件 ./sst_dump --file=/home/d11626_back/000043.sst --command=scan --read_num=5     ./sst_dump --file=/home/d11626_back/000043.sst --command=scan --read_num=5 --output_hex    2 查看整个key的kv对     ./ldb --db=/tmp/rocksdb20 scan     ./ldb --db=/tmp/rocksdb20 scan --hex    3 查看manifest    /home/d11626_back/clionProjects/rocksdb-6.15.5/cmake-build-release/tools/ldb --db=/tmp/rocksdb8 manifest_dump     

参考资料

https://wanghenshui.github.io/rocksdb-doc-cn/doc/Administration-and-Data-Access-Tool.html

查看集群都有哪些osd

 ceph osd tree

查看集群都有哪些pool

ceph osd pool ls detail可以看到存储池对应的 crush_rule id或者:ceph osd pool ls 

查看所有的pg

ceph pg statceph pg dump

查看pg都分布在哪些osd上

# 第一列pgID 第二列 是迁移的目标位置  第三列是 目前还在生效的位置ceph pg dump  |awk '{print ,,}' |grep '\['# 迁移后的 分布情况 ceph pg dump|awk '{print ,}' |grep '\[' |awk '{print }' |sort  |uniq -c# 迁移后 每个osd上有多少个主pg ceph pg dump|awk '{print ,}' |grep '\[' |awk '{print }'  |awk -F, '{print}' |sort |uniq -c # 不管迁移情况 只统计目前生效的位置 ceph pg dump|awk '{print ,}' |grep '\[' |awk '{print }' |sort  |uniq -c

查看某个pool下都有哪些pg

ceph pg ls {pool_id}ceph pg ls-by-pool {pool_name}

查看某个pg 在哪些osd上

ceph pg dump| grep ^9.77  |awk '{print }'9.77 就是一个pgid

查看存储池的详细配置

cloud cluster pool rule display pool_name=fubenpool-2fubenpool-2 是存储池名称

查看slow request

ceph daemon osd.23   dump_historic_ops_by_duration |headceph daemon osd.28   dump_historic_slow_opsceph daemon osd.28   dump_op_pq_state

查看有哪些buckets

radosgw-admin bucket list

查看某个bucket的详细信息

radosgw-admin bucket stats --bucket=my-bucket

查看某个buckets下的文件列表

radosgw-admin bucket list  --bucket=my-bucket

查看某个buckets下的索引对象

rados -p default.rgw.buckets.index ls  | grep "a0313951-dde2-4282-a46e-27528af2b57f.1154186.1"可能有多个.dir开头的对象,因为对象也要分片

获取 对象数据,写入本地的indexfile文件

rados -p rados -p default.rgw.buckets.index get .dir.a0313951-dde2-4282-a46e-27528af2b57f.4972.1.57 indexfileindexfile是空

查看某个索引对象下都包含了哪些文件

rados -p default.rgw.buckets.index listomapkeys .dir.a0313951-dde2-4282-a46e-27528af2b57f.1154186.1.57

在这个索引对象下,查看grub2.cfg这个文件的omap数据,写入a.file

 rados getomapval  -p default.rgw.buckets.index  .dir.a0313951-dde2-4282-a46e-27528af2b57f.1154186.1.57  grub2.cfg a.file把a.file解析成json形式ceph-dencoder type rgw_bucket_dir_entry import a.file decode dump_json

查看某个bucket索引分片对象下,都有哪些文件

 seq 0 100 |xargs -I abc sh -c "echo {} ;  rados -p default.rgw.buckets.index listomapkeys  .dir.a0313951-dde2-4282-a46e-27528af2b57f.4972.1.abc"

查看bluefs的统计信息

 ceph daemon osd.0 perf dump bluefs

上一篇:饼状图制作秘籍,轻松成为数据统计图制作高手!

下一篇:机器学习之DeepSequence软件使用学习3-预测突变效应