Questa pagina descrive come pianificare i backup per Cassandra senza Cloud Storage.
In questo metodo, i backup vengono archiviati su un server remoto specificato da te anzichรฉ in un bucket Cloud Storage. Apigee utilizza SSH per comunicare con il server remoto.
Devi pianificare i backup come job cron. Una volta applicata una pianificazione del backup al cluster ibrido, un job di backup Kubernetes viene eseguito periodicamente in base alla pianificazione nel piano di runtime. Il job attiva uno script di backup su ogni nodo Cassandra del cluster ibrido che raccoglie tutti i dati sul nodo, crea un file di archivio (compresso) dei dati e invia l'archivio al server specificato nel file overrides.yaml.
I passaggi riportati di seguito includono esempi comuni per completare attivitร specifiche, come la creazione di una coppia di chiavi SSH. Utilizza i metodi appropriati per la tua installazione.
Seleziona un server di backup:scegli un server Linux o Unix con spazio di archiviazione adeguato per i backup e assicurati che sia possibile accedervi tramite SSH dal piano di runtime ibrido Apigee.
Configura il server SSH:installa un server SSH o verifica che uno esistente sia sicuro.
Crea una coppia di chiavi SSH:genera una coppia di chiavi SSH senza una passphrase:ad esempio:
Dove: exampleuser@example.com รจ una stringa.
Qualsiasi stringa che segue -C nel comando ssh-keygen
diventa un commento incluso nella chiave ssh
appena creata. La stringa di input puรฒ essere qualsiasi stringa. Quando utilizzi un nome account
sotto forma di exampleuser@example.com, puoi identificare rapidamente
quale account corrisponde alla chiave.
Il comando genererร due file di chiavi SSH, un file della chiave privata (ad esempio "ssh_key.rsa") e un file della chiave pubblica (ad esempio "ssh_key.pub").
Salva la chiave privata in una posizione a cui puรฒ accedere il tuo piano di runtime.
Aggiungi un account utente:sul server di backup, crea un utente denominato apigee con una home directory in /home/apigee. Assicurati
che il nuovo utente apigee abbia una home directory in /home.
Configura la directory .ssh:sul server di backup, crea una directory .ssh in /home/apigee/.ssh. Ad esempio:
cd /home/apigee
mkdir .sshcd .sshvi authorized_keys
Installa la chiave pubblica:inserisci la chiave pubblica nel file authorized_keys all'interno della directory /home/apigee/. La directory di backup puรฒ essere qualsiasi directory, purchรฉ l'utente apigee abbia accesso.Incolla i contenuti del file ssh public key nel file.
Verifica l'accesso SSH:testa la connessione dalla tua macchina locale o da un nodo del cluster:
Il backup รจ disattivato per impostazione predefinita. Devi impostare questa
proprietร su true.
backup:keyFile
PATH_TO_PRIVATE_KEY_FILE
Il percorso nel file system locale del file della chiave privata SSH (chiamato ssh_key
nel passaggio in cui hai creato la coppia di chiavi SSH). Questo percorso deve essere relativo alla directory dei grafici apigee-datastore.
backup:server
BACKUP_SERVER_IP
L'indirizzo IP del server di backup.
backup:storageDirectory
BACKUP_DIRECTORY
Il nome della directory di backup sul server di backup. Deve essere una directory all'interno di home/apigee (la directory di backup รจ denominata cassandra_backup nel passaggio in cui hai creato la directory di backup).
backup:cloudProvider
HYBRID
Per un backup del server remoto, imposta la proprietร su HYBRID.
backup:schedule
SCHEDULE
L'ora di inizio del backup, specificata in
sintassi crontab standard. Gli orari sono nel fuso orario locale del cluster Kubernetes. Valore predefinito: 0 2 * * *
Applica la configurazione di backup all'ambito di archiviazione del tuo
cluster:
I job di backup vengono attivati automaticamente in base alla pianificazione di cron impostata in cassandra.backup.schedule nel file overrides.yaml. Tuttavia, se necessario, puoi anche avviare un job di backup manualmente utilizzando il seguente comando:
Se hai problemi di accesso al server remoto dal pod Cassandra, controlla di nuovo la configurazione SSH sul server remoto e assicurati anche che l'upgrade del datastore sia andato a buon fine.
Puoi verificare se Cassandra utilizza la chiave privata corretta eseguendo il seguente comando dopo aver eseguito l'accesso al pod Cassandra e confrontando l'output con la chiave privata che hai creato:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema รจ stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-03 UTC."],[[["\u003cp\u003eThis guide explains how to configure scheduled backups for Cassandra data in Apigee Hybrid without using Cloud Storage, storing backups on a remote server accessible via SSH.\u003c/p\u003e\n"],["\u003cp\u003eTo set up the backup server, you must choose a Linux or Unix server with sufficient storage, configure an SSH server, create an SSH key pair without a passphrase, add an \u003ccode\u003eapigee\u003c/code\u003e user account, and place the SSH public key in the \u003ccode\u003eauthorized_keys\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eBackup scheduling and destination are configured in the \u003ccode\u003eoverrides.yaml\u003c/code\u003e file by enabling backups, specifying the private key path, backup server IP, storage directory, setting \u003ccode\u003ecloudProvider\u003c/code\u003e to \u003ccode\u003eHYBRID\u003c/code\u003e, and defining a cron schedule.\u003c/p\u003e\n"],["\u003cp\u003eBackups are run as scheduled \u003ccode\u003ecron\u003c/code\u003e jobs, with a Kubernetes job periodically executing a backup script on each Cassandra node, archiving the data, and transferring it to the remote server, and you can also manually launch a backup if needed.\u003c/p\u003e\n"],["\u003cp\u003eYou should verify SSH access from the Cassandra pods to the backup server, ensuring no password or passphrase prompts, and confirm the correct private key is used by the Cassandra pods.\u003c/p\u003e\n"]]],[],null,["# Scheduling backups in a remote server\n\n| You are currently viewing version 1.12 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| **Warning:** Apigee Hybrid versions before 1.12.4 have [a known issue](/apigee/docs/release/known-issues#388608440) affecting backups that use `HYBRID` or `GCP` Cloud Providers. Please check the [Cleanup leftover snapshots](/apigee/docs/release/cassandra-ts) to check whether your setup is affected and for steps needed for resolution.\n\nThis page describes how to schedule backups for Cassandra without the Cloud Storage.\nIn this method, backups are stored on a remote server specified by you instead of a Cloud Storage bucket. Apigee uses\nSSH to communicate with the remote server.\n\nYou must schedule the backups as `cron` jobs. Once a backup schedule\nhas been applied to your hybrid cluster, a Kubernetes backup job is\nperiodically executed according to the schedule in the runtime plane. The job triggers a\nbackup script on each Cassandra node in your hybrid cluster that collects all the\ndata on the node, creates an archive (compressed) file of the data, and sends the archive\nto the server specified in your `overrides.yaml` file.\n| **Note:**\n|\n| - 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 allotted 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| - Applying backup configuration on the existing cluster will rolling restart Cassandra pods.\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\n### Set up the server and SSH\n\n1. **Select a Backup Server:** Choose a Linux or Unix server with adequate storage for your backups and ensure it can be accessed via SSH from your Apigee hybrid runtime plane.\n2. **Configure the SSH Server:** Either install an SSH server or confirm that an existing one is secure.\n| **Caution:** For security purposes, make sure your SSH server is up to date.\n3. **Create an SSH Key Pair:** Generate an SSH key pair without a passphrase:For example: \n\n ssh-keygen -t rsa -b 4096 -C \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eexampleuser\u003c/span\u003e\u003cspan class=\"devsite-syntax-nv\"\u003e@example\u003c/span\u003e\u003cspan class=\"devsite-syntax-p\"\u003e.\u003c/span\u003e\u003cspan class=\"devsite-syntax-n\"\u003ecom\u003c/span\u003e\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\n\n Where: \u003cvar translate=\"no\"\u003eexampleuser@example.com\u003c/var\u003e is a string.\n Any string that follows `-C` in the `ssh-keygen`\n command becomes a comment included in the newly created `ssh`\n key. The input string can be any string. When you use an account name\n in the form of \u003cvar translate=\"no\"\u003eexampleuser@example.com\u003c/var\u003e, you can quickly\n identify which account goes with the key.\n\n The command will generate two SSH key files, A private key file (for example \\`ssh_key.rsa\\`) and a public key file (for example, \\`ssh_key.pub\\`).\n\n Save the private key to a location that your runtime plane can access.\n4. **Add a User Account:** On the backup server, create a user named apigee with a home directory under `/home/apigee`. Make sure the new `apigee` user has a home directory under `/home`.\n5. **Set Up the .ssh Directory:** On the backup server, create a `.ssh` directory in `/home/apigee/.ssh`. For example: \n\n cd /home/apigee\n mkdir .ssh\n cd .ssh\n vi authorized_keys\n\n6. **Install the Public Key:** Place the public key into the `authorized_keys` file within the `/home/apigee/` directory. The backup directory can be any directory as long as the `apigee` user has access to it.Paste the contents of the `ssh public key `file into the file.\n7. **Verify SSH Access:** Test the connection from your local machine or a cluster node: \n\n```\nssh -i PATH_TO_PRIVATE_KEY_FILE apigee@BACKUP_SERVER_IP\n```\n| **Note:** Make sure that you are able to access the remote server without being prompted for a password or a passphrase. If you get asked for a passphrase, please regenerate the ssh key pair without specifying a passphrase. In case you get prompted for a password, please double-check your ssh configuration on your remote server, since it is most likely not set up correctly.\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: \"private.key\" # path relative to apigee-datastore path\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. Apply the backup configuration to the storage scope of your cluster: \n\n ```\n helm upgrade datastore apigee-datastore/ \\\n --install \\\n --namespace APIGEE_NAMESPACE \\\n --atomic \\\n -f OVERRIDES_FILE.yaml\n ```\n\n Where \u003cvar translate=\"no\"\u003eOVERRIDES_FILE\u003c/var\u003e is the path to the overrides file you just edited.\n3. Verify the backup job. For example: \n\n ```\n kubectl get cronjob -n APIGEE_NAMESPACE\n ``` \n\n ```component-pascal\n NAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE\n apigee-cassandra-backup 33 * * * * False 0 \u003cnone\u003e 94s\n ```\n\n### Launch a manual backup\n\n\nBackup jobs are triggered automatically according to the cron schedule set in\n[cassandra.backup.schedule](/apigee/docs/hybrid/v1.12/config-prop-ref#cassandra-backup-schedule) in your\n`overrides.yaml` file. However, you can also initiate a backup job manually if needed\nusing the following command: \n\n```\nkubectl create job -n APIGEE_NAMESPACE --from=cronjob/apigee-cassandra-backup MANUAL_BACKUP_JOB_NAME\n```\n\nWhere \u003cvar translate=\"no\"\u003eMANUAL_BACKUP_JOB_NAME\u003c/var\u003e is the name of a manual backup job to be be created.\n\n### Troubleshooting\n\n1. Test the connection from a Cassandra pod. 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_NAMESPACE APIGEE_CASSANDRA_POD -- /bin/bash\n ```\n\n\n Where \u003cvar translate=\"no\"\u003eAPIGEE_CASSANDRA_POD\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 private SSH key mounted the Cassandra pod and server IP address: \n\n ```\n ssh -i /var/secrets/keys/key 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. You can continue at that prompt and verify the SSH configuration.\n2. If you have problems accessing your remote server from the Cassandra pod, please check your ssh configuration on the remote server again and also make sure that [upgrading the datastore](#overrides-backup) was successful.\n3. You can check if Cassandra uses the correct private key by running the following command while you are logged in to your Cassandra pod, and compare the output [with the private key you created](#create-key): \n\n ```\n cat /var/secrets/keys/key\n ```"]]