Skip to content

Instantly share code, notes, and snippets.

@wica128
Last active May 22, 2022 12:18
Show Gist options
  • Save wica128/5c118d704005d60e5f959e36f2499823 to your computer and use it in GitHub Desktop.
Save wica128/5c118d704005d60e5f959e36f2499823 to your computer and use it in GitHub Desktop.
# Dump a PG mimic
ceph pg dump pgs --format=json-pretty |jq -r '.[]|select(.pgid == "<PGID>")'
# Dump a PG nautilus
ceph pg dump pgs --format=json-pretty |jq -r '.pg_stats[]|select(.pgid == "<PGID>")'
# Find inconsistent PG's mimic
ceph pg dump pgs --format=json-pretty 2> /dev/null|jq -r '.[]|select (.state|test("inconsistent"))| .pgid'
# Find inconsistent PG's nautilus
ceph pg dump pgs --format=json-pretty 2> /dev/null|jq -r '.pg_stats[]|select (.state|test("inconsistent"))| .pgid'
# Get Error from PG.
rados list-inconsistent-obj <PGID> --format=json-pretty| jq -r '.inconsistents[].shards[]|select(.errors |length > 0)| [.osd,.primary,.errors[]]|@tsv'
# Dump info of a OSD
ceph osd dump --format=json-pretty |jq -r '.osds[]|select(.osd == <OSD_ID>)'
# change backfill
HOST="srv-51d4-24"; ceph osd tree --format=json-pretty|jq -r '.nodes[]|select(.type == "host" and .name == "'${HOST}'-ssd")| "\(.children[]) "'| xargs -I {} -n1 ceph tell osd.{} config set osd_max_backfills 10
# Find osd with degraded obects
ceph pg dump pgs --format=json-pretty | jq -r '.pg_stats[]|select(.stat_sum.num_objects_degraded > 0)| @sh "\(.up) "'|xargs -n1 > osd.txt
for x in $(cat osd.txt); do echo -n "$x ";ceph tell osd.$x config set osd_max_backfills 10; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment