Pada 15 September 2026, semua lingkungan Cloud Composer 1 dan Cloud Composer 2 versi 2.0.x akan mencapai akhir masa pakainya yang direncanakan, dan Anda tidak akan dapat menggunakannya. Sebaiknya rencanakan migrasi ke Cloud Composer 3.
Pengujian failover untuk lingkungan Anda menyimulasikan gangguan total pada zona di pusat data. Dalam skenario seperti itu, pemadaman layanan database per zona mungkin terjadi. Dengan
melakukan pengujian failover, Anda dapat memantau cara lingkungan
yang sangat tangguh melakukan failover dan memeriksa pengaruhnya terhadap DAG dan tugas Anda.
Sebelum memulai
Untuk melakukan pengujian failover, Akun Google Anda harus memiliki peran dan izin berikut:
Izin composer.environments.update. Lihat
Kontrol akses dengan IAM
untuk mengetahui daftar peran dengan izin ini.
Di Cloud Composer 3, cluster lingkungan berada di project tenant lingkungan Anda dan tidak mungkin mensimulasikan pemadaman layanan zona untuk cluster tersebut.
Memeriksa apakah lingkungan Anda berfungsi dengan baik
Pastikan untuk melakukan pengujian failover hanya pada lingkungan yang responsif. Untuk memeriksa apakah lingkungan Anda berfungsi dengan baik:
Di konsol Google Cloud , buka halaman Environments.
Dalam daftar lingkungan, klik nama lingkungan Anda.
Halaman Environment details akan terbuka.
Buka tab Monitoring.
Pastikan semua metrik kesehatan berwarna hijau.
Melakukan pengujian failover database
Anda dapat melakukan uji failover database, yang menyimulasikan gangguan zona, dengan memicunya menggunakan perintah Google Cloud CLI. Misalnya, Anda mungkin ingin
melakukannya untuk mengukur waktu yang dibutuhkan database lingkungan Anda
untuk beralih ke zona lain.
Untuk melakukan pengujian failover database untuk lingkungan Anda:
Database lingkungan Anda siap untuk melakukan failover lain saat metrik lingkungan Database tersedia untuk failover
(composer.googleapis.com/environment/database/available_for_failover)
menjadi True. Untuk mengetahui informasi selengkapnya tentang cara melihat metrik lingkungan di Cloud Monitoring, lihat Memantau lingkungan.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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)"]]