Skip to content

Commit cdb3395

Browse files
authored
Merge pull request #17 from 45Drives/dev-bailey
add rocksdb resharding reef and rbd_info
2 parents 61aa5b8 + 3fc331e commit cdb3395

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
#rocksdb-resharding
3+
4+
ceph osd set noout
5+
6+
for i in $(ceph osd ls-tree $(hostname -s)); do
7+
echo "Resharding OSD $i"
8+
OSD_DIR="/var/lib/ceph/osd/ceph-$i";
9+
if [ ! -d "$OSD_DIR" ]; then
10+
echo "$OSD_DIR does not exist on $(hostname -s), skipping"
11+
continue
12+
fi
13+
echo "$OSD_DIR exists on $(hostname -s), running reshard"
14+
set -x
15+
systemctl stop ceph-osd@$i
16+
ceph-bluestore-tool --path $OSD_DIR fsck
17+
ceph-bluestore-tool --path $OSD_DIR --sharding="m(3) p(3,0-12) O(3,0-13)=block_cache={type=binned_lru} L=min_write_buffer_number_to_merge=32 P=min_write_buffer_number_to_merge=32" reshard
18+
ceph-bluestore-tool --path $OSD_DIR show-sharding
19+
ceph-bluestore-tool --path $OSD_DIR fsck
20+
systemctl start ceph-osd@$i
21+
set +x
22+
done
23+
ceph osd unset noout

rbd_info.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
# Define formatting for the table
4+
printf "%-35s %-22s %-22s %-22s\n" "IMAGE NAME" "CREATED" "ACCESSED (Meta)" "MODIFIED (Meta)"
5+
printf "%-35s %-22s %-22s %-22s\n" "----------" "-------" "---------------" "---------------"
6+
7+
# 1. Find all enabled RBD storages from Proxmox config
8+
pvesm status -content images | awk '$2=="rbd" {print $1}' | while read STOREID; do
9+
10+
# Get the actual Ceph pool name for this storage
11+
POOL=$(grep -A5 "rbd: $STOREID" /etc/pve/storage.cfg | grep "pool" | awk '{print $2}')
12+
13+
# Fallback if pool detection fails (default is often 'rbd')
14+
if [ -z "$POOL" ]; then POOL="rbd"; fi
15+
16+
# 2. List all images in the pool
17+
rbd -p "$POOL" --namespace pve ls | while read IMAGE; do
18+
19+
# 3. Get Info from RBD
20+
# We capture the whole output to a variable to avoid calling rbd info 3 times
21+
INFO=$(rbd info "$POOL/$IMAGE" --namespace pve 2>/dev/null)
22+
23+
# Extract timestamps
24+
c_time=$(echo "$INFO" | grep "create_timestamp" | awk -F': ' '{print $2}')
25+
a_time=$(echo "$INFO" | grep "access_timestamp" | awk -F': ' '{print $2}')
26+
m_time=$(echo "$INFO" | grep "modify_timestamp" | awk -F': ' '{print $2}')
27+
28+
# Handle empty results (older Ceph versions might not show all 3)
29+
if [ -z "$c_time" ]; then c_time="-"; fi
30+
if [ -z "$a_time" ]; then a_time="-"; fi
31+
if [ -z "$m_time" ]; then m_time="-"; fi
32+
33+
# Print row
34+
printf "%-35s %-22s %-22s %-22s\n" "${IMAGE:0:34}" "$c_time" "$a_time" "$m_time"
35+
36+
done
37+
done

0 commit comments

Comments
 (0)