Ramen backup
How Ramen, the operator behind OpenShift Data Foundation disaster recovery, replicates an application and its volumes from the DC cluster to the DR cluster, and where that stops relative to Oracle Data Guard.
Ramen is the controller behind OpenShift Data Foundation disaster recovery. On the Advanced Cluster Management hub it stores a DRPolicy and a DRPlacementControl per application. On each managed cluster the DR cluster operator replicates persistent volumes and backs up the Kubernetes objects that belong to the workload. A failover or a relocate brings those objects up on the other site.
That is the right tool for an application namespace: a Deployment, its ConfigMaps, and a PVC of uploaded files or generated reports. It is the wrong tool for the Oracle data files. Those are protected by Data Guard, which ships redo. A crash-consistent disk mirror of a running Oracle instance is a copy you still have to recover, and it will be missing the last commits.
Two copies, two jobs
| Data Guard | Ramen | |
|---|---|---|
| Protects | The Oracle 19c database | OpenShift workloads and their PVCs |
| Copy | Redo, applied on a physical standby | Volume replication on the DRPolicy interval, plus a backup of the Kubernetes objects to object storage |
| Role change | SWITCHOVER or FAILOVER in dgmgrl |
Relocate or Failover on the DRPlacementControl |
| Stateless app | Nothing to do | Git already holds the manifests. Ramen adds little until there is a PVC |
Regional DR, which is the async layout, takes a recovery point of about one scheduling interval. A policy named for 5m can lose writes from the last few minutes of a PVC. Metro DR uses a storage cluster both sites can see, and it is for two sites close enough to share that latency. One pair of clusters has a single Metro policy. Do not invent a second one beside it.
Prerequisites
- A hub cluster with Advanced Cluster Management, the ODF Multicluster Orchestrator, and the OpenShift DR Hub operator.
- Two managed clusters, called
dcanddrhere, each with OpenShift Data Foundation, and the DR cluster operator inopenshift-dr-system. - A
DRPolicyalready validated. The orchestrator creates it, and it creates theDRClusterobjects with it. EditingschedulingIntervalon an existing policy is not supported. A different interval is a new policy, and the interval has to be one the storage peer already accepts. - An application project on
dcwith one PVC. The Oracle client Deployment is a good tenant. The database files stay outside this namespace.
oc get drpolicy
oc get drcluster
oc get csv,pod -n openshift-dr-system
PHASE Succeeded on the policy, and a running DR cluster operator on both managed clusters, is the starting point. The S3 profile on each DRCluster is where Ramen stores the Kubernetes-object backup. Both clusters need to reach that bucket.
What gets backed up
For an application enrolled in the policy, Ramen keeps two things moving:
- Volumes. A
VolumeReplicationGroupin the application namespace follows the PVCs. Ceph RBD mirroring (regional) copies the blocks on the policy interval.oc get vrg -n paymentsshowsdesiredStateandcurrentState.Primaryondcis the healthy direction. - Objects. Deployments, Services, ConfigMaps, Secrets and the PVC claims are backed up to the S3 profile so the DR cluster can recreate them. GitOps remains the better source for anything you can rebuild from Git. Ramen covers the objects and the data that Git does not have.
oc get volumereplicationgroups.ramendr.openshift.io -n payments
oc get volumereplication.replication.storage.openshift.io -n payments
oc get drpc -A -o wide
On current ODF, a discovered application (one you deployed directly on dc, outside an ACM subscription) keeps its DRPlacementControl in openshift-dr-ops on the hub. A subscription-based application keeps it in the application namespace. lastGroupSyncTime on that object is the last successful volume sync. A stamp older than two intervals is the alarm.
Enrol the application
From the hub console, Data Services → Disaster recovery, add the application namespace to the policy. The console writes a Placement and a DRPlacementControl. The resulting object looks like this:
apiVersion: ramendr.openshift.io/v1alpha1
kind: DRPlacementControl
metadata:
name: payments-app-drpc
namespace: openshift-dr-ops
spec:
preferredCluster: dc
drPolicyRef:
name: dc-dr-5m
placementRef:
kind: Placement
name: payments-app-placement
pvcSelector:
matchLabels:
app: payments-app
pvcSelector has to match the claim labels. A PVC with no matching label is absent after failover, and the pod sits Pending.
Write a file into the PVC on dc, wait one interval, and confirm lastGroupSyncTime moved.
Relocate, then fail over
Relocate is the planned move. Both clusters are healthy. The hub replicates, flips the volume to primary on the destination, and starts the pods there.
oc patch drpc payments-app-drpc -n openshift-dr-ops --type merge \
--patch '{"spec":{"action":"Relocate","preferredCluster":"dr"}}'
oc get drpc payments-app-drpc -n openshift-dr-ops -o wide
Wait until CURRENTSTATE is Relocated and PROGRESSION is Completed. Read the file back from a pod on dr. Then relocate to dc the same way, with preferredCluster: dc.
Failover is the unplanned move, used when dc is gone. Fencing the failed cluster first stops it writing to storage it no longer owns:
oc patch drcluster dc --type merge --patch '{"spec":{"clusterFence":"Fenced"}}'
oc patch drpc payments-app-drpc -n openshift-dr-ops --type merge \
--patch '{"spec":{"action":"Failover","failoverCluster":"dr"}}'
Fencing applies to the whole cluster's replicated storage, so every protected application on dc feels it. In a drill, prefer Relocate, and fence only when you mean to cut the site.
When dc returns, set clusterFence: Unfenced, confirm PEER READY is true, and Relocate back. A StatefulSet that sticks in MovingToSecondary usually still holds PVCs on the old site. Delete those claims after you are sure the data lives on the destination, then watch PROGRESSION reach Completed.
Where Oracle fits
Keep Oracle on Data Guard. If the database runs inside an OpenShift Virtualization VM, Ramen can relocate the VM, and you still want Data Guard or a quiesced backup inside the guest: a live block copy of an open database is not a consistent standby. Ramen recipes can run a hook before capture. A hook is a good place to flush an application write cache. It is a poor place to invent a database recovery procedure.
Point the application at the Data Guard service orcl_rw from the previous lab. After a database switchover the Service name is unchanged. After a Ramen relocate, the application pods move and use the same service name, which is why the database and the application can fail over on different decisions. Write down which one you fail first: usually the database, then the apps, so the new pods find a primary that already accepts writes.
What's next
Data Guard is the database half. Backup and restore of OpenShift projects with OADP, which Ramen uses for the object backup, is rehearsed in the OpenShift AI DC/DR labs. Storage-level SnapMirror is a different path again, covered in Trident data protection.