|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * backup_and_restore/application_backup_and_restore/backing_up_and_restoring/backing-up-applications.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="oadp-ceph-cephfs_{context}"] |
| 7 | += Backing up and restoring data using OADP 1.2 Data Mover and CephFS storage |
| 8 | + |
| 9 | +You can use OpenShift API for Data Protection (OADP) 1.2 Data Mover to back up and restore data using CephFS storage by enabling the shallow copy feature of CephFS. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* A stateful application is running in a separate namespace with persistent valune claims (PVCs) using CephFS as the provisioner. |
| 14 | +* The `StorageClass` and `VolumeSnapshotClass` CRs are defined for CephFS and OADP 1.2 Data Mover. |
| 15 | +* There is a secret `cloud-credentials` in the `openshift-adp` namespace. |
| 16 | +
|
| 17 | +.Procedure |
| 18 | + |
| 19 | +. Verify that `deletionPolicy` of the `VolumeSnapshotClass` CR is set to `Retain` by running the following command: |
| 20 | ++ |
| 21 | +[source,terminal] |
| 22 | +---- |
| 23 | +$ oc get volumesnapshotclass -A -o jsonpath='{range .items[*]}{"Name: "}{.metadata.name}{" "}{"Retention Policy: "}{.deletionPolicy}{"\n"}{end}' |
| 24 | +---- |
| 25 | + |
| 26 | +. Verify that the labels of the `VolumeSnapshotClass` CR are set to `true` by running the following command: |
| 27 | ++ |
| 28 | +[source,terminal] |
| 29 | +---- |
| 30 | +$ oc get volumesnapshotclass -A -o jsonpath='{range .items[*]}{"Name: "}{.metadata.name}{" "}{"labels: "}{.metadata.labels}{"\n"}{end}' |
| 31 | +---- |
| 32 | + |
| 33 | +. Verify that the `storageclass.kubernetes.io/is-default-class` annotation of the `StorageClass` CR is set to `true` by running the following command: |
| 34 | ++ |
| 35 | +[source,terminal] |
| 36 | +---- |
| 37 | +$ oc get storageClass -A -o jsonpath='{range .items[*]}{"Name: "}{.metadata.name}{" "}{"annotations: "}{.metadata.annotations}{"\n"}{end}' |
| 38 | +---- |
| 39 | + |
| 40 | +. Create a Data Protection Application (DPA) CR similar to the following. |
| 41 | ++ |
| 42 | +.Example DPA CR |
| 43 | ++ |
| 44 | +[source,yaml] |
| 45 | +---- |
| 46 | +apiVersion: oadp.openshift.io/v1alpha1 |
| 47 | +kind: DataProtectionApplication |
| 48 | +metadata: |
| 49 | + name: velero-sample |
| 50 | + namespace: openshift-adp |
| 51 | +spec: |
| 52 | + backupLocations: |
| 53 | + - velero: |
| 54 | + config: |
| 55 | + profile: default |
| 56 | + region: us-east-1 |
| 57 | + credential: |
| 58 | + key: cloud |
| 59 | + name: cloud-credentials |
| 60 | + default: true |
| 61 | + objectStorage: |
| 62 | + bucket: <my-bucket> |
| 63 | + prefix: velero |
| 64 | + provider: aws |
| 65 | + configuration: |
| 66 | + restic: |
| 67 | + enable: false <1> |
| 68 | + velero: |
| 69 | + defaultPlugins: |
| 70 | + - openshift |
| 71 | + - aws |
| 72 | + - csi |
| 73 | + - vsm |
| 74 | + features: |
| 75 | + dataMover: |
| 76 | + credentialName: <restic-secret-name> <2> |
| 77 | + enable: true <3> |
| 78 | + volumeOptionsForStorageClasses: |
| 79 | + ocs-storagecluster-cephfs: |
| 80 | + sourceVolumeOptions: |
| 81 | + accessMode: ReadOnlyMany |
| 82 | + cacheAccessMode: ReadWriteMany |
| 83 | + cacheStorageClassName: ocs-storagecluster-cephfs |
| 84 | + storageClassName: ocs-storagecluster-cephfs-shallow |
| 85 | +---- |
| 86 | +<1> There is no default value for the `enable` field. Valid values are `true` or `false`. |
| 87 | +<2> Use the Restic `Secret` that you created when you prepared your environment for working with OADP 1.2 Data Mover and Ceph. If you do not, then the CR will use the default value `dm-credential` for this parameter. |
| 88 | +<3> There is no default value for the `enable` field. Valid values are `true` or `false`. |
| 89 | + |
| 90 | +. To back up data, complete the following steps: |
| 91 | + |
| 92 | +.. Create a `Backup` CR similar to the following: |
| 93 | ++ |
| 94 | +.Example `Backup` CR |
| 95 | ++ |
| 96 | +[source,yaml] |
| 97 | +---- |
| 98 | +apiVersion: velero.io/v1 |
| 99 | +kind: Backup |
| 100 | +metadata: |
| 101 | + name: <backup-name> |
| 102 | + namespace: <protected-ns> |
| 103 | +spec: |
| 104 | + includedNamespaces: |
| 105 | + - <app-ns> |
| 106 | + storageLocation: velero-sample-1 |
| 107 | +---- |
| 108 | + |
| 109 | +.. Monitor the progress of the `VolumeSnapshotBackup` CRs by doing the following: |
| 110 | +... To check the progress of all the `VolumeSnapshotBackup` CRs, run the following command: |
| 111 | ++ |
| 112 | +[source, terminal] |
| 113 | +---- |
| 114 | +$ oc get vsb -n <app-ns> |
| 115 | +---- |
| 116 | + |
| 117 | +... To check the progress of a specific `VolumeSnapshotBackup` CR, run the following command: |
| 118 | ++ |
| 119 | +[source,terminal] |
| 120 | +---- |
| 121 | +$ oc get vsb <vsb-name> -n <app-ns> -ojsonpath="{.status.phase}` |
| 122 | +---- |
| 123 | + |
| 124 | +.. Wait several minutes until the `VolumeSnapshotBackup` CR has the status `Completed`. |
| 125 | +.. Verify that there is at least one snapshot in the object store that is given in the Restic `secret`. You can check for this snapshot in your targeted `BackupStorageLocation` storage provider that has a prefix of `/<OADP-namespace>`. |
| 126 | + |
| 127 | +. To restore data, complete the following steps: |
| 128 | + |
| 129 | +.. Delete the application namespace by running the following command: |
| 130 | ++ |
| 131 | +[source,terminal] |
| 132 | +---- |
| 133 | +$ oc delete vsb -n <app_namespace> --all |
| 134 | +---- |
| 135 | + |
| 136 | +.. Delete any `VolumeSnapshotContent` CRs that were created during backup by by running the following command: |
| 137 | ++ |
| 138 | +[source,terminal] |
| 139 | +---- |
| 140 | +$ oc oc delete volumesnapshotcontent --all |
| 141 | +---- |
| 142 | + |
| 143 | +.. Create a `Restore` CR similar to the following: |
| 144 | ++ |
| 145 | +.Example `Restore` CR |
| 146 | ++ |
| 147 | +[source,yaml] |
| 148 | +---- |
| 149 | +apiVersion: velero.io/v1 |
| 150 | +kind: Restore |
| 151 | +metadata: |
| 152 | + name: <restore-name> |
| 153 | + namespace: <protected-ns> |
| 154 | +spec: |
| 155 | + backupName: <previous-backup-name> |
| 156 | +---- |
| 157 | + |
| 158 | +.. Monitor the progress of the `VolumeSnapshotRestore` CRs by doing the following: |
| 159 | +... To check the progress of all the `VolumeSnapshotRestore` CRs, run the following command: |
| 160 | ++ |
| 161 | +[source, terminal] |
| 162 | +---- |
| 163 | +$ oc get vsr -n <app-ns> |
| 164 | +---- |
| 165 | + |
| 166 | +... To check the progress of a specific `VolumeSnapshotRestore` CR, run tc: |
| 167 | ++ |
| 168 | +[source,terminal] |
| 169 | +---- |
| 170 | +$ oc get vsr <vsr-name> -n <app-ns> -ojsonpath="{.status.phase} |
| 171 | +---- |
| 172 | + |
| 173 | +.. Verify that your application data has been restored by running the following command: |
| 174 | ++ |
| 175 | +[source,terminal] |
| 176 | +---- |
| 177 | +$ oc get route <route-name> -n <app-ns> -ojsonpath="{.spec.host}" |
| 178 | +---- |
0 commit comments