注意

本文档适用于 Ceph 的开发版本。

ceph-dencoder -- ceph编码器/解码器工具

概要

ceph-dencoder[命令…]

描述

ceph-dencoder是一个用于编码、解码和转储 ceph 数据结构的工具。它用于调试和测试跨版本兼容性。

ceph-dencoder接收一个简单的命令列表并按顺序执行它们。

Commands

版本

打印 ceph-dencoder 二进制版本的版本字符串。ceph-dencoder二进制文件。

import <文件>

从给定文件中读取编码数据的二进制块。它将被放置在内存缓冲区中。

export <文件>

将当前内存缓冲区的内容写入给定文件。

list_types

列出此 ceph-dencoder 构建的已知数据类型。ceph-dencoder.

type <name>

选择给定类型以用于未来的操作。encode or decode operations.

skip <字节>

在读取数据结构之前,将导入文件中的位置移动到 <字节>,用于具有目标对象之前的前导/标题的对象。

decode

将内存缓冲区的内容解码为先前选择类型的实例。如果有错误,请报告它。

encode

将先前选择类型的内存实例的内容编码到内存缓冲区。

dump_json

打印内存对象的 JSON 格式描述。

count_tests

打印先前选择类型能够生成的内置测试实例的数量。ceph-dencoder is able to generate.

select_test <n>

将给定的内置测试实例选择为类型的内存实例。

get_features

打印此 ceph-dencoder 版本支持的特性集的十进制值。每个位代表一个特性。这些对应于 src/include/ceph_features.h 中的 CEPH_FEATURE_* 定义。ceph-dencoder. Each bit represents a feature. These correspond to CEPH_FEATURE_* defines in src/include/ceph_features.h.

set_features <f>

设置提供给 的特性位。这允许你编码对象,以便它们可以被旧版本的软件理解(对于那些支持它的类型)。encode to f. This allows you to encode objects such that they can be understood by old versions of the software (for those types that support it).

示例

假设你想检查由 保存的对象上的一个属性。你可以这样做:ceph-osd. You can do this:

$ cd /mnt/osd.12/current/2.b_head
$ attr -l foo_bar_head_EFE6384B
Attribute "ceph.snapset" has a 31 byte value for foo_bar_head_EFE6384B
Attribute "ceph._" has a 195 byte value for foo_bar_head_EFE6384B
$ attr foo_bar_head_EFE6384B -g ceph._ -q > /tmp/a
$ ceph-dencoder type object_info_t import /tmp/a decode dump_json
{ "oid": { "oid": "foo",
      "key": "bar",
      "snapid": -2,
      "hash": 4024842315,
      "max": 0},
  "locator": { "pool": 2,
      "preferred": -1,
      "key": "bar"},
  "category": "",
  "version": "9'1",
  "prior_version": "0'0",
  "last_reqid": "client.4116.0:1",
  "size": 1681,
  "mtime": "2012-02-21 08:58:23.666639",
  "lost": 0,
  "wrlock_by": "unknown.0.0:0",
  "snaps": [],
  "truncate_seq": 0,
  "truncate_size": 0,
  "watchers": {}}

或者,也许你想转储一个内部 CephFS 元数据对象,你可以这样做:

$ rados -p metadata get mds_snaptable mds_snaptable.bin
$ ceph-dencoder type SnapServer skip 8 import mds_snaptable.bin decode dump_json
{ "snapserver": { "last_snap": 1,
   "pending_noop": [],
   "snaps": [],
   "need_to_purge": {},
   "pending_create": [],
   "pending_destroy": []}}

可用性

ceph-dencoder是 Ceph 的一部分,Ceph 是一个大规模可扩展的、开源的分布式存储系统。请参考 Ceph 文档中的https://docs.ceph.com获取更多信息。

参见

ceph(8)

由 Ceph 基金会提供

Ceph 文档是一个由非盈利Ceph 基金会资助和托管的社会资源。如果您想支持此项目和其他工作,请考虑现在加入.