This page describes how to restore Cassandra in a single region.
In a single region deployment, Apigee hybrid is deployed in a single data center or a region. If you have multiple Apigee organizations in your deployment, the restore process restores data for all the organizations. In a multi-organization setup, you cannot restore a specific organization.
Restoring a region from a backup
Choose the instructions below for the management tool you are using for Apigee hybrid:
Helm
-
Update the Cassandra restore details in the
overrides.yamlfile:namespace: YOUR_RESTORE_NAMESPACE # Use the same namespace as in your original cluster. cassandra: hostNetwork: false ... restore: enabled: true serviceAccountPath: "SA_JSON_FILE_PATH" dbStorageBucket: "CLOUD_STORAGE_BUCKET_PATH" cloudProvider: "GCP" # required verbatim "GCP" (all caps) snapshotTimestamp: "TIMESTAMP" ... backup: enabled: false ...
Where:
Property Description namespaceYOUR_RESTORE_NAMESPACE
Namespace for restore. Use the same namespace as in your original cluster.
cassandra:hostNetworkhostNetworkis required and should always be set tofalse.restore:enabledRestore is disabled by default. You must set this property to true.restore:serviceAccountPathSA_JSON_FILE_PATH
The path on your filesystem to the service account you created for the backup.
restore:dbStorageBucketCLOUD_STORAGE_BUCKET_PATH
The Cloud Storage bucket path where your backup data is stored in the following format:
gs://BUCKET_NAME. Thegs://is required.restore:cloudProviderGCPThe
cloudProvider: "GCP"property is required.restore:snapshotTimestampTIMESTAMP
The timestamp of the backup snapshot to restore. To check what timestamps can be used, go to the
dbStorageBucketand look at the files that are present in the bucket. Each file name contains a timestamp value. For example,backup_20210203213003_apigee-cassandra-default-0.tgzWhere 20210203213003 is the
snapshotTimestampvalue you would use if you wanted to restore the backups created at that point in time.backup:enabledYou should set this property to falsein case it had been previously set totrue. -
In case you do not have a clean cluster to start out with, follow the Decommission a hybrid region for helm documentation to bring your existing Hybrid installation into a clean state (you can leave the Cert Manager installed). This would bring you to an equal state as if you would have followed Helm runtime setup manual until the beginning of Step 11.
-
Verify there are no pods remaining in the Apigee namespaces:
kubectl get pods -n apigeekubectl get pods -n apigee-system -
If you are using CSI backup, make sure that you can see the volumesnapshots you want to use for the restoration process by running:
kubectl get volumesnapshot -n apigee -
Install all Hybrid components one by one as described in Step 11 on the installation manual. Note that the
apigee-cassandra-restorepod will get created once you run the command to install thedatastore, but it will only go intorunningstate after you install theapigee-orgcomponent.
See Cassandra backup overview for more details on Cassandra backup and restore.
apigeectl
In your configuration, the Cassandra backup can reside either on Cloud Storage or on a remote server. In either case, perform the following steps to restore:
- Verify the hybrid version.
Ensure the version is the same version that created the backup files in storage.apigeectl version
- Confirm that the Kubernetes cluster you are restoring to does not have a prior Apigee hybrid installation. If
you are restoring to the existing cluster, use the following commands to delete the existing Apigee
hybrid installation:
apigeectl delete -f overrides.yamlkubectl -n apigee get apigeedatastore,apigeeredis,apigeetelemetry,org,env,arc # The output should be empty.apigeectl delete --all -f overrides.yaml - Open your
overrides.yamlfile and set therestoreproperties to the desired values:Cloud Storage
Parameters
namespace: YOUR_RESTORE_NAMESPACE # Use the same namespace as in your original cluster. cassandra: hostNetwork: false ... restore: enabled: true serviceAccountPath: "SA_JSON_FILE_PATH" dbStorageBucket: "CLOUD_STORAGE_BUCKET_PATH" cloudProvider: "GCP" # required verbatim "GCP" (all caps) snapshotTimestamp: "TIMESTAMP" ... backup: enabled: false serviceAccountPath: "SA_JSON_FILE_PATH" dbStorageBucket: "CLOUD_STORAGE_BUCKET_PATH" cloudProvider: "GCP" # required verbatim "GCP" (all caps) schedule: "SCHEDULE"
Example
namespace: apigee cassandra: hostNetwork: false ... restore: enabled: true serviceAccountPath: "/Users/myhome/.ssh/my_cassandra_backup.json" dbStorageBucket: "gs://myname-cassandra-backup" cloudProvider: "GCP" snapshotTimestamp: "20201001183903" ... backup: enabled: false serviceAccountPath: "/Users/myhome/.ssh/my_cassandra_backup.json" dbStorageBucket: "gs://myname-cassandra-backup" cloudProvider: "GCP" schedule: "0 2 * * *" ...
Where:
Property Description namespaceYOUR_RESTORE_NAMESPACE
Namespace for restore. Use the same namespace as in your original cluster.
cassandra:hostNetworkhostNetworkis required and should always be set tofalse.restore:enabledRestore is disabled by default. You must set this property to true.restore:serviceAccountPathSA_JSON_FILE_PATH
The path on your filesystem to the service account you created for the backup.
restore:dbStorageBucketCLOUD_STORAGE_BUCKET_PATH
The Cloud Storage bucket path where your backup data is stored in the following format:
gs://BUCKET_NAME. Thegs://is required.restore:cloudProviderGCPThe
cloudProvider: "GCP"property is required.restore:snapshotTimestampTIMESTAMP
The timestamp of the backup snapshot to restore. To check what timestamps can be used, go to the
dbStorageBucketand look at the files that are present in the bucket. Each file name contains a timestamp value. For example,backup_20210203213003_apigee-cassandra-default-0.tgzWhere 20210203213003 is the
snapshotTimestampvalue you would use if you wanted to restore the backups created at that point in time.backup:enabledYou should set this property to falsein case it had been previously set totrue.backup:serviceAccountPathSA_JSON_FILE_PATH
The path on your filesystem to the service account JSON file that was downloaded when you ran
./tools/create-service-accountbackup:dbStorageBucketCLOUD_STORAGE_BUCKET_PATH
The Cloud Storage bucket path in this format:
gs://BUCKET_NAME. Thegs://is required.backup:cloudProviderGCPThe
cloudProvider: "GCP"property is required.backup:scheduleSCHEDULE
The time when the backup starts, specified in standard crontab syntax. Default:
0 2 * * *Non-Cloud Storage
Parameters
namespace: YOUR_RESTORE_NAMESPACE # Use the same namespace as in your original cluster. cassandra: hostNetwork: false ... restore: enabled: true keyFile: "PATH_TO_PRIVATE_KEY_FILE" server: "BACKUP_SERVER_IP" storageDirectory: "/home/apigee/BACKUP_DIRECTORY" cloudProvider: "HYBRID" # required verbatim "HYBRID" (all caps) snapshotTimestamp: "TIMESTAMP" ... backup: enabled: false keyFile: "PATH_TO_PRIVATE_KEY_FILE" server: "BACKUP_SERVER_IP" storageDirectory: "/home/apigee/BACKUP_DIRECTORY" cloudProvider: "HYBRID" # required verbatim "HYBRID" (all caps) schedule: "SCHEDULE"Example
namespace: apigee cassandra: hostNetwork: false ... restore: enabled: true keyFile: "/Users/exampleuser/apigee-hybrid/hybrid-files/service-accounts/private.key" server: "34.56.78.90" storageDirectory: "/home/apigee/cassbackup" cloudProvider: "HYBRID" snapshotTimestamp: "20201001183903" ... backup: enabled: false keyFile: "/Users/exampleuser/apigee-hybrid/hybrid-files/service-accounts/private.key" server: "34.56.78.90" storageDirectory: "/home/apigee/cassbackup" cloudProvider: "HYBRID" schedule: "0 2 * * *" ...Where:
Property Description namespaceYOUR_RESTORE_NAMESPACE
Namespace for restore. Use the same name namespace as in your original cluster.
cassandra:hostNetworkhostNetworkis required and should always be set tofalse.restore:enabledRestore is disabled by default. You must set this property to true.restore:keyFilePATH_TO_PRIVATE_KEY_FILE
The path on your local file system to the SSH private key file (named
ssh_keyin the step where you created the SSH key pair).restore:serverBACKUP_SERVER_IP
The IP address of your backup server.
restore:storageDirectoryBACKUP_DIRECTORY
The name of the backup directory on your backup server. This must be a directory within
home/apigee(the backup directory is namedcassandra_backupin the step where you created the backup directory).restore:cloudProviderHYBRIDThe
cloudProvider: "HYBRID"property is required.restore:snapshotTimestampTIMESTAMP
The timestamp of the backup snapshot to restore. To check what timestamps can be used, go to the
dbStorageBucketand look at the files that are present in the bucket. Each file name contains a timestamp value. For example,backup_20210203213003_apigee-cassandra-default-0.tgzWhere 20210203213003 is the
snapshotTimestampvalue you would use if you wanted to restore the backups created at that point in time.backup:enabledYou should set this property to falsein case it has been previously set totrue.backup:keyFilePATH_TO_PRIVATE_KEY_FILE
The path on your local file system to the SSH private key file (named
ssh_keyin the step where you created the SSH key pair).backup:serverBACKUP_SERVER_IP
The IP address of your backup server.
backup:storageDirectoryBACKUP_DIRECTORY
The name of the backup directory on your backup server. This must be a directory within
home/apigee(the backup directory is namedcassandra_backupin the step where you created the backup directory).backup:cloudProviderHYBRIDThe
cloudProvider: "HYBRID"property is required.backup:scheduleSCHEDULE
The time when the backup starts, specified in standard crontab syntax. Default:
0 2 * * * - Create a new hybrid runtime deployment. This will create a new Cassandra cluster and begin
restoring the backup data into the cluster:
${APIGEECTL_HOME}/apigeectl init -f overrides/overrides.yaml${APIGEECTL_HOME}/apigeectl check-ready -f overrides/overrides.yaml${APIGEECTL_HOME}/apigeectl apply -f overrides/overrides.yaml --restore${APIGEECTL_HOME}/apigeectl check-ready -f overrides/overrides.yaml
Verify the restoration job progress and confirm that apigeeds and all the other pods are up:
- Check
apigeeds:kubectl get apigeeds -n apigee
- Check all other pods:
kubectl get pods -n apigee
Upon successful completion of the restore and confirmation that the runtime components are healthy, we recommend configuring a backup on the cluster:
- Remove the
restoreconfiguration from theoverrides-restore.yamlfile. - Add the
backupconfiguration to theoverrides-restore.yamlfile. - Apply the
backupconfiguration with the following command:Helm
helm upgrade datastore apigee-datastore/ \ --install \ --namespace apigee \ --atomic \ -f overrides.yaml
apigeectl./apigeectl apply -f ../overrides.yaml