On September 15, 2026, all Cloud Composer 1 versions and versions 2.0.x of Cloud Composer 2 will reach their planned end of life. You will not be able to use environments with these versions. We recommend planning migration to Cloud Composer 3. Cloud Composer 2 versions 2.1.x and later are still supported and are not impacted by this change.
Failover tests for your environment simulate a complete outage of a zone in a
data center. In such a scenario, a zonal outage of a database might happen. By
performing a failover test, you can monitor how your highly resilient
environment performs a failover and check how this affects your DAGs and tasks.
Before you begin
To perform failover tests, your Google Account must have the following roles
and permissions:
composer.environments.update permission. See
Access control with IAM
for a list of roles with this permission.
In Cloud Composer 3, the environment's cluster is located in the tenant
project of your environment and it's not possible to simulate a zonal
outage for it.
Check that your environment is healthy
Make sure to perform failover tests only on healthy environments. To check that
your environment is healthy:
In the Google Cloud console, go to the Environments page.
In the list of environments, click the name of your environment.
The Environment details page opens.
Go to the Monitoring tab.
Make sure that all health metrics are green.
Perform a database failover test
You can perform a database failover test, which simulates a zonal outage, by
triggering it with a Google Cloud CLI command. For example, you might want to
do it to measure the amount of time it takes for your environment's database
to switch to another zone.
To perform a database failover test for your environment:
Your environment's database becomes ready for another failover when
the Database available for failover
(composer.googleapis.com/environment/database/available_for_failover)
environment metric becomes True. For more information about viewing your
environment's metrics in Cloud Monitoring, see
Monitor environments.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 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)"]]