Skip to content

Instantly share code, notes, and snippets.

@mainframe
Forked from wido/ceph-upgrade-hammer-jewel.sh
Created December 6, 2016 13:26
Show Gist options
  • Save mainframe/2f8996287b59fe438abc3c0217dcdf17 to your computer and use it in GitHub Desktop.
Save mainframe/2f8996287b59fe438abc3c0217dcdf17 to your computer and use it in GitHub Desktop.
Ceph upgrade OSD from Hammer to Jewel
#!/bin/bash
#
# Script for updating a running Ceph Hammer cluster to Jewel
#
# This has to be run on the OSD node(s) as root
#
# Written for and tested on CentOS 7
#
# Used to upgrade Ceph at ODC-Noord in the Netherlands
#
CEPH_MAJOR_VERSION=$(ceph -v|awk '{print $3}'|cut -d '.' -f 1)
if [ ${CEPH_MAJOR_VERSION} -lt 10 ]; then
echo "Error: This script requires at least Ceph Major version 10"
ceph -v
exit 1
fi
DONE_FILE="/var/tmp/ceph.jewel.upgrade.done"
test -f $DONE_FILE && exit 0
echo "Killing all OSDs"
killall ceph-osd || echo "No running OSDs found"
echo "Changing permissions of /var/lib/ceph"
chown -R ceph:ceph /var/lib/ceph
echo "Changing permissions of /var/log/ceph"
chown -R ceph:ceph /var/log/ceph
for ID in $(ls /var/lib/ceph/osd/|cut -d '-' -f 2); do
JOURNAL=$(readlink -f /var/lib/ceph/osd/ceph-${ID}/journal)
chown ceph ${JOURNAL}
systemctl start ceph-osd@${ID}.service
systemctl enable ceph-osd@${ID}.service
done
# Try to start the OSDs again due to this bug
# http://tracker.ceph.com/issues/16672
systemctl daemon-reload
sleep 10
for ID in $(ls /var/lib/ceph/osd/|cut -d '-' -f 2); do
systemctl reset-failed ceph-osd@${ID}.service
systemctl start ceph-osd@${ID}.service
done
sleep 5
for ID in $(ls /var/lib/ceph/osd/|cut -d '-' -f 2); do
systemctl reset-failed ceph-osd@${ID}.service
systemctl start ceph-osd@${ID}.service
done
touch $DONE_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment