How to change wal block in bluestore?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

  I want to change my wal device to another device.

  I search much time and write a shell script, but finally, when I
start the osd, the process is crashed.

  I think something is wrong, please help me check the script.

  Thanks!

  ceph version: ceph version 14.2.9
(bed944f8c45b9c98485e99b70e11bbcec6f6659a) nautilus (stable).

The shell script is below:
#! /bin/bash

id=$1 # osd id

vg=$2 # vg name

osdPath="/var/lib/ceph/osd/ceph-$id"
osdService="ceph-osd@${id}.service"

blockPath=$(ls -lh ${osdPath}/block|awk '{print $11}')
if [ -z "$blockPath" ]; then
    echo "no block path"
    exit 1;
fi

walPath=$(ls -lh ${osdPath}/block.wal|awk '{print $11}')
if [ -z "$walPath" ]; then
    echo "no wal path"
    exit 2;
fi

walSize=$(blockdev --getsize64 $walPath)
if [ -z "$walSize" ]; then
    echo "no wal size"
    exit 3;
fi

walUUID=$(lvdisplay ${walPath}|grep "LV UUID"|awk '{print $3}')
if [ -z "$walUUID" ]; then
    echo "no wal uuid"
    exit 3;
fi

newWalLv="journal-osd${id}"
newWalPath="/dev/${vg}/${newWalLv}"

lvcreate -n "${newWalLv}" -L${walSize}b $vg || exit 4

newWalUUID=$(lvdisplay ${newWalPath}|grep "LV UUID"|awk '{print $3}')
if [ -z "$newWalUUID" ]; then
    echo "no new wal uuid, new wal path:${newWalPath}"
    exit 3;
fi

ceph osd set noout || exit 5

systemctl stop ${osdService} || exit 6

ceph-osd -i $id --flush-journal || exit 7

dd if=${walPath} of=${newWalPath} bs=4M || exit 8

chown -h ceph:ceph $(realpath ${newWalPath}) || exit 9

ceph-bluestore-tool bluefs-bdev-migrate --path ${osdPath}
--devs-source ${osdPath}/block.wal --dev-target ${newWalPath}

chown -h ceph:ceph ${osdPath}/block.wal || exit 11

# device
lvchange --deltag "ceph.wal_device=${walPath}" ${blockPath} || exit 12
lvchange --addtag "ceph.wal_device=${newWalPath}" ${blockPath} || exit 13
# for uuid
lvchange --deltag "ceph.wal_uuid=${walUUID}" ${blockPath} || exit 12
lvchange --addtag "ceph.wal_uuid=${newWalUUID}" ${blockPath} || exit 13

# for wal lvs
for tag in $(lvs -o lv_tags ${blockPath}|grep ceph|sed 's/,/\n/g')
do
    lvchange --addtag "$tag" ${newWalPath}
done
lvchange --deltag "ceph.type=block" ${newWalPath}
lvchange --addtag "ceph.type=wal"  ${newWalPath}

systemctl start ceph-osd@${id}.service || exit 14

ceph osd unset noout || exit 15
_______________________________________________
ceph-users mailing list -- ceph-users@xxxxxxx
To unsubscribe send an email to ceph-users-leave@xxxxxxx



[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Ceph Dev]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]


  Powered by Linux