Chapter 10. 3scale backup and restore using custom resources
This chapter includes details about the backup and restore functionality for a Red Hat 3scale API Management installation deployed using the APIManager custom resource (CR). In this context, the CRD is provided by the 3scale operator.
Custom resources from operator capabilities are not part of the 3scale installation. For this reason, the custom resources are not included as part of the 3scale installation backup and restore functionality.
Prerequisites
- A 3scale installation
The following sections contain the procedures to perform 3scale backup and restore using the operator.
10.1. Backing up 3scale using the operator Copy linkLink copied to clipboard!
The following section provides the information and procedure you require to backup a 3scale installation that was deployed by an APIManager custom resource (CR).
10.1.1. Backup compatible scenarios Copy linkLink copied to clipboard!
To see the 3scale installation configurations that can be backed up, see the following sections:
Prerequisites
Backup the 3scale external databases:
-
backend-redis
-
system-redis
-
system-database
-
zync
(optional)
-
- Provision enough space for the PVC to contain the data backed up.
If you deploy 3scale with the APIManager, you cannot use Amazon S3 as system’s FileStorage.
For more information on external databases, see External databases installation.
10.1.2. Backup scenarios scope Copy linkLink copied to clipboard!
Backup functionality is available when the following databases are configured externally:
- Backend Redis database
- System Redis database
- System database - MySQL or PostgreSQL
- Zync database (optional)
10.1.3. Backed up data Copy linkLink copied to clipboard!
The following table shows a list of the data that is backed up.
Object | Object-type data |
---|---|
Secrets |
|
ConfigMaps |
|
APIManager | APIManager CR Kubernetes object definition - json schema definition |
System FileStorage | When the location of System FileStorage is in a PersistentVolumeClaim (PVC) |
10.1.4. Backing up 3scale Copy linkLink copied to clipboard!
To backup a 3scale installation deployed with an existing APIManager, use the following steps:
Procedure
Backup the following Kubernetes secrets:
-
backend-redis
-
system-redis
-
system-database
-
zync
(optional)
-
Create the
APIManagerBackup
CR in the same namespace where the 3scale installation managed by the APIManager object is deployed, as in example one:Example 1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 2 provides a pre-existing PersistentVolume name:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Wait until
APIManagerBackup
finishes. Check this by obtaining the content ofAPIManagerBackup
and waiting until the.status.completed
field is set to true.
The backup contents is detailed in Backed up data.
Other fields in the status section of the APIManagerBackup
show details of the backup, such as the name of the PVC where the data has been backed up when the configured backup destination has been a PVC.
For future references, take note of the value of status.backupPersistentVolumeClaimName
field. When restoring an APIManager installation with APIManagerRestore
, one of the fields it requires is the PersistentVolumeClaimName
backup source.
10.1.5. Backing up 3scale custom resources Copy linkLink copied to clipboard!
If you do not have copies of your CRs outside of the OpenShift administrator account, create a backup of the 3scale project CRs using the following commands:
Type the following command to export the ActiveDocs CR from your 3scale project:
oc get activedocs.capabilities.3scale.net -o yaml > activedocs.yaml
oc get activedocs.capabilities.3scale.net -o yaml > activedocs.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Type the following command to export the backend CR from your 3scale project:
oc get backend.capabilities.3scale.net -o yaml > backend.yaml
oc get backend.capabilities.3scale.net -o yaml > backend.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Type the following command to export the CustomPolicyDefinition CR from your 3scale project:
oc get custompolicydefinition.capabilities.3scale.net -o yaml > custompolicydefinition.yaml
oc get custompolicydefinition.capabilities.3scale.net -o yaml > custompolicydefinition.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Type the following command to export the DeveloperAccount CR from your 3scale project:
oc get developeraccount.capabilities.3scale.net -o yaml > developeraccount.yaml
oc get developeraccount.capabilities.3scale.net -o yaml > developeraccount.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Type the following command to export the DeveloperUser CR from your 3scale project:
oc get developeruser.capabilities.3scale.net -o yaml > developeruser.yaml
oc get developeruser.capabilities.3scale.net -o yaml > developeruser.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Type the following command to export OpenAPI CR from your 3scale project:
oc get openapi.capabilities.3scale.net -o yaml > openapi.yaml
oc get openapi.capabilities.3scale.net -o yaml > openapi.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Type the following command to export the product CR from your 3scale project:
oc get product.capabilities.3scale.net -o yaml > product.yaml
oc get product.capabilities.3scale.net -o yaml > product.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Type the following command to export the tenant CR from your 3scale project:
oc get tenant.capabilities.3scale.net -o yaml > tenant.yaml
oc get tenant.capabilities.3scale.net -o yaml > tenant.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.2. Restoring 3scale using the operator Copy linkLink copied to clipboard!
The following section provides the information and procedure you require to restore a 3scale installation that was previously deployed by an APIManager custom resource and backed up by APIManagerBackup
.
10.2.1. Restore compatible scenarios Copy linkLink copied to clipboard!
To see the 3scale installation configurations that can be restored, see the following sections:
Prerequisites
Restore the 3scale external databases:
-
backend-redis
-
system-redis
-
system-database
- MySQL or PostgreSQL -
zync
(optional)
-
10.2.2. Restore scenarios scope Copy linkLink copied to clipboard!
The restore functionality of the 3scale operator is available using a backup generated from an APIManagerBackup
custom resource.
For a list of the 3scale solution scenarios you can backup, see Backed up data for reference.
The following are not in the scope of the restore functionality of the operator:
-
Restoring backup data that was not performed using an
APIManagerBackup
custom resource. -
Restoring backup data provided through an
APIManagerBackup
from different 3scale versions.
10.2.3. Restored data Copy linkLink copied to clipboard!
The following table shows a list of the data that is restored.
Object | Object-type data |
---|---|
Secrets |
|
ConfigMaps |
|
APIManager | APIManager custom resource Kubernetes object definition - json schema definition |
System FileStorage | When the location of System FileStorage is in a PersistentVolumeClaim (PVC) |
Routes | 3scale-related OpenShift routes, for example master and tenants |
10.2.4. Restoring 3scale Copy linkLink copied to clipboard!
To restore a 3scale installation previously deployed with an APIManager that was backed up using an APIManagerBackup
custom resource, follow these steps:
- Ensure that the project where you are performing the restoration does not contain an APIManager custom resource and its corresponding 3scale installation.
Restore the following Kubernetes secrets:
-
backend-redis
-
system-redis
-
system-database
-
zync
secret ifzync
was an external database
-
Create the
APIManagerRestore
custom resource and specify the backup data of the installation that was previously backed up by anAPIManagerBackup
custom resource.For details, see Backup scenarios scope.
The following is an example of an
APIManagerRestore
custom resource:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Wait until
APIManagerRestore
finishes. Check this by obtaining the content ofAPIManagerRestore
and waiting until the.status.completed
field is set to true.You should see a new APIManager custom resource has been created and a 3scale installation deployed.