python~crush之compare工具

本篇介绍的是compare这个工具

$ crush compare  -h
usage: crush compare [-h] [--replication-count REPLICATION_COUNT]
                     [--rule RULE] [--values-count VALUES_COUNT]
                     [--origin PATH] [--destination PATH] [-ow ORIGIN_WEIGHTS]
                     [-dw DESTINATION_WEIGHTS] [--order-matters] [--pool POOL]
                     [--pg-num PG_NUM] [--pgp-num PGP_NUM]

Compare crushmaps

After a crushmap is changed (e.g. addition/removal of
items, modification of weights or tunables), objects may
move from an item to another.

The crushmap before the modification is specified with the
--origin option and the crushmap after the modification is
specified with the --destination option.

The format of the crushmap file specified with --origin or
--destination can either be:

- a JSON representation of a crushmap as documented in the
  Crush.parse_crushmap() method

- a Ceph binary, text or JSON crushmap compatible with
  Luminuous and below

Each crushmap is given the same set of objects (in the
range [0,--value-count[) to map using a given rule
(--rule) with a given replication count
(--replication-count). If an object is mapped to the same
items by both crushmaps, it does not move. If it is mapped
to different items, it moves.

The order in which items are mapped may or may not matter.
For instance, it does not matter if three exact copies of
an object are mapped to items 23, 78 and 45 instead of to
45, 78 and 23. But it matters in the case of erasure-coded
objects because they are split among multiple items. A
simple example: first half of object is stored in one
item, second half is stored in a second item, and parity
is stored in a third. A rule with a "choose*" "indep" step
is typically used when the order of the mapping order matters
and a rule with a "choose*" "firstn" step is most often
used when the mapping does not matter.

If an object maps to items 23, 78 and 45 in the --origin
crushmap and to 45, 78 and 23 in the --destination crushmap
(i.e. the same items but in a different order), it is assumed
the order does not matter and the object did not move. If
the --order-matters flag is set, it is assumed that some object
movement will be necessary and the object will be counted as
moving from 45 to 23 and from 23 to 45.

optional arguments:
  -h, --help            show this help message and exit
  --replication-count REPLICATION_COUNT
                        number of devices to map (default: 3)
  --rule RULE           the name of rule
  --values-count VALUES_COUNT
                        repeat mapping (default: 100000)
  --origin PATH         PATH to the origin crushmap file
  --destination PATH    PATH to the destination crushmap file
  -ow ORIGIN_WEIGHTS, --origin-weights ORIGIN_WEIGHTS
                        Weights file to apply to the origin map
  -dw DESTINATION_WEIGHTS, --destination-weights DESTINATION_WEIGHTS
                        Weights file to apply to the destination map
  --order-matters       true if the order of mapped devices matter (default:
                        false)
  --pool POOL           pool
  --pg-num PG_NUM       pg-num
  --pgp-num PGP_NUM     pgp-num

Examples:

$ crush compare --rule firstn \
                --replication-count 1 \
                --origin before.json --destination after.json
There are 1000 objects.

Replacing the crushmap specified with --origin with the crushmap
specified with --destination will move 229 objects (22.9% of the total)
from one item to another.

The rows below show the number of objects moved from the
given item to each item named in the columns. The objects%
at the end of the rows shows the percentage of the total
number of objects that is moved away from this particular
item. The last row shows the percentage of the total
number of objects that is moved to the item named in the
column.

         osd.8    osd.9    objects%
osd.0        3        4       0.70%
osd.1        1        3       0.40%
osd.2       16       16       3.20%
osd.3       19       21       4.00%
osd.4       17       18       3.50%
osd.5       18       23       4.10%
osd.6       14       23       3.70%
osd.7       14       19       3.30%
objects%   10.20%   12.70%   22.90%

http://crush.readthedocs.io/en/latest/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值