osd journal 一键迁移脚本


    #!/bin/bash
    osd_id=$1
    journal_dev=$2
    if [ $# -lt 2 ]
    then
    echo "example: osd_journal_migration.sh 0 /dev/sdb1"
    exit 0
    fi
    service ceph-osd stop id=$osd_id
    ceph-osd --flush-journal -i $osd_id
    sleep 2
    mv /var/lib/ceph/osd/ceph-$osd_id/journal /var/lib/ceph/osd/ceph-$osd_id/journal_old
    ln -s $journal_dev /var/lib/ceph/osd/ceph-$osd_id/journal
    ceph-osd --mkjournal -i $osd_id
    sleep 3
    service ceph-osd restart id=$osd_id
    echo "****new journal path info:****"
    ls -la /var/lib/ceph/osd/ceph-$osd_id/journal
    ceph osd tree
    echo "****if fail run cmd:****"
    echo "service ceph-osd restart id=$osd_id"

你可能感兴趣的:(ceph,OSD)