Backup and restore
Take a point-in-time backup of a Data Grid cluster with the operator's Backup resource, and restore it into the same cluster or a new one.
Cross-site replication copies a cache to another cluster, including a bad write. A Backup resource asks the operator to write a point-in-time archive of the cluster state to a persistent volume: caches, templates, counters, Protobuf schemas, tasks. A Restore resource reads that archive into a cluster. Both are custom resources. Neither is a pg_dump, and neither replaces PostgreSQL backups for data that lives in PostgreSQL.
The operator guide is explicit about two limits. Disconnect clients before a backup if you need a consistent cut, because the backup is not a database snapshot with a freeze. And the operator does not reconcile a changed Backup. Applying a new spec on an existing Backup object does nothing. A new backup is a new object, with a new name.
A backup
spec.cluster is the Infinispan name. spec.volume.storage has to be large enough for the entries and the index metadata. A cache of sessions is larger than people think. Look at the memory metric before you pick 1Gi.
apiVersion: infinispan.org/v2alpha1
kind: Backup
metadata:
name: accounts-20261029
namespace: datagrid
spec:
cluster: example-infinispan
volume:
storage: 2Gi
storageClassName: standard
resources:
caches:
- accounts
- catalog
protoSchemas:
- "*"
Leave resources out to archive everything. Name it when you want the archive to stay small and predictable. * is legal for a type. accounts-20261029 will not be reused. Tomorrow's backup is accounts-20261030.
oc apply -f backup.yaml
oc get backup -n datagrid accounts-20261029 -w
Wait for status.phase to become Succeeded. Failed is in the same field, with a reason. The usual causes are a volume that could not bind, a cluster that was not WellFormed, and a name collision with a backup that already ran.
The operator starts a short-lived pod that joins the cluster with zero capacity, so it does not take ownership of segments, and writes a zip under /opt/infinispan/backups on that volume. When the phase is Succeeded, copy the zip off the volume. A PVC that only exists inside the DC cluster is not a DR copy.
oc get pvc -n datagrid
# The claim name follows the backup name. Copy the archive out.
oc cp datagrid/<backup-pod>:/opt/infinispan/backups ./backups
Ship ./backups to object storage both sites can read. An OADP or Ramen copy of the namespace also captures the PVC, if you would rather not script oc cp. Either way, a backup you have never listed from the other site does not exist.
Do this while clients are paused when the archive has to match a quiet moment (before a risky change). For a nightly copy of a cache that tolerates a fuzzy cut, schedule a new Backup object from a CronJob. Do not patch the old one.
A restore
Restoring into a cluster that already has those caches will collide with what is there. Restore into a new Infinispan, or into a cluster where those cache names are absent. Create the cluster first, with the same operator and a compatible version. A backup is not an upgrade tool.
apiVersion: infinispan.org/v2alpha1
kind: Restore
metadata:
name: accounts-20261029
namespace: datagrid
spec:
backup: accounts-20261029
cluster: example-infinispan
The backup field is the Backup resource name in this namespace. The archive has to be on the volume that Backup created. If you are restoring on the DR cluster, recreate the Backup object there pointing at a volume you filled with the zip, or follow the operator guide for restoring from a copied volume. The Restore CR does not take an HTTP URL.
oc apply -f restore.yaml
oc get restore -n datagrid accounts-20261029 -w
Succeeded means the entries were loaded. Read a key you wrote before the backup. It should be there. A key you wrote after the backup should not. That is the cut. Then start the application.
A Restore is also one-shot. A second restore is a new Restore object. Deleting the Restore CR does not delete the data it loaded.
What this does not save
| Situation | What actually saves you |
|---|---|
| One pod dies | owners: 2 on the cache. No backup involved. |
| The DC site dies, the DR cluster is warm | Cross-site replication. The backup is the safety net under that. |
| Someone deletes the cache contents on both sites | This archive, if it was taken before the delete and shipped off the cluster. |
| PostgreSQL is corrupted | The Postgres backup. The JDBC store in the persistence lab is a copy of the cache, and it is lost if that database is lost and nowhere else has it. |
| You need a single row from last Tuesday | A backup from last Tuesday that you kept. Set a retention. An archive from this morning only answers this morning. |
Test a restore on the DR cluster once, into a scratch namespace, and write down the elapsed time and the phase. A backup whose restore has never completed is a file, not a procedure.
What's next
Security and monitoring covers who can create a Backup (it is an administrative act) and the metrics that show the cluster is healthy enough to take one. The wider drill, including how you record the result, is Platform testing.