porthole/docs/rbd_pv.md
Matthew Heler a4078d8a7a [CEPH] Add a support script for manipulating a PV backed by RBD
Features of the script include:
- creating and removing a snapshot within Ceph for a PV
- backing up and restoring a PV within Ceph
- listing the RBD image details (watchers, thin/thick provisioned
usage, image properties) and snapshot information

Take note that all backups are by default stored locally in
"/var/lib/openstack-helm/ceph/backup" on the POD hosting this
utility container

Change-Id: I5de30d5337754a411b5e1162a215596afb469bac
2019-02-07 07:57:36 -06:00

1.7 KiB

RBD PVC/PV script

This MOP covers Maintenance Activities related to using the rbd_pv script to backup and recover PVCs within your kubernetes environment using Ceph.

Usage

Execute nccli rbd_pv without arguements to list usage options.

nccli rbd_pv
Backup Usage: nccli rbd_pv [-b <pvc name>] [-n <namespace>] [-d <backup dest> (optional, default: /tmp/backup)] [-p <ceph rbd pool> (optional, default: rbd)]
Restore Usage: nccli rbd_pv [-r <restore_file>] [-p <ceph rbd pool> (optional, default: rbd)]
Snapshot Usage: nccli rbd_pv [-b <pvc name>] [-n <namespace>] [-p <ceph rbd pool> (optional, default: rbd] [-s <create|rollback|remove> (required)]

Backing up a PVC/PV from RBD

To backup a PV, execute the following:

nccli rbd_pv -b mysql-data-mariadb-server-0 -n openstack

Restoring a PVC/PV backup

To restore a PV RBD backup image, execute the following:

nccli rbd_pv -r /backup/kubernetes-dynamic-pvc-ab1f2e8f-21a4-11e9-ab61-ca77944df03c.img

NOTE: The original PVC/PV will be renamed and not overwritten. NOTE: Before restoring, you must ensure it is not mounted!

Creating a Snapshot for a PVC/PV

nccli rbd_pv -b mysql-data-mariadb-server-0 -n openstack -s create

Rolling back to a Snapshot for a PVC/PV

nccli rbd_pv -b mysql-data-mariadb-server-0 -n openstack -s rollback

NOTE: Before rolling back a snapshot, you must ensure the PVC/PV volume is not mounted!!

Removing a Snapshot for a PVC/PV

nccli rbd_pv -b mysql-data-mariadb-server-0 -n openstack -s remove

NOTE: This will remove all snapshots in Ceph associated to this PVC/PV!

Show Snapshot and Image details for a PVC/PV

nccli rbd_pv -b mysql-data-mariadb-server-0 -n openstack -s show