In diesem Abschnitt wird erläutert, wie Sie die Sicherung und Wiederherstellung Ihrer Cassandra-Datenbank mit ssh und Ihrem Dateisystem konfigurieren, statt mit Google Cloud. Siehe auch:
Was ist Cassandra-Sicherung und -Wiederherstellung ohne Google Cloud-Dienste?
Bei der Sicherung ohne Cloud-Dienste werden Sicherungen Ihrer Cassandra-Datenbank in komprimierte Dateien im Dateisystem eines Servers gespeichert, den Sie angeben. Die Sicherungen werden nach einem Zeitplan ausgeführt, den Sie in der Überschreibungendatei angeben.
Die Verbindung zum Server erfolgt über eine sichere SSH-Verbindung.
Sicherungen ohne Cloud-Dienste einrichten
Die folgenden Schritte enthalten gängige Beispiele für die Ausführung bestimmter Aufgaben, z. B. das Erstellen eines SSH-Schlüsselpaars. Verwenden Sie die für Ihre Installation geeigneten Methoden.
Geben Sie einen Linux- oder Unix-Server für Ihre Sicherungen an. Dieser Server muss über SSH von Ihrer Apigee Hybrid-Laufzeitebene erreichbar sein. Es muss genügend Speicherplatz für die Sicherungen haben.
Richten Sie einen SSH-Server auf dem Server ein bzw. prüfen Sie, ob ein sicherer SSH-Server konfiguriert ist.
Erstellen Sie ein SSH-Schlüsselpaar und speichern Sie die Datei mit dem privaten Schlüssel in einem Pfad, auf den von der Hybrid-Laufzeitebene aus zugegriffen werden kann. Sie müssen ein leeres Passwort für Ihr Schlüsselpaar verwenden. Andernfalls schlägt die Sicherung fehl. Beispiel:
ssh-keygen -t rsa -b 4096 -C exampleuser@example.com
Enter file in which to save the key (/Users/exampleuser/.ssh/id_rsa): $APIGEE_HOME/hybrid-files/certs/ssh_key
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in ssh_key
Your public key has been saved in ssh_key.pub
The key fingerprint is:
SHA256:DWKo334XMZcZYLOLrd/8HNpjTERPJJ0mc11UYmrPvSA exampleuser@example.com
The key's randomart image is:
+---[RSA 4096]----+
| +. ++X|
| . . o.=.*+|
| . o . . o==o |
| . . . =oo+o...|
| . S +E oo .|
| . . .. . o .|
| . . . . o.. |
| . ...o ++. |
| .. .. +o+. |
+----[SHA256]-----+
Erstellen Sie auf dem Sicherungsserver ein Nutzerkonto mit dem Namen apigee. Achten Sie darauf, dass der neue apigee-Nutzer ein Basisverzeichnis unter /home hat.
Erstellen Sie auf dem Sicherungsserver das Verzeichnis ssh im neuen Verzeichnis /home/apigee.
Kopieren Sie den öffentlichen Schlüssel (im vorherigen Beispiel ssh_key.pub) in eine Datei mit dem Namen authorized_keys im neuen Verzeichnis /home/apigee/ssh. Beispiel:
cd /home/apigee
mkdir .sshcd .sshvi authorized_keys
Erstellen Sie auf dem Sicherungsserver ein Sicherungsverzeichnis im Verzeichnis /home/apigee/. Das Sicherungsverzeichnis kann ein beliebiges Verzeichnis sein, solange der Nutzer apigee Zugriff darauf hat. Beispiel:
cd /home/apigee
mkdir cassandra-backup
Testen Sie die Verbindung. Sie müssen sicherstellen, dass Ihre Cassandra-Pods über SSH eine Verbindung zu Ihrem Sicherungsserver herstellen können:
Melden Sie sich in der Shell des Cassandra-Pods an. Beispiel:
Dabei ist APIGEE_CASSANDRA_DEFAULT_0 der Name eines Cassandra-Pods. Ändern Sie dies in den Namen des Pods, von dem Sie eine Verbindung herstellen möchten.
Stellen Sie über die Server-IP-Adresse eine SSH-Verbindung zu Ihrem Sicherungsserver her:
ssh apigee@BACKUP_SERVER_IP
Zeitplan und Ziel für Sicherung festlegen
Zeitplan und Ziel für Sicherungen werden in der Datei overrides.yaml festgelegt.
Fügen Sie der Datei overrides.yaml Folgendes hinzu:
Dabei ist YOUR_OVERRIDES_FILE der Pfad zu der Überschreibungsdatei, die Sie gerade bearbeitet haben.
Wiederherstellung konfigurieren
Die Wiederherstellung verwendet Ihre Daten vom Backup-Speicherort und stellt die Daten in einem neuen Cassandra-Cluster mit der gleichen Anzahl von Knoten wieder her. Es werden keine Daten aus dem alten Cassandra-Cluster übernommen.
Die folgende Wiederherstellungsanleitung gilt für Bereitstellungen in einer einzigen Region, die Google Cloud Storage nicht für Sicherungen verwenden. Für weitere Bereitstellungen:
Erstellen Sie im vorhandenen Kubernetes-Cluster einen neuen Namespace, mit dem die Hybrid-Laufzeitbereitstellung wiederhergestellt wird. Verwenden Sie nicht den ursprünglichen Namespace-Namen für den neuen Namespace.
Verwenden Sie nicht den alten Namespace für die Wiederherstellung.
Erstellen Sie im Stammverzeichnis der Hybridinstallation die neue Datei overrides-restore.yaml.
Kopieren Sie die gesamte Cassandra-Konfiguration aus der ursprünglichen Datei overrides.yaml in die neue Datei overrides-restore.yaml. Beispiel:
cp ./overrides.yaml ./overrides-restore.yaml
Fügen Sie der neuen Datei overrides-restore.yaml ein Namespace-Element hinzu.
Der Name des neuen Namespace, den Sie in Schritt 1 für den neuen Cassandra-Cluster erstellt haben. Verwenden Sie nicht denselben Namespace, den Sie für den ursprünglichen Cluster verwendet haben.
restore:enabled
Die Wiederherstellung ist standardmäßig deaktiviert. Sie müssen dieses Attribut auf true festlegen.
Das Attribut cloudProvider: "HYBRID" ist erforderlich.
restore:snapshotTimestamp
TIMESTAMP
Der Zeitstempel des wiederherzustellenden Backup-Snapshots. Wenn Sie prüfen möchten, welche Zeitstempel verwendet werden können, rufen Sie dbStorageBucket auf und sehen Sie sich die Dateien im Bucket an. Jeder Dateiname enthält einen Zeitstempelwert wie den folgenden:
Erstellen Sie eine neue Hybrid-Laufzeitbereitstellung. Damit wird ein neuer Cassandra-Cluster erstellt und die Backupdaten werden im Cluster wiederhergestellt:
./apigeectl init -f ../overrides-restore.yaml
./apigeectl apply -f ../overrides-restore.yaml
Nach Abschluss der Wiederherstellung muss der Traffic umgeschaltet werden, damit er den Cassandra-Cluster im neuen Namespace verwendet. Führen Sie die folgenden Befehle aus, um den Traffic umzuschalten:
kubectl get rs -n OLD_NAMESPACE # look for the 'apigee-connect' replicaset
Sobald die Traffic-Umschaltung abgeschlossen ist, können Sie die Backups auf dem wiederhergestellten Cluster neu konfigurieren. Entfernen Sie dazu die Konfiguration restore und fügen Sie die Konfiguration backup zur Datei overrides-restore.yaml hinzu. Ersetzen Sie YOUR_RESTORE_NAMESPACE durch den in Schritt 1 erstellten neuen Namespace-Namen.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-28 (UTC)."],[[["\u003cp\u003eThis document provides instructions for configuring Cassandra database backup and recovery using SSH and a file system, instead of using cloud services, for Apigee hybrid version 1.5.\u003c/p\u003e\n"],["\u003cp\u003eBackups are stored as compressed files on a designated server, accessed via secure SSH, with the backup schedule and storage location defined in the \u003ccode\u003eoverrides.yaml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eSetting up the backup process requires designating a server, configuring SSH access, creating an SSH key pair with a blank password, and creating a user with a designated home directory on the backup server.\u003c/p\u003e\n"],["\u003cp\u003eRestoring a Cassandra backup involves creating a new namespace, creating a \u003ccode\u003eoverrides-restore.yaml\u003c/code\u003e file with necessary parameters including the backup server information, and a timestamp to select the backup.\u003c/p\u003e\n"],["\u003cp\u003eAfter a successful backup restoration, traffic must be switched to the new Cassandra cluster, and backups should be reconfigured on the new cluster by removing the restore parameters and applying the relevant backup configuration.\u003c/p\u003e\n"]]],[],null,["# Backup and recovery without Google Cloud\n\n| You are currently viewing version 1.5 of the Apigee hybrid documentation. **This version is end of life.** You should upgrade to a newer version. For more information, see [Supported versions](/apigee/docs/hybrid/supported-platforms#supported-versions).\n\n\nThis section discusses how to configure backup and recovery of your Cassandra database\nusing `ssh` and your file system instead of using Google Cloud. See also:\n\n- [Cassandra backup and recovery](/apigee/docs/hybrid/v1.5/backup-recovery)\n- [Cassandra datastore](/apigee/docs/hybrid/v1.5/what-is-hybrid#cassandra-datastore)\n\nWhat is Cassandra backup and recovery without Cloud Services\n------------------------------------------------------------\n\n\nBackup without Cloud Services stores backups of your Cassandra database to compressed files in the file system of\na server you specify. Backups occur on a schedule you specify in your overrides file.\nThe connection to the server is by secure SSH.\n| **Note:** You must ensure there is enough space on the file system for the backups, and adjust the frequency of the backups to avoid unnecessarily filling the alloted storage space. Apigee does not dictate a retention policy for the backup files. You may want to create a retention policy for files appropriate to your installation.\n\nSetting up backups without Cloud Services\n-----------------------------------------\n\n\nThe following steps include common examples for completing specific tasks, like creating an SSH\nkey pair. Use the methods that are appropriate to your installation.\n\n\nThe procedure has the following parts:\n\n- [Set up the server and SSH](#server-ssh)\n- [Set the schedule and destination for backup](#overrides-backup)\n- [Set up for recovery](#overrides-restore)\n\n### Set up the server and SSH\n\n1. Designate a Linux or Unix server for your backups. This server must be reachable using SSH from your Apigee hybrid runtime plane. It must have enough storage for your backups.\n2. Set up an SSH server on the server, or ensure that it has a secure SSH server configured. **Caution:** For security purposes, make sure your SSH server is up to date.\n3. Create an SSH key pair and store the private key file in a path that is accessible from your hybrid runtime plane. **You must use a blank password for your key pair or the backup will fail** . For example: \n\n ssh-keygen -t rsa -b 4096 -C \u003cvar translate=\"no\"\u003eexampleuser@example.com\u003c/var\u003e\n Enter file in which to save the key (/Users/exampleuser/.ssh/id_rsa): $APIGEE_HOME/hybrid-files/certs/ssh_key\n Enter passphrase (empty for no passphrase):\n Enter same passphrase again:\n Your identification has been saved in ssh_key\n Your public key has been saved in ssh_key.pub\n The key fingerprint is:\n SHA256:DWKo334XMZcZYLOLrd/8HNpjTERPJJ0mc11UYmrPvSA exampleuser@example.com\n The key's randomart image is:\n +---[RSA 4096]----+\n | +. ++X|\n | . . o.=.*+|\n | . o . . o==o |\n | . . . =oo+o...|\n | . S +E oo .|\n | . . .. . o .|\n | . . . . o.. |\n | . ...o ++. |\n | .. .. +o+. |\n +----[SHA256]-----+\n\n4. Create a user account on the backup server with the name `apigee`. Make sure the new `apigee` user has a home directory under `/home`.\n5. On the backup server, create an `ssh` directory in the new `/home/apigee` directory.\n6. Copy the public key (`ssh_key.pub` in the previous example) into a file named `authorized_keys` in the new `/home/apigee/ssh` directory. For example: \n\n cd /home/apigee\n mkdir .ssh\n cd .ssh\n vi authorized_keys\n\n7. On your backup server, create a backup directory within the `/home/apigee/` directory. The backup directory can be any directory as long as the `apigee` user has access to it. For example: \n\n cd /home/apigee\n mkdir cassandra-backup\n\n8. Test the connection. You need to make sure that your Cassandra pods can connect to your backup server using SSH:\n 1. Log into the shell of your Cassandra pod. For example: \n\n ```\n kubectl exec -it -n apigee APIGEE_CASSANDRA_DEFAULT_0 -- /bin/bash\n ```\n\n\n Where \u003cvar translate=\"no\"\u003eAPIGEE_CASSANDRA_DEFAULT_0\u003c/var\u003e is the name of a Cassandra pod. Change this to\n the name of the pod you want to connect from.\n 2. Connect by SSH to your backup server, using the server IP address: \n\n ```\n ssh apigee@BACKUP_SERVER_IP\n ```\n | **Note:** You may see a warning at this point saying your server's fingerprint is unrecognized and asks if you would like to continue. For purposes of this test, this means you can successfully reach your backup server from your Cassandra pod. You do not need to continue.\n\n### Set the schedule and destination for backup\n\n\nYou set the schedule and destination for backups in your `overrides.yaml` file.\n\n1. Add the following parameters to your `overrides.yaml` file:\n\n ### Parameters\n\n ```actionscript-3\n cassandra:\n backup:\n enabled: true\n keyFile: \"\u003cvar translate=\"no\"\u003ePATH_TO_PRIVATE_KEY_FILE\u003c/var\u003e\"\n server: \"\u003cvar translate=\"no\"\u003eBACKUP_SERVER_IP\u003c/var\u003e\"\n storageDirectory: \"/home/apigee/\u003cvar translate=\"no\"\u003eBACKUP_DIRECTORY\u003c/var\u003e\"\n cloudProvider: \"HYBRID\" # required verbatim \"HYBRID\" (all caps)\n schedule: \"\u003cvar translate=\"no\"\u003eSCHEDULE\u003c/var\u003e\"\n ```\n\n ### Example\n\n ```actionscript-3\n cassandra:\n backup:\n enabled: true\n keyFile: \"/Users/exampleuser/apigee-hybrid/hybrid-files/service-accounts/private.key\"\n server: \"34.56.78.90\"\n storageDirectory: \"/home/apigee/cassbackup\"\n cloudProvider: \"HYBRID\"\n schedule: \"0 2 * * *\"\n ```\n\n\n Where:\n\n2. Use `apigeectl` to apply the backup configuration to the storage scope of your cluster: \n\n ```\n $APIGEECTL_HOME/apigeectl --datastore -f YOUR_OVERRIDES_FILE\n ```\n\n\n Where \u003cvar translate=\"no\"\u003eYOUR_OVERRIDES_FILE\u003c/var\u003e is the path to the overrides file you just edited.\n\n### Configure restore\n\n\nRestoration takes your data from the backup location and restores the data into a new\nCassandra cluster with the same number of nodes. No data is taken from the old Cassandra\ncluster.\n\n\nThe restoration instructions below are for single region deployments that do not\nuse Google Cloud Storage for backups. For other deployments, see the following:\n\n- For single region deployments that do use Google Cloud Storage for backups, see [Cassandra backup and recovery](/apigee/docs/hybrid/v1.5/backup-recovery).\n- For multi-region deployments, see [Multi-region deployment on GKE and GKE on-prem](/apigee/docs/hybrid/v1.5/multi-region).\n\n\nTo restore Cassandra backups:\n\n1. Create a new namespace within the existing Kubernetes cluster that will be used to restore the hybrid huntime deployment. Do not use the original namespace name for the new namespace. Do not use the old namespace for restoration.\n2. In the root hybrid installation directory, create a new `overrides-restore.yaml` file.\n3. Copy the complete Cassandra configuration from your original `overrides.yaml` file into the new `overrides-restore.yaml` file. For example: \n\n ```\n cp ./overrides.yaml ./overrides-restore.yaml\n ```\n4. Add a namespace element to the new `overrides-restore.yaml` file.\n\n ### Parameters\n\n ```actionscript-3\n namespace: YOUR_RESTORE_NAMESPACE\n cassandra:\n ...\n restore:\n enabled: true\n keyFile: \"\u003cvar translate=\"no\"\u003ePATH_TO_PRIVATE_KEY_FILE\u003c/var\u003e\"\n server: \"\u003cvar translate=\"no\"\u003eBACKUP_SERVER_IP\u003c/var\u003e\"\n storageDirectory: \"/home/apigee/\u003cvar translate=\"no\"\u003eBACKUP_DIRECTORY\u003c/var\u003e\"\n cloudProvider: \"HYBRID\" # required verbatim \"HYBRID\" (all caps)\n snapshotTimestamp: \"\u003cvar translate=\"no\"\u003eTIMESTAMP\u003c/var\u003e\"\n ...\n ```\n\n ### Example\n\n ```actionscript-3\n namespace: cassandra-restore\n cassandra:\n restore:\n enabled: true\n keyFile: \"/Users/exampleuser/apigee-hybrid/hybrid-files/service-accounts/private.key\"\n server: \"34.56.78.90\"\n storageDirectory: \"/home/apigee/cassbackup\"\n cloudProvider: \"HYBRID\"\n snapshotTimestamp: \"20201001183903\"\n ```\n5. Where:\n\n6. Change the `app` label on any Cassandra nodes in the old namespace by executing the following command: \n\n ```\n kubectl label pods --overwrite --namespace=OLD_NAMESPACE -l app=apigee-cassandra app=apigee-cassandra-old\n ```\n7. Create a new hybrid runtime deployment. This will create a new Cassandra cluster and begin restoring the backup data into the cluster: \n\n ```\n ./apigeectl init -f ../overrides-restore.yaml\n ``` \n\n ```\n ./apigeectl apply -f ../overrides-restore.yaml\n ```\n8.\n Once the restoration is complete, the traffic must be switched to use the Cassandra\n cluster in the new namespace. Run the following commands to switch the traffic:\n\n ```\n kubectl get rs -n OLD_NAMESPACE # look for the 'apigee-connect' replicaset\n ``` \n\n ```\n kubectl patch rs -n OLD_NAMESPACE APIGEE_CONNECT_RS_NAME -p '{\"spec\":{\"replicas\" : 0}}'\n ```\n9. Once the traffic switch is complete, you can reconfigure backups on the restored cluster by removing the `restore` configuration and adding the `backup` configuration to the `overrides-restore.yaml` file. Replace \u003cvar translate=\"no\"\u003eYOUR_RESTORE_NAMESPACE\u003c/var\u003e with the new namespace name created in [step 1](#create-namespace). \n\n ```actionscript-3\n namespace: YOUR_RESTORE_NAMESPACE\n cassandra:\n ...\n backup:\n enabled: true\n serviceAccountPath: SA_JSON_FILE_PATH\n dbStorageBucket: CLOUD_STORAGE_BUCKET_PATH\n schedule: BACKUP_SCHEDULE_CODE\n ...\n ```\n\n\n Then apply the `backup` configuration with the following command: \n\n ```\n ./apigeectl apply -f ../overrides-restore.yaml\n ```"]]