This repository has been archived on 2025-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Ceph/emergency/restore_mons_from_osds.sh
2025-11-20 18:13:24 +01:00

20 lines
532 B
Bash

#!/bin/bash
#from: https://docs.ceph.com/docs/nautilus/rados/troubleshooting/troubleshooting-mon/?highlight=trouble%20monitor#recovery-using-osds
ms=/tmp/mon-store
mkdir $ms
hosts="ebin02 ebin01"
# collect the cluster map from OSDs
for host in $hosts; do
rsync -avz $ms/. $host:$ms.remote
rm -rf $ms
ssh $host <<EOF
for osd in /var/lib/ceph/osd/ceph-*; do
ceph-objectstore-tool --data-path \$osd --op update-mon-db --no-mon-config --mon-store-path $ms.remote
done
EOF
rsync -avz $host:$ms.remote/. $ms
done