python~crush之analyze工具

python~crush是Loïc Dachary 开发的使用crush的一个工具,详见官网。

$ crush analyze -h
usage: crush analyze [-h] [--replication-count REPLICATION_COUNT]
                     [--rule RULE] [--type TYPE] [--crushmap CRUSHMAP]
                     [-w WEIGHTS] [--values-count VALUES_COUNT] [--pool POOL]
                     [--pg-num PG_NUM] [--pgp-num PGP_NUM]

Analyze a crushmap rule

The first step shows if the distribution run by a
simulation is different from what is expected with the
weights assigned to each item in crushmap.

Map a number of objects (--values-count) to devices (three
by default or --replication-count if specified) using a
crush rule (--rule) from a given crushmap (--crushmap) and
display a report comparing the expected and the actual
object distribution.

The format of the crushmap file specified with --crushmap
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

The --type argument changes the item type displayed in the
report. For instance --type device shows the individual
OSDs and --type host shows the machines that contain
them. If --type is not specified, it defaults to the
"type" argument of the first "choose*" step of the rule
selected by --rule.

The first item in the report will be the first to become
full. For instance if the report starts with:

        ~id~  ~weight~  ~objects~  ~over/under used %~
~name~
g9       -22  2.29             85                10.40

it means that the bucket g9 with id -22 and weight 2.29
will be the first bucket of its type to become full. The
actual usage of the host will be 10.4% over the expected
usage, i.e. if the g9 host is expected to be 70%
full, it will actually be 80.40% full.

The ~over/under used %~ is the variation between the
expected item usage and the actual item usage. If it is
positive the item is overused, if it is negative the item
is underused.

The second step shows the worst case scenario if a bucket
in the failure domain is removed from the crushmap. The
failure domain is the type argument of the crush rule.
For instance in:

    ["chooseleaf", "firstn", 0, "type", "host"]

the failure domain is the host. If there are four hosts in
the crushmap, named host1, host2, etc. a simulation will
be run with a crushmap in which only host1 was
removed. Another simulation will be run with a crushmap
where host2 was removed etc. The result of all simulations
are aggregated together.

The worst case scenario for each item type is when the
overfull percentage is higher. It is displayed as follows:

         ~over used %~
~type~
device          25.55
host            22.45

If a host fail, the worst case scenario is that a device
will be 25.55% overfull or a host will be 22.45% overfull.

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
  --type TYPE           override the type of bucket shown in the report
  --crushmap CRUSHMAP   path to the crushmap file
  -w WEIGHTS, --weights WEIGHTS
                        path to the weights file
  --values-count VALUES_COUNT
                        repeat mapping (default: 100000)
  --pool POOL           pool
  --pg-num PG_NUM       pg-num
  --pgp-num PGP_NUM     pgp-num

Examples:

Display the first host that will become full.

$ crush analyze --values-count 100 --rule data \
                --crushmap tests/sample-crushmap.json
        ~id~  ~weight~  ~objects~  ~over/under used %~
~name~
host2     -4       1.0         70                  5.0
host0     -2       1.0         65                 -2.5
host1     -3       1.0         65                 -2.5

Display the first device that will become full.

$ crush analyze --values-count 100 --rule data \
                --type device \
                --crushmap tests/sample-crushmap.json
         ~id~  ~weight~  ~objects~  ~over/under used %~
~name~
device0     0       1.0         28                26.00
device4     4       1.0         24                 8.00
device5     5       2.0         46                 3.50
device3     3       2.0         44                -1.00
device2     2       1.0         21                -5.50
device1     1       2.0         37               -16.75

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值