OSDMAPTOOL(8) | Ceph | OSDMAPTOOL(8) |
osdmaptool - ceph osd cluster map manipulation tool
osdmaptool mapfilename [--print] [--createsimple numosd [--pgbits bitsperosd ] ] [--clobber] osdmaptool mapfilename [--import-crush crushmap] osdmaptool mapfilename [--export-crush crushmap] osdmaptool mapfilename [--upmap file] [--upmap-max max-optimizations] [--upmap-deviation max-deviation] [--upmap-pool poolname] [--save] [--upmap-active] osdmaptool mapfilename [--upmap-cleanup] [--upmap file]
osdmaptool is a utility that lets you create, view, and manipulate OSD cluster maps from the Ceph distributed storage system. Notably, it lets you extract the embedded CRUSH map or import a new CRUSH map. It can also simulate the upmap balancer mode so you can get a sense of what is needed to balance your PGs.
To create a simple map with 16 devices:
osdmaptool --createsimple 16 osdmap --clobber
To view the result:
osdmaptool --print osdmap
To view the mappings of placement groups for pool 1:
osdmaptool osdmap --test-map-pgs-dump --pool 1 pool 1 pg_num 8 1.0 [0,2,1] 0 1.1 [2,0,1] 2 1.2 [0,1,2] 0 1.3 [2,0,1] 2 1.4 [0,2,1] 0 1.5 [0,2,1] 0 1.6 [0,1,2] 0 1.7 [1,0,2] 1 #osd count first primary c wt wt osd.0 8 5 5 1 1 osd.1 8 1 1 1 1 osd.2 8 2 2 1 1 in 3 avg 8 stddev 0 (0x) (expected 2.3094 0.288675x)) min osd.0 8 max osd.0 8 size 0 0 size 1 0 size 2 0 size 3 8
In a less-balanced cluster, we could have following output for the statistics of placement group distribution, whose standard deviation is 1.41421:
#osd count first primary c wt wt osd.0 8 5 5 1 1 osd.1 8 1 1 1 1 osd.2 8 2 2 1 1 #osd count first primary c wt wt osd.0 33 9 9 0.0145874 1 osd.1 34 14 14 0.0145874 1 osd.2 31 7 7 0.0145874 1 osd.3 31 13 13 0.0145874 1 osd.4 30 14 14 0.0145874 1 osd.5 33 7 7 0.0145874 1 in 6 avg 32 stddev 1.41421 (0.0441942x) (expected 5.16398 0.161374x)) min osd.4 30 max osd.1 34 size 00 size 10 size 20 size 364
To simulate the active balancer in upmap mode:
osdmaptool --upmap upmaps.out --upmap-active --upmap-deviation 6 --upmap-max 11 osdmap osdmaptool: osdmap file 'osdmap' writing upmap command output to: upmaps.out checking for upmap cleanups upmap, max-count 11, max deviation 6 pools movies photos metadata data prepared 11/11 changes Time elapsed 0.00310404 secs pools movies photos metadata data prepared 11/11 changes Time elapsed 0.00283402 secs pools data metadata movies photos prepared 11/11 changes Time elapsed 0.003122 secs pools photos metadata data movies prepared 11/11 changes Time elapsed 0.00324372 secs pools movies metadata data photos prepared 1/11 changes Time elapsed 0.00222609 secs pools data movies photos metadata prepared 0/11 changes Time elapsed 0.00209916 secs Unable to find further optimization, or distribution is already perfect osd.0 pgs 41 osd.1 pgs 42 osd.2 pgs 42 osd.3 pgs 41 osd.4 pgs 46 osd.5 pgs 39 osd.6 pgs 39 osd.7 pgs 43 osd.8 pgs 41 osd.9 pgs 46 osd.10 pgs 46 osd.11 pgs 46 osd.12 pgs 46 osd.13 pgs 41 osd.14 pgs 40 osd.15 pgs 40 osd.16 pgs 39 osd.17 pgs 46 osd.18 pgs 46 osd.19 pgs 39 osd.20 pgs 42 Total time elapsed 0.0167765 secs, 5 rounds
To simulate the active balancer in read mode, first make sure capacity is balanced by running the balancer in upmap mode. Then, balance the reads on a replicated pool with:
osdmaptool osdmap --read read.out --read-pool <pool name> ./bin/osdmaptool: osdmap file 'om' writing upmap command output to: read.out ---------- BEFORE ------------ osd.0 | primary affinity: 1 | number of prims: 3 osd.1 | primary affinity: 1 | number of prims: 10 osd.2 | primary affinity: 1 | number of prims: 3 read_balance_score of 'cephfs.a.meta': 1.88 ---------- AFTER ------------ osd.0 | primary affinity: 1 | number of prims: 5 osd.1 | primary affinity: 1 | number of prims: 5 osd.2 | primary affinity: 1 | number of prims: 6 read_balance_score of 'cephfs.a.meta': 1.13 num changes: 5
osdmaptool is part of Ceph, a massively scalable, open-source, distributed storage system. Please refer to the Ceph documentation at https://docs.ceph.com for more information.
ceph(8), crushtool(8),
2010-2024, Inktank Storage, Inc. and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0)
April 19, 2024 | dev |