Cette page explique comment planifier des sauvegardes pour Cassandra dans Cloud Storage.
Dans cette méthode, les sauvegardes sont stockées dans le bucket Cloud Storage spécifié.
Pour planifier des sauvegardes Cassandra, procédez comme suit :
Exécutez la commande create-service-account suivante pour créer un compte de service Google Cloud avec le rôle standard roles/storage.objectAdmin.
Ce rôle de compte de service vous permet d'écrire les données de sauvegarde dans Cloud Storage. Exécutez la commande suivante dans le répertoire $APIGEE_HELM_CHARTS_HOME/apigee-operator/etc/ :
Cette commande crée un seul compte de service nommé apigee-non-prod pour l'utiliser dans des environnements hors production et place le fichier de clé téléchargé dans le répertoire ./.
La commande create-service-account enregistre un fichier JSON contenant la clé privée du compte de service. Le fichier est enregistré dans le répertoire où est exécutée la commande. Vous aurez besoin du chemin d'accès à ce fichier lors des étapes suivantes.
La sauvegarde est désactivée par défaut. Vous devez définir cette propriété sur true.
backup:serviceAccountPath
SA_JSON_FILE_PATH
Chemin d'accès sur votre système de fichiers au fichier JSON du compte de service qui a été téléchargé lors de l'exécution de la commande create-service-account.
Le chemin d'accès doit être relatif au répertoire de graphiques apigee-datastore. Par exemple, serviceAccountPath: myproject-apigee-cassandra.json.
backup:dbStorageBucket
CLOUD_STORAGE_BUCKET_NAME
Nom d'un bucket Google Cloud Storage existant qui sera utilisé pour stocker les archives de sauvegarde. Si vous devez en créer un, consultez la page Créer des buckets.
backup:cloudProvider
GCP/HYBRID
Pour effectuer une sauvegarde Cloud Storage, définissez la propriété sur GCP. Par exemple, cloudProvider: "GCP".
Pour effectuer une sauvegarde sur un serveur distant, définissez la propriété sur HYBRID. Par exemple, cloudProvider: "HYBRID".
backup:schedule
BACKUP_SCHEDULE_CODE
L'heure de début de la sauvegarde, spécifiée dans la syntaxe crontab standard. Par défaut : 0 2 * * *
Appliquez les changements de configuration au nouveau cluster. Par exemple :
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/08/21 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/08/21 (UTC)."],[[["\u003cp\u003eThis guide explains how to schedule backups for Cassandra data in Cloud Storage, where the backup data will be stored.\u003c/p\u003e\n"],["\u003cp\u003eA Google Cloud service account with the \u003ccode\u003eroles/storage.objectAdmin\u003c/code\u003e role must be created to write backup data to Cloud Storage, using the provided \u003ccode\u003ecreate-service-account\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eYou need to create a Cloud Storage bucket with a suitable retention policy (recommended 15 days) to store the backup archives.\u003c/p\u003e\n"],["\u003cp\u003eTo enable backups, the \u003ccode\u003ecassandra.backup\u003c/code\u003e properties, including the service account path, Cloud Storage bucket name, backup schedule, and cloud provider, must be configured in the \u003ccode\u003eoverrides.yaml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eBackups are automatically performed according to the cron schedule specified in the configuration, and a manual backup can be triggered using the provided \u003ccode\u003ekubectl create job\u003c/code\u003e command.\u003c/p\u003e\n"]]],[],null,["# Scheduling backups in Cloud Storage\n\n| You are currently viewing version 1.13 of the Apigee hybrid documentation. For more information, see [Supported versions](/apigee/docs/hybrid/supported-platforms#supported-versions).\n\nThis page describes how to schedule backups for Cassandra in Cloud Storage.\nIn this method, backups are stored in the specified Cloud Storage bucket.\n| **Note:** After applying the backup configuration on the existing cluster, the Cassandra pods will restart one after another (rolling restart) from last to first.\n\nTo schedule Cassandra backups, perform the following steps:\n\n1. Run the following `create-service-account` command to create a Google Cloud service account (SA) with the standard [`roles/storage.objectAdmin`](/storage/docs/access-control/iam-roles) role. This SA role allows you to write backup data to Cloud Storage. Execute the command in the \u003cvar translate=\"no\"\u003e$APIGEE_HELM_CHARTS_HOME\u003c/var\u003e`/apigee-operator/etc/` directory. \n\n ```\n ./tools/create-service-account --env non-prod --dir ./\n ```\n\n This command creates a single service account named\n `apigee-non-prod` for use in non-production environments and\n places the downloaded key file in the `./`\n directory.\n | **Note:** If you prefer to create all the individual service accounts for a production environment, use the following command: \n |\n | ```\n | ./tools/create-service-account --env prod --dir ./\n | ```\n |\n | Then, move each service account into its corresponding chart directory. The following\n | table lists each service account and the corresponding Apigee hybrid Helm charts:\n |\n For more information about Google Cloud service accounts, see\n [Creating and managing service\n accounts](/iam/docs/creating-managing-service-accounts).\n2. The `create-service-account` command saves a JSON file containing the service account private key. The file is saved in the same directory where the command executes. You will need the path to this file in the following steps.\n3. [Create a Cloud Storage bucket](/storage/docs/creating-buckets). Specify a reasonable data [retention policy](/storage/docs/bucket-lock#retention-policy) for the bucket. Apigee recommends a data retention policy of 15 days.\n4. Open your `overrides.yaml` file.\n5. Add the following `cassandra.backup` properties to enable backup. Do not remove any of the properties that are already configured.\n\n ### Parameters\n\n ```scdoc\n cassandra:\n ...\n\n backup:\n enabled: true\n serviceAccountPath: SA_JSON_FILE_PATH\n dbStorageBucket: CLOUD_STORAGE_BUCKET_NAME\n schedule: BACKUP_SCHEDULE_CODE\n cloudProvider: \"GCP\" # For remote server backup set this to HYBRID (all caps)\n\n ...\n \n ```\n\n ### Example\n\n ```carbon\n ...\n\n cassandra:\n storage:\n type: gcepd\n capacity: 50Gi\n gcepd:\n replicationType: regional-pd\n auth:\n default:\n password: \"abc123\"\n admin:\n password: \"abc234\"\n ddl:\n password: \"abc345\"\n dml:\n password: \"abc456\"\n nodeSelector:\n key: cloud.google.com/gke-nodepool\n value: apigee-data\n backup:\n enabled: true\n serviceAccountPath: \"my-cassandra-backup-sa.json\"\n dbStorageBucket: \"myname-cassandra-backup\"\n schedule: \"45 23 * * 6\"\n cloudProvider: \"GCP\"\n \n\n\n ... \n ```\nWhere:\n\n6. Apply the configuration changes to the new cluster. For example: \n\n ```\n helm upgrade datastore apigee-datastore/ \\\n --namespace APIGEE_NAMESPACE \\\n --atomic \\\n -f OVERRIDES_FILE.yaml\n ```\n | **Note:** If you see an error saying `Error: UPGRADE FAILED: \"datastore\" has no deployed releases`, replace `upgrade` with `install` and try the command again.\n\n\n Where \u003cvar translate=\"no\"\u003eOVERRIDES_FILE\u003c/var\u003e is the path to the overrides file you just edited.\n7. 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\nLaunch a manual backup\n----------------------\n\n\nCassandra backups generate automatically according to the cron schedule set in the `overrides.yaml` file.\n\n\nTo initiate a manual backup, use this command:\n\n```\nkubectl create job -n APIGEE_NAMESPACE --from=cronjob/apigee-cassandra-backup BACKUP_POD_NAME\n```"]]