python~crush之analyze工具

来源:互联网 发布:中国体制 知乎 编辑:程序博客网 时间:2024/06/06 02:51

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

$ crush analyze -husage: 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 ruleThe first step shows if the distribution run by asimulation is different from what is expected with theweights assigned to each item in crushmap.Map a number of objects (--values-count) to devices (threeby default or --replication-count if specified) using acrush rule (--rule) from a given crushmap (--crushmap) anddisplay a report comparing the expected and the actualobject distribution.The format of the crushmap file specified with --crushmapcan 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 belowThe --type argument changes the item type displayed in thereport. For instance --type device shows the individualOSDs and --type host shows the machines that containthem. If --type is not specified, it defaults to the"type" argument of the first "choose*" step of the ruleselected by --rule.The first item in the report will be the first to becomefull. For instance if the report starts with:        ~id~  ~weight~  ~objects~  ~over/under used %~~name~g9       -22  2.29             85                10.40it means that the bucket g9 with id -22 and weight 2.29will be the first bucket of its type to become full. Theactual usage of the host will be 10.4% over the expectedusage, 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 theexpected item usage and the actual item usage. If it ispositive the item is overused, if it is negative the itemis underused.The second step shows the worst case scenario if a bucketin the failure domain is removed from the crushmap. Thefailure 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 inthe crushmap, named host1, host2, etc. a simulation willbe run with a crushmap in which only host1 wasremoved. Another simulation will be run with a crushmapwhere host2 was removed etc. The result of all simulationsare aggregated together.The worst case scenario for each item type is when theoverfull percentage is higher. It is displayed as follows:         ~over used %~~type~device          25.55host            22.45If a host fail, the worst case scenario is that a devicewill 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-numExamples: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.0host0     -2       1.0         65                 -2.5host1     -3       1.0         65                 -2.5Display 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.00device4     4       1.0         24                 8.00device5     5       2.0         46                 3.50device3     3       2.0         44                -1.00device2     2       1.0         21                -5.50device1     1       2.0         37               -16.75

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

原创粉丝点击