Creating a full backup in RHDG 8.2+
Environment
- Red hat OpenShift Container Platform (OCP)
- 4.x
- Red Hat Data Grid (RHDG)
- 8.2+
Issue
What is the process of creating a backup in zip in DG 8?
How to confirm the creation of the backup zip?
Resolution
Putting data inside:
[user-2089@cluster//containers/default/caches/___script_cache]> put 1 abcd
[user-2089@cluster//containers/default/caches/___script_cache]> get 1
abcd
Backup Creation:
For Backup creation see here:
### backup creation
[fdemeloj-2089@cluster//containers/default/caches/___script_cache]> backup create
Creating backup 'Red Hat Data Grid-20220511115425'
...
### backup listing
[fdemeloj-2089@cluster//containers/default/caches/___script_cache]> backup ls
["Red Hat Data Grid-20220511115425"]
...
### export as zip file:
[fdemeloj-2089@cluster//containers/default/caches/___script_cache]> backup get Red\ Hat\ Data\ Grid-20220511115425
Downloading backup Red Hat Data Grid-20220511115425
Downloaded file 'Red Hat Data Grid-20220511115425.zip' <----
...
### export as zip listing
[fdemeloj-2089@cluster//containers/default/caches/___script_cache]> backup ls
["Red Hat Data Grid-20220511115425"]
...
### see the zip file on $RHDG root path:
[fdemeloj@fdemeloj redhat-datagrid-8.3.0-server]$ ls
bin boot Copyright.txt docs lib README.adoc Red Hat Data Grid-20220511115425.zip server static version.txt
...
To see the zip data
...
Backup Inspection:
[fdemeloj@fdemeloj redhat-datagrid-8.3.0-server]$ unzip -l Red\ Hat\ Data\ Grid-20220511121300.zip
Archive: Red Hat Data Grid-20220511121300.zip
Length Date Time Name
...
354 05-11-2022 12:13 containers/default/container.properties
0 05-11-2022 12:13 containers/default/counters/counters.dat
517 05-11-2022 12:13 containers/default/templates/org.infinispan.SCATTERED_SYNC.xml
384 05-11-2022 12:13 containers/default/templates/org.infinispan.LOCAL.xml
445 05-11-2022 12:13 containers/default/templates/org.infinispan.INVALIDATION_SYNC.xml
483 05-11-2022 12:13 containers/default/templates/org.infinispan.REPL_SYNC.xml
462 05-11-2022 12:13 containers/default/templates/org.infinispan.REPL_ASYNC.xml
424 05-11-2022 12:13 containers/default/templates/org.infinispan.INVALIDATION_ASYNC.xml
464 05-11-2022 12:13 containers/default/templates/org.infinispan.DIST_ASYNC.xml
485 05-11-2022 12:13 containers/default/templates/org.infinispan.DIST_SYNC.xml
671 05-11-2022 12:13 containers/default/templates/example.PROTOBUF_DIST.xml
2726 05-11-2022 12:13 containers/default/global.xml
1 05-11-2022 12:13 containers/default/tasks/abcd <--- data
1 05-11-2022 12:13 containers/default/tasks/abc <--- data
4 05-11-2022 12:13 containers/default/tasks/1 <--- data
100 05-11-2022 12:13 manifest.properties
...
7521 16 files
Important during the creation of the backup:
2022-05-11 11:54:25,956 INFO (non-blocking-thread--p2-t16) [org.infinispan.server.core.backup.BackupManagerImpl] ISPN005043: Starting backup 'Red Hat Data Grid-20220511115425'
2022-05-11 11:54:26,113 INFO (non-blocking-thread--p2-t15) [org.infinispan.server.core.backup.BackupManagerImpl] ISPN005044: Backup file created 'Red Hat Data Grid-20220511115425.zip'
Restore
After the file backup is created one can restore it in another cluster by the backup restore command:
backup restore /path/data/red_hat_data_grid.zip
There might or might not be a null message after the operation, but it does not mean the restore failed.
Process on OCP 4
As described on This content is not included.DG Operator - Backup & Restore, on the DG Operator create a new CR Batch, the process will create a pod (with default 1 cpu and 1Gi memory) that is not a "standard" node. It has zero-capacity=true, so no state transfer occurs when it joins the cluster. Then a storage (PVC) will be created and a pod to run this process. The pod will do the process (create the backup) - the backup .zip is created on a PVC named after the Backup CR:
apiVersion: infinispan.org/v2alpha1
kind: Backup
metadata:
name: an-example-backup
namespace: a-namespace
spec:
cluster: a-cluster
container:
cpu: 1000m
extraJvmOpts: '-Djava.property=me'
memory: 1Gi
Another option to create a backup and apply it as a restore is to connect the cli inside in the pod and do it manually: ./bin/cli.sh -c -; backup created; backup restore /opt/infinispan/server/data/red_hat_data_grid-example.zip.
For manual generation inside a pod, the backup will be located inside: /opt/infinispan/server/data/backups. Example:
sh-5.1$ cd /opt/infinispan/server/data/backups
sh-5.1$ ls
'Red Hat Data Grid-20251007065013'
Root Cause
Backup and restore command were implemented DG 8.2.x.
Also one could use REST request to get some data from DG 8, but downloading by http is not implemented.
DG 8 - 2.1.12. Retrieving Data By Keys
GET /rest/v2/caches/{cacheName}/{cacheKey}
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.