Files
Sankofa/scripts/fix-r630-mon-quorum.sh
defiQUG 33d50fb91e
Some checks failed
API CI / API Lint (push) Successful in 47s
API CI / API Type Check (push) Failing after 47s
API CI / API Test (push) Successful in 1m0s
API CI / API Build (push) Failing after 50s
API CI / Build Docker Image (push) Has been skipped
Build Crossplane Provider / build (push) Failing after 5m51s
CD Pipeline / Deploy to Staging (push) Failing after 29s
CI Pipeline / Lint and Type Check (push) Failing after 36s
CI Pipeline / Build (push) Has been skipped
CI Pipeline / Test Backend (push) Failing after 1m33s
CI Pipeline / Test Frontend (push) Failing after 30s
CI Pipeline / Security Scan (push) Failing after 1m16s
Crossplane Provider CI / Go Test (push) Failing after 3m23s
Crossplane Provider CI / Go Lint (push) Failing after 7m27s
Crossplane Provider CI / Go Build (push) Failing after 3m27s
Deploy to Staging / Deploy to Staging (push) Failing after 30s
Portal CI / Portal Lint (push) Failing after 21s
Portal CI / Portal Type Check (push) Failing after 21s
Portal CI / Portal Test (push) Failing after 21s
Portal CI / Portal Build (push) Failing after 22s
Test Suite / frontend-tests (push) Failing after 30s
Test Suite / api-tests (push) Failing after 49s
Test Suite / blockchain-tests (push) Failing after 30s
Type Check / type-check (map[directory:. name:root]) (push) Failing after 23s
Type Check / type-check (map[directory:api name:api]) (push) Failing after 21s
Type Check / type-check (map[directory:portal name:portal]) (push) Failing after 19s
Validate Configuration Files / validate (push) Failing after 1m52s
CD Pipeline / Deploy to Production (push) Has been skipped
chore: consolidate local WIP (repo cleanup 20260707)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 09:41:34 -07:00

97 lines
3.2 KiB
Bash

#!/bin/bash
# Fix R630-01 monitor to join quorum
set -e
echo "=== Fixing R630-01 Monitor Quorum ==="
# Check current status
echo "1. Checking monitor service status..."
systemctl status ceph-mon@r630-01 --no-pager | head -15
echo ""
echo "2. Checking monitor directory..."
ls -la /var/lib/ceph/mon/ceph-r630-01/ 2>&1 || echo "Monitor directory missing!"
echo ""
echo "3. Checking monitor logs..."
journalctl -u ceph-mon@r630-01 -n 20 --no-pager | tail -20
echo ""
echo "4. Checking if monitor is listening..."
ss -ltnp | grep -E "(:3300|:6789)" || echo "No monitor listeners found"
echo ""
echo "5. Attempting to add monitor to cluster..."
# Get monmap from ml110-01
echo "Fetching monmap from ml110-01..."
ceph mon getmap -o /tmp/monmap 2>&1 || echo "Failed to get monmap"
if [ -f /tmp/monmap ]; then
echo "Monmap retrieved, checking contents..."
monmaptool --print /tmp/monmap 2>&1
# Check if r630-01 is in monmap
if ! monmaptool --print /tmp/monmap 2>&1 | grep -q "r630-01"; then
echo "r630-01 not in monmap, adding..."
# Get cluster FSID
FSID=$(ceph config get mon fsid 2>/dev/null || grep "fsid" /etc/pve/ceph.conf | awk '{print $3}')
if [ -z "$FSID" ]; then
FSID=$(grep "fsid" /etc/pve/ceph.conf | awk '{print $3}')
fi
if [ -n "$FSID" ]; then
echo "Adding r630-01 to monmap with FSID: $FSID"
monmaptool --add r630-01 192.168.11.11 --fsid $FSID /tmp/monmap 2>&1
# Inject updated monmap
ceph mon setmap -i /tmp/monmap 2>&1 || echo "Failed to set monmap"
fi
else
echo "r630-01 already in monmap"
fi
fi
echo ""
echo "6. Checking if monitor directory needs creation..."
if [ ! -d "/var/lib/ceph/mon/ceph-r630-01" ] || [ -z "$(ls -A /var/lib/ceph/mon/ceph-r630-01 2>/dev/null)" ]; then
echo "Monitor directory missing or empty, creating..."
# Get keyring
if [ -f "/var/lib/ceph/bootstrap-osd/ceph.keyring" ]; then
echo "Using bootstrap keyring to create monitor..."
mkdir -p /var/lib/ceph/mon/ceph-r630-01
chown ceph:ceph /var/lib/ceph/mon/ceph-r630-01
# Get monmap and keyring
if [ -f /tmp/monmap ]; then
ceph-authtool --create-keyring /var/lib/ceph/mon/ceph-r630-01/keyring --gen-key -n mon. 2>&1 || true
ceph mon getmap -o /tmp/monmap 2>&1 || true
if [ -f /tmp/monmap ] && [ -f /var/lib/ceph/mon/ceph-r630-01/keyring ]; then
echo "Creating monitor filesystem..."
ceph-mon --mkfs -i r630-01 --monmap /tmp/monmap --keyring /var/lib/ceph/mon/ceph-r630-01/keyring 2>&1
chown -R ceph:ceph /var/lib/ceph/mon/ceph-r630-01
fi
fi
else
echo "Bootstrap keyring not found, using pveceph..."
pveceph mon create 2>&1 || echo "pveceph mon create failed"
fi
fi
echo ""
echo "7. Restarting monitor service..."
systemctl restart ceph-mon@r630-01
sleep 5
systemctl status ceph-mon@r630-01 --no-pager | head -15
echo ""
echo "8. Waiting for quorum..."
sleep 10
ceph quorum_status 2>&1 | head -10
echo ""
echo "=== Done ==="
echo "Check quorum with: ceph quorum_status"
echo "Check cluster with: ceph -s"