Skip to content

Commit 04c0c85

Browse files
committed
Create osd_compaction.sh
1 parent f75c393 commit 04c0c85

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

osd_compaction.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/bash
2+
3+
# Matthew hutchinson <mhutchinson@45drives.com>
4+
5+
# Trigger compaction on all OSDs belonging to this host.
6+
set -euo pipefail
7+
8+
HOST="$(hostname -s)"
9+
OSDS=$(ceph osd ls-tree "$HOST")
10+
11+
if [ -z "$OSDS" ]; then
12+
echo "No OSDs found for host $HOST."
13+
exit 0
14+
fi
15+
16+
echo "Starting compaction on OSDs for host: $HOST"
17+
for osd in $OSDS; do
18+
echo "Running compaction on osd.${osd}..."
19+
if ceph tell osd."${osd}" compact; then
20+
echo "Compaction triggered successfully for osd.${osd}"
21+
else
22+
echo "Failed to trigger compaction on osd.${osd}"
23+
fi
24+
echo
25+
done
26+
27+
echo "All compaction requests have been sent for host: $HOST"

0 commit comments

Comments
 (0)