Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menjelaskan cara memulihkan cluster ke status terakhir
sebelumnya. Memulihkan data ke titik waktu tertentu ke cluster AlloyDB untuk PostgreSQL direkomendasikan untuk pemulihan cepat dari kehilangan data skala besar.
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.
Anda harus memiliki semua peran IAM ini di project Google Cloud yang Anda gunakan:
compute.networks.list
compute.addresses.create
compute.addresses.list
compute.globalAddresses.create
compute.globalAddresses.list
servicenetworking.services.addPeering
Untuk mendapatkan izin ini sambil mengikuti prinsip hak istimewa terendah, minta administrator Anda untuk memberi Anda peran roles/alloydb.admin (IAM bawaan Admin AlloyDB).
Memulihkan dari titik waktu terbaru
AlloyDB memungkinkan Anda memulihkan sepenuhnya data cluster aktif dari titik waktu mana pun dalam rentang terbaru tertentu.
Periode PITR yang tersedia
Anda dapat memulihkan dari titik waktu mana pun setelah momen yang lebih baru dari dua momen berikut:
Momen yang diwakili oleh batas periode pemulihan Anda. Misalnya, jika Anda memiliki periode pemulihan 14 hari, maka momen ini adalah 14 hari
di masa lalu.
Waktu pembuatan cadangan terlama yang diambil sejak Anda terakhir kali mengaktifkan
pencadangan berkelanjutan. Jika Anda membuat cluster dengan mengaktifkan pencadangan berkelanjutan, dan Anda belum menonaktifkan pencadangan berkelanjutan sejak saat itu, maka momen ini secara efektif menjadi waktu pembuatan cadangan terlama cluster Anda.
Jika Anda menonaktifkan dan kemudian mengaktifkan kembali pencadangan berkelanjutan, Anda tidak dapat melakukan pemulihan point-in-time hingga Anda atau AlloyDB membuat cadangan baru pertama cluster. Cadangan ini dapat berupa cadangan sesuai permintaan, atau
cadangan harian pertama yang diambil AlloyDB setelah Anda mengaktifkan
pencadangan berkelanjutan. Untuk mengetahui informasi selengkapnya tentang jenis pencadangan, lihat Ringkasan pencadangan dan pemulihan data.
Melakukan pemulihan point-in-time
Gunakan Google Cloud konsol atau Google Cloud CLI untuk melakukan pemulihan.
Di bagian Pulihkan dari titik waktu, klik Pulihkan.
Di kolom Target time, masukkan tanggal dan waktu untuk memulihkan.
Di kolom Cluster ID, masukkan nama untuk cluster baru.
Di kolom Network, pilih jaringan Virtual Private Cloud yang akan digunakan oleh cluster baru.
Jika Anda ingin mengenkripsi pencadangan berkelanjutan dan log perubahan data cluster ini menggunakan kunci enkripsi yang dikelola pelanggan (CMEK), bukan enkripsi default yang dikelola Google, ikuti langkah-langkah tambahan berikut:
Klik Opsi enkripsi lanjutan.
Klik tombol pilihan Customer-managed encryption key (CMEK).
Klik daftar Pilih kunci yang dikelola pelanggan, lalu pilih
kunci.
Klik Pulihkan.
gcloud
Gunakan perintah gcloud alloydb clusters
restore,
dengan menentukan cluster dan stempel waktu. Perhatikan bahwa, tidak seperti memulihkan dari
cadangan, pemulihan point-in-time mengharuskan cluster asli
masih ada. Anda tidak dapat melakukan pemulihan semacam ini pada cluster yang dihapus.
NEW_CLUSTER:
ID yang akan digunakan dengan cluster baru.
SOURCE_CLUSTER: ID cluster
untuk memulihkan data.
Untuk memulihkan dari cluster dalam project yang berbeda, ganti dengan jalur cluster
lengkap dalam format berikut: projects/SOURCE_PROJECT/locations/SOURCE_REGION/clusters/SOURCE_CLUSTER
TIMESTAMP: Deskripsi
titik waktu untuk memulihkan data, yang dinyatakan dalam format RFC 3339—misalnya, 2012-11-15T16:19:00.094Z. Anda dapat menentukan pecahan detik sekecil mikrodetik.
Perhatikan bahwa stempel waktu ini harus ada dalam periode retensi yang Anda
tentukan saat membuat cluster.
REGION: Region yang berisi cluster sumber, dan tempat AlloyDB membuat cluster baru.
Contoh: us-central1.
PROJECT_ID: ID project tempat cluster baru berada.
Jika Anda ingin mengenkripsi data cluster baru dengan kunci enkripsi yang dikelola pelanggan (CMEK), bukan enkripsi yang dikelola Google, Anda harus memberikan argumen tambahan berikut:
--kms-key=KEY_ID: ID kunci CMEK yang akan
digunakan. * --kms-keyring=KEYRING_ID: ID
dari key ring kunci. *
--kms-location=LOCATION_ID: ID region keyring tersebut. Perhatikan bahwa region ini harus cocok dengan region cluster.
--kms-project=PROJECT_ID: ID project
keyring.
Untuk memulihkan ke cluster dengan Private Service Connect yang diaktifkan, pastikan Anda menambahkan flag --enable-private-service-connect.
Setelah AlloyDB selesai membuat cluster, buat instance utama untuk cluster tersebut. Instance
tersebut memungkinkan Anda mengakses data yang dipulihkan. Perhatikan bahwa konfigurasi instance baru tidak harus sama persis dengan instance utama asli.
[[["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-25 UTC."],[[["\u003cp\u003eThis guide outlines the process of restoring an AlloyDB for PostgreSQL cluster to a specific point in time for rapid data recovery.\u003c/p\u003e\n"],["\u003cp\u003ePoint-in-time recovery (PITR) allows restoring data from any moment within a defined recovery window, determined by the recovery window's limit or the creation time of the oldest backup.\u003c/p\u003e\n"],["\u003cp\u003eRestoring from a point in time requires the original cluster to be active and is accessible through the Google Cloud console or the \u003ccode\u003egcloud\u003c/code\u003e CLI.\u003c/p\u003e\n"],["\u003cp\u003eWhen performing a point-in-time restore, users must specify a target timestamp within the retention period and configure settings for the new cluster, such as network and encryption options.\u003c/p\u003e\n"],["\u003cp\u003eAfter the restore, a new primary instance needs to be created to access the restored data, and optionally, read-pool instances can be added.\u003c/p\u003e\n"]]],[],null,["# Use point-in-time recovery (PITR)\n\nThis page describes how to restore a cluster to a recent\npast state. Restoring data to a point in time into\nan AlloyDB for PostgreSQL cluster is recommended for rapid recovery\nfrom large-scale data loss.\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- You must have all of these IAM roles in the Google Cloud project you are using:\n - `compute.networks.list`\n - `compute.addresses.create`\n - `compute.addresses.list`\n - `compute.globalAddresses.create`\n - `compute.globalAddresses.list`\n - `servicenetworking.services.addPeering`\n\n \u003cbr /\u003e\n\n To gain these permissions while following the principle of least privilege, ask\n your administrator to grant you the `roles/alloydb.admin` (\n AlloyDB Admin predefined IAM) role.\n\n\u003cbr /\u003e\n\nRestore from a recent point in time\n-----------------------------------\n\nAlloyDB lets you fully restore an active cluster's data from any\npoint in time within a specific, recent range.\n\n### Available PITR windows\n\nYou can restore from any point in time after the more recent of the following\ntwo moments:\n\n- **The moment represented by the limit of your recovery window.** For\n example, if you have a 14-day recovery window, then this moment is 14 days\n in the past.\n\n- **The creation time of the oldest backup taken since you last enabled\n continuous backup.** If you created the cluster with continuous backup\n enabled, and you have not disabled continuous backup since then, then this\n moment effectively becomes the creation time of your cluster's oldest backup.\n\nIf you disable and subsequently re-enable continuous backup, then you cannot\nperform a point-in-time recovery until either you or AlloyDB\ncreates the cluster's first new backup. This can be an on-demand backup, or the\nfirst of the daily backups that AlloyDB takes after you enable\ncontinuous backup. For more information about backup types, see [Data backup and\nrecovery overview](/alloydb/docs/backup/overview).\n\n### Perform a point-in-time restore\n\n1. Use either the Google Cloud console or the Google Cloud CLI to perform the\n restore.\n\n ### Console\n\n 1. Go to the **Clusters** page.\n\n [Go to Clusters](https://console.cloud.google.com/alloydb/clusters)\n 2. Click a cluster in the **Resource Name**\n column.\n\n 3. Click **Data protection**.\n\n 4. Under **Restore from a point in time** , click **Restore**.\n\n 5. In the **Target time** field, enter the date and time to restore from.\n\n 6. In the **Cluster ID** field, enter a name for the new cluster.\n\n 7. In the **Network** field, select a Virtual Private Cloud network for the new\n cluster to use.\n\n 8. If you want to encrypt this cluster's continuous backups and\n data-change logs using a [customer-managed encryption key\n (CMEK)](/alloydb/docs/cmek) instead of the default Google-managed\n encryption, follow these additional steps:\n\n 1. Click **Advanced encryption options**.\n\n 2. Click the **Customer-managed encryption key (CMEK)** radio\n button.\n\n 3. Click the **Select a customer-managed key** list, and select a\n key.\n\n 9. Click **Restore**.\n\n ### gcloud\n\n Use the [`gcloud alloydb clusters\n restore`](/sdk/gcloud/reference/alloydb/clusters/restore) command,\n specifying a cluster and a timestamp. Note that, unlike [restoring from a\n backup](/alloydb/docs/backup/restore), a point-in-time recovery requires the original cluster to\n still exist. You cannot perform this kind of restore on a deleted cluster. \n\n gcloud alloydb clusters restore \u003cvar translate=\"no\"\u003eNEW_CLUSTER\u003c/var\u003e \\\n --source-cluster=\u003cvar translate=\"no\"\u003eSOURCE_CLUSTER\u003c/var\u003e \\\n --point-in-time=\u003cvar translate=\"no\"\u003eTIMESTAMP\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e\n\n This command returns an operation, whose status you can query using the\n [`gcloud alloydb operations describe`](/sdk/gcloud/reference/alloydb/operations/describe) command. \n\n gcloud alloydb operations describe \u003cvar translate=\"no\"\u003eOPERATION_ID\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eNEW_CLUSTER\u003c/var\u003e:\n The ID to use with the new cluster.\n\n - \u003cvar translate=\"no\"\u003eSOURCE_CLUSTER\u003c/var\u003e: The ID of the cluster\n to recover data from. \n\n To restore from a cluster in a different project, replace with the full\n cluster path in the following format: \n\n `projects/`\u003cvar translate=\"no\"\u003eSOURCE_PROJECT\u003c/var\u003e`/locations/`\u003cvar translate=\"no\"\u003eSOURCE_REGION\u003c/var\u003e`/clusters/`\u003cvar translate=\"no\"\u003eSOURCE_CLUSTER\u003c/var\u003e\n\n - \u003cvar translate=\"no\"\u003eTIMESTAMP\u003c/var\u003e: A description\n of the point in time to recover data from, expressed in [RFC 3339\n format](https://datatracker.ietf.org/doc/html/rfc3339)---for\n example, `2012-11-15T16:19:00.094Z`. You can specify a fractional\n second as small as a microsecond.\n\n Note that this timestamp must exist within the retention period you\n specified when you created the cluster.\n - \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: The region that contains the source\n cluster, and where AlloyDB creates the new cluster.\n For example: `us-central1`.\n\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: The ID of the project where the new cluster is.\n\n If you want to encrypt the\n new cluster's data with a [customer-managed encryption key\n (CMEK)](/alloydb/docs/cmek) instead of Google-managed encryption,\n then you must provide these additional arguments:\n - `--kms-key=`\u003cvar translate=\"no\"\u003eKEY_ID\u003c/var\u003e: The ID of the CMEK key to use. \\* `--kms-keyring=`\u003cvar translate=\"no\"\u003eKEYRING_ID\u003c/var\u003e: The ID of the key's key ring. \\* `--kms-location=`\u003cvar translate=\"no\"\u003eLOCATION_ID\u003c/var\u003e: The ID of that keyring's region. Note that it must match the cluster's region.\n - `--kms-project=`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: The ID of the keyring's project.\n\n To restore to a cluster with Private Service Connect enabled, make sure that you add the `--enable-private-service-connect` flag.\n2. After AlloyDB finishes creating the cluster, [create a\n primary instance for it](/alloydb/docs/instance-primary-create). That\n instance lets you access the restored data. Note that the new instance's\n configuration need not exactly match that of the original primary instance.\n\n3. Optional: [Create read-pool instances.](/alloydb/docs/instance-read-pool-create)\n\nYou can start using the cluster after the restore operation completes.\n\nWhat's next\n-----------\n\n- [Restore a cluster from a stored backup.](/alloydb/docs/backup/restore)\n- [Create a read pool instance.](/alloydb/docs/instance-read-pool-create)\n- [Create a secondary cluster and instance.](/alloydb/docs/cross-region-replication/work-with-cross-region-replication)"]]