Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
AlloyDB untuk PostgreSQL menawarkan jenis instance regional dan zonal. Untuk membantu memastikan ketersediaan tinggi (HA), setiap instance utama AlloyDB regional memiliki node aktif dan node standby, yang terletak di dua zona yang berbeda. Jika node aktif tidak tersedia karena alasan apa pun, AlloyDB akan otomatis mempromosikan node standby menjadi node aktif baru.
Anda dapat menguji fitur HA otomatis ini dengan menggunakan penyisipan kesalahan untuk tiba-tiba
memaksa node aktif instance utama Anda menjadi offline. Kemudian, AlloyDB
mengaktifkan prosedur HA darurat yang memeriksa kondisi instance primer
lalu menetapkan ulang node standby ke dalam peran node aktif.
Penyisipan kesalahan juga memulai operasi yang berjalan lama yang membuat node aktif sebelumnya kembali online setelah interval singkat. Node tersebut menjadi node
standby baru dari instance utama.
Anda harus memiliki salah satu peran IAM ini di Google Cloud project yang Anda gunakan:
roles/alloydb.admin (peran IAM bawaan Admin AlloyDB)
roles/owner (peran IAM dasar Pemilik)
roles/editor (peran IAM dasar Editor)
Jika Anda tidak memiliki salah satu peran ini, hubungi Administrator Organisasi Anda untuk meminta
akses.
Menyimulasikan pemadaman layanan dengan injeksi kesalahan
Untuk menguji ketahanan HA instance utama dengan mematikan node aktifnya secara tiba-tiba, gunakan perintah gcloud alloydb instances
inject-fault.
Setelah operasi yang berjalan lama selesai, AlloyDB akan mengaktifkan kembali
node.
[[["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-09-03 UTC."],[[["\u003cp\u003eAlloyDB for PostgreSQL ensures high availability by utilizing an active and a standby node for each regional primary instance, located in separate zones.\u003c/p\u003e\n"],["\u003cp\u003eFault injection can be used to test AlloyDB's high availability feature by abruptly forcing the primary instance's active node offline.\u003c/p\u003e\n"],["\u003cp\u003eUpon detecting an active node failure, AlloyDB automatically promotes the standby node to the active role and then later brings the former active node back online as the new standby.\u003c/p\u003e\n"],["\u003cp\u003eTo perform a fault injection for HA testing, use the \u003ccode\u003egcloud alloydb instances inject-fault\u003c/code\u003e command, specifying instance, region, cluster, and project IDs.\u003c/p\u003e\n"],["\u003cp\u003eBasic instances are not applicable for fault injection testing due to the absence of a standby node for failover.\u003c/p\u003e\n"]]],[],null,["# Test a primary instance for high availability\n\nAlloyDB for PostgreSQL offers regional and zonal instance types. To help ensure high availability (HA), every regional AlloyDB primary\ninstance has both an active node and a standby node, located in two different\nzones. If the active node becomes unavailable for any reason, then\nAlloyDB automatically promotes the standby node to become the new\nactive node.\n\nYou can test this automatic HA feature by using *fault injection* to abruptly\nforce your primary instance's active node offline. AlloyDB then\nactivates the emergency HA procedure that checks the primary instance's health\nand then reassigns the standby node into the active-node role.\n\nFault injection also initiates a long-running operation that brings the former\nactive node back online after a brief interval. That node becomes the new\nstandby node of the primary instance.\n\nFor a faster method of swapping the active and standby roles of your primary\ninstance's nodes, see [Fail over a primary instance\nmanually](/alloydb/docs/instance-primary-secondary-failover).\n\n\nBefore you begin\n----------------\n\n- The Google Cloud project you are using must have been [enabled to access AlloyDB](/alloydb/docs/project-enable-access).\n- You must have one of these IAM roles in the Google Cloud project you are using:\n - `roles/alloydb.admin` (the AlloyDB Admin predefined IAM role)\n - `roles/owner` (the Owner basic IAM role)\n - `roles/editor` (the Editor basic IAM role)\n\n If you don't have any of these roles, contact your Organization Administrator to request\n access.\n\n\u003cbr /\u003e\n\nSimulate an outage with a fault injection\n-----------------------------------------\n\n| **Note:** This procedure does not apply to [basic\n| instances](/alloydb/docs/basic-instance), which do not have a standby node to fail over to.\n\nTo test your primary instance's HA resiliency by abruptly shutting down its\nactive node, use the [`gcloud alloydb instances\ninject-fault`](/sdk/gcloud/reference/alloydb/instances/inject-fault) command.\nAfter a long-running operation completes, AlloyDB reinstates the\nnode. \n\n gcloud alloydb instances inject-fault \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eINSTANCE_ID\u003c/span\u003e\u003c/var\u003e \\\n --fault-type=stop-vm \\\n --region=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eREGION_ID\u003c/span\u003e\u003c/var\u003e \\\n --cluster=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eCLUSTER_ID\u003c/span\u003e\u003c/var\u003e \\\n --project=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003ePROJECT_ID\u003c/span\u003e\u003c/var\u003e\n\n- \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e: The ID of the instance.\n- \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e: The region where the instance is placed.\n- \u003cvar translate=\"no\"\u003eCLUSTER_ID\u003c/var\u003e: The ID of the cluster where the instance is placed.\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: The ID of the project where the cluster is placed."]]