Please replace
$ID
with the OSD number and
/mnt/$DRIVE
with a temporary path where you can save the map.
Please make sure that you don't destroy anything productive here, for example new keyrings will be created. If you have an existing CEPH, that could kill it. I would recommend you do it in another server where you can't destroy anything productive.
Otherwise, please note that the instructions may be incomplete or incorrect. Therefore, check the commands in detail and, if necessary, create a backup copy of the OSD beforehand so that you have several attempts to get to your data.
Extract necessary information from the OSD
Code:
ceph-objectstore-tool --data-path /var/lib/ceph/osd/ceph-$ID --op update-mon-db --mon-store-path /mnt/$DRIVE
You should then find a few files in the folder
/mnt/$DRIVE
, something like
kv_backend
and
store.db
.
Create new keyrings
Code:
ceph-authtool /etc/ceph/ceph.client.admin.keyring --create-keyring --gen-key -n client.admin --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow *'
ceph-authtool /etc/ceph/ceph.client.admin.keyring --gen-key -n mon. --cap mon 'allow *'
Backup the current monmap (if necessary)
Code:
mv /var/lib/ceph/mon/ceph-mon1/store.db /var/lib/ceph/mon/ceph-mon1/store.bak
Copy the extracted monmap back to the old location and assign permissions
Code:
mv /mnt/$DRIVE/store.db /var/lib/ceph/mon/ceph-mon1/store.db
chown -R ceph:ceph /var/lib/ceph/mon/ceph-mon1
In order for the individual mon to start, we have to manipulate the map a little
Code:
ceph-mon -i mon1 --extract-monmap /tmp/monmap
Take a quick look at the map
Code:
monmaptool /tmp/monmap -print
If there is more than one entry then the others must be removed
Code:
monmaptool /tmp/monmap --rm ceph-mon2
monmaptool /tmp/monmap --rm ceph-mon3
Check again that they are really gone
Code:
monmaptool /tmp/monmap -print
Inject map again
Code:
ceph-mon -i mon1 --inject-monmap /tmp/monmap
Now restart all OSDs and integrate the CEPH again as normal as RBD and pull down the data.