Questa pagina descrive il consigliere per l'aumento del periodo di conservazione dei backup di Cloud SQL, che ti aiuta a rilevare le istanze critiche e a rischio di perdita di dati.
Il motore per suggerimenti per l'aumento della conservazione dei backup di Cloud SQL analizza i metadati dell'istanza. Se l'istanza è un'istanza di produzione, ha i backup automatici abilitati e ha meno di 21 backup conservati, è consigliabile aumentare la conservazione dei backup.
I consigli vengono generati ogni giorno.
Prezzi
Il motore per suggerimenti Aumento della conservazione dei backup di Cloud SQL si trova nel livello di prezzo Standard di Recommender.
Prima di iniziare
Prima di poter visualizzare consigli e approfondimenti, procedi nel seguente modo:
Per ottenere le autorizzazioni per visualizzare e utilizzare approfondimenti e consigli,
assicurati di disporre dei ruoli Identity and Access Management (IAM) necessari.
Tasks
Ruoli
Visualizza i suggerimenti
Uno di questi ruoli: recommender.cloudsqlViewer o
cloudsql.viewer.
Applica consigli
Uno di questi ruoli: recommender.cloudsqlAdmin, cloudsql.editor
o cloudsql.admin.
Nella scheda Migliora l'affidabilità dell'istanza Cloud SQL, fai clic su Visualizza tutto.
Seleziona le istanze con il suggerimento Aumenta la conservazione dei backup.
Interfaccia a riga di comando gcloud
Per elencare i suggerimenti per aumentare la conservazione dei backup utilizzando gcloud CLI, esegui il comando
gcloud recommender recommendations list
come segue:
GET https://recommender.googleapis.com/v1/projects/PROJECT-ID/locations/LOCATION/recommenders/google.cloudsql.instance.ReliabilityRecommender/recommendations
Sostituisci quanto segue:
PROJECT_ID: il tuo ID progetto.
LOCATION: una regione in cui si trovano le istanze, ad esempio us-central1.
Se il sistema di suggerimenti rileva istanze per il suggerimento di aumentare la conservazione dei backup, le elenca in una tabella. Ogni riga mostra il nome dell'istanza, un breve suggerimento, il tipo di macchina attuale, il tipo di macchina consigliato, la località e la data dell'ultimo aggiornamento.
Visualizzare approfondimenti e consigli dettagliati
Puoi visualizzare approfondimenti e consigli dettagliati sulle istanze che richiedono un aumento del periodo di conservazione dei backup utilizzando la console Google Cloud ,gcloud CLI o l'API Recommender.
Console
Per visualizzare approfondimenti e consigli dettagliati sulle istanze che richiedono un aumento del periodo di conservazione dei backup, fai clic sul link del consiglio nell'elenco delle istanze.
Interfaccia a riga di comando gcloud
Per visualizzare approfondimenti e consigli dettagliati sulle istanze che richiedono un aumento del periodo di conservazione dei backup, esegui il comando
gcloud recommender insights list
come segue:
LOCATION: una regione in cui si trovano le istanze, ad esempio us-central1.
API
Per visualizzare approfondimenti e suggerimenti dettagliati sulle istanze che richiedono un aumento del periodo di conservazione dei backup, utilizza l'API Recommendations, chiama il metodo insights.list nel seguente modo:
GET https://recommender.googleapis.com/v1/projects/PROJECT-ID/locations/LOCATION/insightTypes/google.cloudsql.instance.ReliabilityInsight/insights
Sostituisci quanto segue:
PROJECT_ID: il tuo ID progetto.
LOCATION: una regione in cui si trovano le istanze, ad esempio us-central1.
Applica consiglio
Per implementare questo consiglio:
Per aumentare la conservazione dei backup:
Fai clic su Aumenta la conservazione dei backup nella colonna Problemi.
Viene visualizzata una finestra Aumenta la conservazione dei backup che fornisce un suggerimento.
Fai clic su Modifica istanza > Protezione dei dati > Numero di backup.
[[["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-04 UTC."],[],[],null,["# Prevent data loss for your instance by increasing backup retention\n\n\u003cbr /\u003e\n\nMySQL \\| [PostgreSQL](/sql/docs/postgres/recommender-increase-backup-retention \"View this page for the PostgreSQL database engine\") \\| [SQL Server](/sql/docs/sqlserver/recommender-increase-backup-retention \"View this page for the SQL Server database engine\")\n\n\u003cbr /\u003e\n\n|\n| **Preview**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis page describes the Cloud SQL increase backup retention [recommender](/recommender/docs/overview) which helps you detect instances which are critical and have a risk of data loss.\n\nThe Cloud SQL increase backup retention recommender analyzes instance metadata. If the instance is a production instance, has automated backups enabled, and has less than 21 retained backups, it is recommended to increase its backup retention.\n\nRecommendations are generated daily.\n\nPricing\n-------\n\nThe Cloud SQL increase backup retention recommender is in the *Standard* [Recommender pricing tier](/recommender/pricing).\n\nBefore you begin\n----------------\n\nBefore you can view recommendations and insights, do the following:\n\n- To get the permissions to view and work with insights and recommendations, ensure that you have the required [Identity and Access Management (IAM) roles](/sql/docs/mysql/project-access-control#roles).\n\n For more information about IAM roles, see [IAM basic and predefined roles reference](/iam/docs/understanding-roles) and [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n-\n\n\n Enable the Recommender API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=recommender.googleapis.com)\n\nList reliability recommendations for increasing backup retention\n----------------------------------------------------------------\n\nYou can list the increase backup retention recommendations by\nusing the Google Cloud console, [gcloud CLI](/sdk/gcloud), or the Recommender API. \n\n### Console\n\nTo list increase backup retention recommendations using the\nGoogle Cloud console, follow these steps:\n\n1. Go to the **Recommendation Hub**.\n\n [Go to the Recommendation Hub](https://console.cloud.google.com/home/recommendations/)\n\n For more information, see\n [Getting started with Recommendation Hub](/recommender/docs/recommendation-hub/identify-configuration-problems).\n2. In the **Increase Cloud SQL instance reliability** card, click **View all**.\n\n3. Select instances with the **Increase backup retention** recommendation.\n\n### gcloud CLI\n\nTo list increase backup retention recommendations using gcloud CLI, run the\n[`gcloud recommender recommendations list`](/sdk/gcloud/reference/recommender/recommendations/list)\ncommand as follows: \n\n```\ngcloud recommender recommendations list \\\n--project=PROJECT_ID \\\n--location=LOCATION \\\n--recommender=google.cloudsql.instance.ReliabilityRecommender \\\n--filter=recommenderSubtype=INCREASE_BACKUP_RETENTION\n\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region where your instances are located, such as `us-central1`.\n\n### API\n\nTo list increase backup retention recommendations using the\n[Recommendations API](/recommender/docs/using-api), call the\n[`recommendations.list`](/recommender/docs/reference/rest/v1/projects.locations.recommenders.recommendations/list)\nmethod as follows: \n\n```\nGET https://recommender.googleapis.com/v1/projects/PROJECT-ID/locations/LOCATION/recommenders/google.cloudsql.instance.ReliabilityRecommender/recommendations\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region where your instances are located, such as `us-central1`.\n\nIf the recommender detects instances for the increase backup retention recommendation, it lists them in a table. Each row shows the instance name, a brief recommendation, the current machine type, the recommended machine type, the location, and the last refresh date.\n\nView insights and detailed recommendations\n------------------------------------------\n\nYou can view insights and detailed recommendations about instances\nthat require increasing their backup retention using the Google Cloud console,\n[gcloud CLI](/sdk/gcloud), or the Recommender API. \n\n### Console\n\nTo view insights and detailed recommendations about instances that require increasing their backup retention, click the recommendation link in the list of instances.\n\n### gcloud CLI\n\nTo view insights and detailed recommendations about instances that require increasing their backup retention, run the\n[`gcloud recommender insights list`](/sdk/gcloud/reference/recommender/insights/list)\ncommand as follows: \n\n```\ngcloud recommender insights list \\\n--project=PROJECT-ID \\\n--location=LOCATION \\\n--insight-type=google.cloudsql.instance.ReliabilityInsight \\\n--filter=insightSubtype=CRITICAL_INSTANCE_INSUFFICIENT_BACKUP_RETENTION\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region where your instances are located, such as `us-central1`.\n\n### API\n\nTo view insights and detailed recommendations about instances that require increasing their backup retention, use the\n[Recommendations API](/recommender/docs/using-api), call the\n[`insights.list`](/recommender/docs/reference/rest/v1/projects.locations.insightTypes.insights/list)\nmethod as follows: \n\n```\nGET https://recommender.googleapis.com/v1/projects/PROJECT-ID/locations/LOCATION/insightTypes/google.cloudsql.instance.ReliabilityInsight/insights\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region where your instances are located, such as `us-central1`.\n\nApply recommendation\n--------------------\n\nTo implement this recommendation, do the following:\n\n- To increase backup retention:\n\n 1. Click **Increase backup retention** in the **Issues** column. An **Increase backup retention** window displays providing a recommendation.\n 2. Click **Edit instance** \\\u003e **Data protection** \\\u003e **Number of backups**.\n\n For more information, see [Automated backup and transaction log retention](/sql/docs/mysql/backup-recovery/backups#retention).\n\nWhat's next\n-----------\n\n- [Google Cloud recommenders](/recommender/docs/recommenders)\n- [About database observability](/sql/docs/mysql/observability)"]]