Em 15 de setembro de 2026, todos os ambientes do Cloud Composer 1 e da versão 2.0.x do Cloud Composer 2 vão atingir o fim da vida útil planejado e não poderão mais ser usados. Recomendamos planejar a migração para o Cloud Composer 3.
Os testes de failover para seu ambiente simulam uma interrupção completa de uma zona em um data center. Nesse cenário, pode ocorrer uma interrupção temporária zonal de um banco de dados. Ao
realizar um teste de failover, você pode monitorar como seu ambiente altamente resiliente
executa um failover e verificar como isso afeta seus DAGs e tarefas.
Antes de começar
Para realizar testes de failover, sua Conta do Google precisa ter as seguintes funções
e permissões:
A permissão composer.environments.update. Consulte
Controle de acesso com o IAM
para uma lista de papéis com essa permissão.
No Cloud Composer 3, o cluster do ambiente está localizado no projeto
do locatário do ambiente, e não é possível simular uma interrupção
zonal para ele.
Verificar se o ambiente está íntegro
Faça testes de failover apenas em ambientes íntegros. Para verificar se o ambiente está íntegro:
No console Google Cloud , acesse a página Ambientes.
Na lista de ambientes, clique no nome do seu ambiente.
A página Detalhes do ambiente é aberta.
Acesse a guia Monitoramento.
Verifique se todas as métricas de integridade estão verdes.
Realizar um teste de failover do banco de dados
É possível realizar um teste de failover do banco de dados, que simula uma interrupção zonal, acionando-o com um comando da Google Cloud CLI. Por exemplo, para medir o tempo necessário para que o banco de dados do seu ambiente mude para outra zona.
Para realizar um teste de failover de banco de dados no seu ambiente:
Verifique as métricas de integridade do ambiente para garantir que ele esteja íntegro.
O banco de dados do seu ambiente fica pronto para outro failover quando a métrica de ambiente Banco de dados disponível para failover (composer.googleapis.com/environment/database/available_for_failover) se torna True. Para mais informações sobre como ver as métricas do seu ambiente no Cloud Monitoring, consulte Monitorar ambientes.
[[["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-29 UTC."],[[["\u003cp\u003eThis content pertains to Cloud Composer, specifically versions 1, 2, and 3.\u003c/p\u003e\n"],["\u003cp\u003eThe feature discussed in this document is not currently supported in Cloud Composer 3.\u003c/p\u003e\n"],["\u003cp\u003eThere is a link available to view related information for Cloud Composer 2.\u003c/p\u003e\n"]]],[],null,["# Perform failover tests for highly resilient environments\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n**Cloud Composer 3** \\| [Cloud Composer 2](/composer/docs/composer-2/perform-failover-tests \"View this page for Cloud Composer 2\") \\| Cloud Composer 1\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis page describes how to perform a database failover test for\n[highly resilient (Highly Available) environments](/composer/docs/composer-3/set-up-highly-resilient-environments).\n\nFailover tests for your environment simulate a complete outage of a zone in a\ndata center. In such a scenario, a zonal outage of a database might happen. By\nperforming a failover test, you can monitor how your highly resilient\nenvironment performs a failover and check how this affects your DAGs and tasks.\n\n\nBefore you begin\n----------------\n\n- To perform failover tests, your Google Account must have the following roles\n and permissions:\n\n - `composer.environments.update` permission. See\n [Access control with IAM](/composer/docs/composer-3/access-control#user-account)\n for a list of roles with this permission.\n\n- In Cloud Composer 3, the environment's cluster is located in the tenant\n project of your environment and it's not possible to simulate a zonal\n outage for it.\n\nCheck that your environment is healthy\n--------------------------------------\n\nMake sure to perform failover tests only on healthy environments. To check that\nyour environment is healthy:\n\n1. In the Google Cloud console, go to the **Environments** page.\n\n [Go to Environments](https://console.cloud.google.com/composer/environments)\n2. In the list of environments, click the name of your environment.\n The **Environment details** page opens.\n\n3. Go to the **Monitoring** tab.\n\n4. Make sure that all health metrics are green.\n\nPerform a database failover test\n--------------------------------\n\nYou can perform a database failover test, which simulates a zonal outage, by\ntriggering it with a Google Cloud CLI command. For example, you might want to\ndo it to measure the amount of time it takes for your environment's database\nto switch to another zone.\n| **Note:** The database failover test is not intended for troubleshooting; it is not possible to fix issues with the database component of an environment with the failover test.\n\nTo perform a database failover test for your environment:\n\n1. Make sure that [your environment is healthy](#check-environment-health).\n\n2. Get the primary zone of your environment's database:\n\n gcloud composer environments fetch-database-properties \\\n \u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e \\\n --location \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e\n\n Replace the following:\n - `ENVIRONMENT_NAME`: the name of your Cloud Composer environment.\n - `LOCATION`: the region where the environment is located.\n\n Example: \n\n gcloud composer environments fetch-database-properties \\\n example-environment \\\n --location us-central1\n\n3. Start the database failover test:\n\n gcloud composer environments database-failover \\\n \u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e \\\n --location \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e\n\n Replace the following:\n - `ENVIRONMENT_NAME`: the name of your Cloud Composer environment.\n - `LOCATION`: the region where the environment is located.\n\n Example: \n\n gcloud composer environments database-failover \\\n example-environment \\\n --location us-central1\n\n4. Wait until the database failover test is finished. The process can take up\n to 3 minutes.\n\n5. Check that the primary zone of your environment's database is changed:\n\n gcloud composer environments fetch-database-properties \\\n \u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e \\\n --location \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e\n\n6. Check your environment's health metrics to make sure that\n [your environment is healthy](#check-environment-health).\n\n7. Your environment's database becomes ready for another failover when\n the **Database available for failover**\n (`composer.googleapis.com/environment/database/available_for_failover`)\n environment metric becomes `True`. For more information about viewing your\n environment's metrics in Cloud Monitoring, see\n [Monitor environments](/composer/docs/composer-3/monitor-environments#view-metrics).\n\nWhat's next\n-----------\n\n- [Create environments](/composer/docs/composer-3/create-environments)\n- [Monitor environments](/composer/docs/composer-3/monitor-environments)\n- [Disaster recovery with environment snapshots](/composer/docs/composer-3/disaster-recovery-with-snapshots)"]]