Nesta página, descrevemos como programar backups do Cassandra no Cloud Storage.
Nesse método, os backups são armazenados no bucket especificado do Cloud Storage.
Para programar backups do Cassandra, execute as seguintes etapas:
Execute o comando create-service-account
a seguir para criar uma conta de serviço (SA, na sigla em inglês) do Google Cloud com o papel padrão
roles/storage.objectAdmin.
Esse papel da SA permite gravar dados de backup
no Cloud Storage. Execute o comando no diretório
$APIGEE_HELM_CHARTS_HOME/apigee-operator/etc/.
Esse comando
cria uma única conta de serviço chamada apigee-non-prod para uso em ambientes de
não produção e coloca o arquivo de chave salvo no diretório ./.
O comando create-service-account salva um arquivo JSON que contém a
chave privada da conta de serviço. O arquivo é salvo no mesmo diretório
em que o comando é executado. Você precisará do caminho desse arquivo
nas etapas a seguir.
Os jobs de backup são acionados automaticamente de acordo com a programação cron definida em
cassandra.backup.schedule no arquivo
overrides.yaml. No entanto, se necessário, você também pode iniciar um job de backup manualmente
usando o seguinte comando:
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-21 UTC."],[[["\u003cp\u003eThis guide explains how to schedule Cassandra backups to Cloud Storage for Apigee Hybrid.\u003c/p\u003e\n"],["\u003cp\u003eA Google Cloud service account with the \u003ccode\u003eroles/storage.objectAdmin\u003c/code\u003e role is required to write backup data to a designated Cloud Storage bucket.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eoverrides.yaml\u003c/code\u003e file must be updated to enable backups, specifying the service account path, Cloud Storage bucket, backup schedule, and \u003ccode\u003eGCP\u003c/code\u003e as the cloud provider.\u003c/p\u003e\n"],["\u003cp\u003eApplying the backup configuration will trigger a rolling restart of Cassandra pods, and it's important to avoid scheduling the initial backup immediately afterward to prevent failure.\u003c/p\u003e\n"],["\u003cp\u003eBackups can be initiated manually using a \u003ccode\u003ekubectl\u003c/code\u003e command, or they will automatically run according to the defined cron schedule in the \u003ccode\u003eoverrides.yaml\u003c/code\u003e file.\u003c/p\u003e\n"]]],[],null,["# Scheduling backups in Cloud Storage\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 see the [Cassandra troubleshooting guide](/apigee/docs/api-platform/troubleshoot/playbooks/cassandra/ts-cassandra#ki-388608440-hybrid-gcs-backup-112) to check whether your setup is affected and for steps needed for resolution.\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_PATH\n schedule: BACKUP_SCHEDULE_CODE\n cloudProvider: \"GCP\" # required verbatim \"GCP\" (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: \"/Users/myhome/.ssh/my-cassandra-backup-sa.json\"\n dbStorageBucket: \"gs://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\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."]]