Last active
November 4, 2021 15:01
-
-
Save Kallio/be5b57ea09c5ad2014eb7feec1bc06e5 to your computer and use it in GitHub Desktop.
ceph osd pg_log trimming related to http://cloud.blog.csc.fi/2020/12/allas-november-2020-incident-details.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| osds=`ls -d /var/lib/ceph/osd/ceph-* |grep -o [0-9]*$` | |
| noop=0 | |
| for osd in $osds; do | |
| date | |
| echo "Starting trimming for ${osd}" | |
| if [ $noop -eq 1 ] ; then | |
| echo "systemctl disable --now ceph-osd@${osd}" | |
| else | |
| systemctl disable --now ceph-osd@${osd} | |
| fi | |
| if [ $noop -eq 1 ] ; then | |
| echo 'CEPH_ARGS="--bluestore_hybrid_alloc_mem_cap=0 " ceph-objectstore-tool --op list-pgs --data-path /var/lib/ceph/osd/ceph-${osd} >/tmp/trimming${osd}.txt' | |
| echo "" > /tmp/trimming${osd}.txt | |
| else | |
| date; CEPH_ARGS="--bluestore_hybrid_alloc_mem_cap=0 " ceph-objectstore-tool --op list-pgs --data-path /var/lib/ceph/osd/ceph-${osd} >/tmp/trimming${osd}.txt | |
| fi | |
| wc -l /tmp/trimming${osd}.txt | |
| pgs=`cat /tmp/trimming${osd}.txt` | |
| for pg in $pgs; do | |
| if [ $noop -eq 1 ] ; then | |
| echo 'CEPH_ARGS="--bluestore_hybrid_alloc_mem_cap=0" ceph-objectstore-tool --op trim-pg-log --data-path /var/lib/ceph/osd/ceph-${osd} --pgid ${pg}' | |
| else | |
| date; CEPH_ARGS="--bluestore_hybrid_alloc_mem_cap=0" ceph-objectstore-tool --op trim-pg-log --data-path /var/lib/ceph/osd/ceph-${osd} --pgid ${pg} | |
| fi | |
| done | |
| if [ $noop -eq 1 ] ; then | |
| echo "systemctl enable --now ceph-osd@${osd}" | |
| else | |
| systemctl enable --now ceph-osd@${osd} | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment