ceph高级工具---ceph-objectstore-tool

0、简介
ceph-objectstore-tool工具是ceph提供的一个可以操作object和pg的工具,可以用来查看、修改、删除ObjectStore上的object、pg以及dump OSD journal中的数据,这个工具的使用要谨慎,它可能会造成数据的永久丢失

1、ceph-objectstore-tool -h 帮助信息分析学习
Must provide --data-path 必须指定 --data-path

Allowed options:
–help produce help message
–type arg Arg is one of [bluestore, filestore (default),
memstore] //指定文件存储类型---------------这三种store是做什么的??
–data-path arg path to object store, mandatory//对象存储的路径,必须指定
–journal-path arg path to journal, use if tool can’t find it 如果工具不能够找到日志的路径则需要指定
–pgid arg PG id, mandatory for info, log, remove, export,
rm-past-intervals, mark-complete, and mandatory
for apply-layout-settings if --pool is not
specified//PG ID号,如果资源池名称没有被指定,则强制info,log,remove,export,rm-past-intervals,mark-complete强制应用底层设置 ---------------
–pool arg Pool name, mandatory for apply-layout-settings if
–pgid is not specified //资源池名称,如果pg id没有被指定,则强制应用底层设置
–op arg Arg is one of [info, log, remove, mkfs, fsck, //参数时括号中的其中一个
fuse, dup, export, import, list, fix-lost,
list-pgs, rm-past-intervals, dump-journal,
dump-super, meta-list, get-osdmap, set-osdmap,
get-inc-osdmap, set-inc-osdmap, mark-complete,
apply-layout-settings, update-mon-db]
–epoch arg epoch# for get-osdmap and get-inc-osdmap, the //指定osd map的版本号,如果没有被指定,则当前的版本号将被使用
current epoch in use if not specified
–file arg path of file to export, import, get-osdmap, //指定一个文件,执行一写相关操作
set-osdmap, get-inc-osdmap or set-inc-osdmap
–mon-store-path arg path of monstore to update-mon-db //mon store的路径
–fsid arg fsid for new store created by mkfs //新存储的fsid
–target-data-path arg path of target object store (for --op dup) //目标对象存储的路径
–mountpoint arg fuse mountpoint //fuse挂载点
–format arg (=json-pretty) Output format which may be json, json-pretty, //指定输出格式
xml, xml-pretty
–debug Enable diagnostic output to stderr //开启debug
–force Ignore some types of errors and proceed with
operation - USE WITH CAUTION: CORRUPTION POSSIBLE
NOW OR IN THE FUTURE
–skip-journal-replay Disable journal replay //disable 日志重放
–skip-mount-omap Disable mounting of omap //disable mount omap
–head Find head/snapdir when searching for objects by
name //寻找原始对象和快照对象
–dry-run Don’t modify the objectstore //不更改对象存储
–namespace arg Specify namespace when searching for objects //当寻找对象的时候,指定命名空间

Positional syntax:

ceph-objectstore-tool … <object> (get|set)-bytes [file]
ceph-objectstore-tool … <object> set-(attr|omap) <key> [file]
ceph-objectstore-tool … <object> (get|rm)-(attr|omap) <key>
ceph-objectstore-tool … <object> get-omaphdr
ceph-objectstore-tool … <object> set-omaphdr [file]
ceph-objectstore-tool … <object> list-attrs
ceph-objectstore-tool … <object> list-omap
ceph-objectstore-tool … <object> remove|removeall
ceph-objectstore-tool … <object> dump
ceph-objectstore-tool … <object> set-size
ceph-objectstore-tool … <object> remove-clone-metadata <cloneid>

<object> can be a JSON object description as displayed
by --op list.
<object> can be an object name which will be looked up in all
the OSD’s PGs.
<object> can be the empty string (’’) which with a provided pgid
specifies the pgmeta object

The optional [file] argument will read stdin or write stdout
if not specified or if ‘-’ specified.

工具详细用法(调用前需要先停osd服务)
1、查询某个osd上有哪些pg
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0/ --op list-pgs
如果知道要寻找的对象ID,可使用它来找到PG ID
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0/ --op list-pgs <object-id>
2、获取某个pg的pg info
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0/ --pgid 10.0 --op info
3、查询某个pg中object信息
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0/ --pgid 10.0 --op list
查询所有pg中的object信息
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0/ --op list
4、查询某个pg的log信息
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0/ --pgid 10.0 --op log
5、删除某个pg
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0/ --pgid 11.d --op remove
6、export/import一个pg
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0/ --pgid 11.d --op export/import --file 2.txt
7、dump OSD 的super block信息
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-2/ --op dump-super
8、dump一个object的所有元数据信息
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-2/ rbd_data.6e742ae8944a.0000000000000013 dump
9、导出pg为一个二进制文件
ceph-objectstore-tool --pgid 2.67s13 --op export --data-path /var/lib/ceph/osd/ceph-8/ --type bluestore --file /home/pg111
10、删除一个osd内的pg,需要加–force才能完成
ceph-objectstore-tool --pgid 6.22 --op remove --data-path /var/lib/ceph/osd/ceph-0/ --type bluestore --force
11、从一个文件中把pg导入osd
ceph-objectstore-tool --pgid 6.22 --op import --data-path /var/lib/ceph/osd/ceph-0/ --type bluestore --file /home/tool/ceph-objectstore-tool/pg6.22
12、pg由incomplete变为complete
ceph-objectstore-tool --pgid 6.22 --op mark-complete --data-path /var/lib/ceph/osd/ceph-0/ --type bluestore
13、下述文档展示了关于该工具的一些详细用法,用到时在使用
https://blog.csdn.net/qq_16327997/article/details/83029342

14、在一个osd中可能有被标记为lost的对象,要列出lost或者unfound对象,需要执行以下命令:
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0/ --op list-lost
15、找到pg内的标记为lost的对象,需要指定pgid
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0/ --op list-lost --pgid 10.0
16、要删除某个PG的已丢失的对象的lost标识,需要执行
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0/ --op fix-lost
17、需要修复指定PG的丢失对象,需要指定pg id
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0/ --op fix-lost --pgid 10.0
18、如果有待修复的已丢失对象的ID,请指定对象的ID
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-0/ --op fix-lost <object-id>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值