Karena AlloyDB Omni kompatibel dengan PostgreSQL, perintah dan teknik pemulihan data yang dijelaskan dalam panduan Barman juga berlaku untuk AlloyDB Omni. Halaman ini menunjukkan pilihan tugas pemulihan umum, dengan contoh perintah yang relevan.
Untuk mengetahui informasi selengkapnya tentang cara mengonfigurasi Barman agar dapat digunakan dengan AlloyDB Omni, lihat
Menyiapkan Barman untuk AlloyDB Omni.
Sebelum memulai
Sebelum memulihkan data AlloyDB Omni, Anda memerlukan
hal berikut:
Server database target, yang menjalankan versi utama AlloyDB Omni yang sama dengan server database sumber. Untuk mengetahui informasi selengkapnya tentang cara menginstal AlloyDB Omni, lihat Menginstal AlloyDB Omni.
Server target dapat berupa mesin yang sama dengan server sumber.
Utilitas rsync, yang diinstal di server target.
Server pencadangan Barman, dengan setidaknya satu pencadangan Barman yang valid dari database AlloyDB Omni sumber di dalamnya.
Konektivitas SSH antara server cadangan Barman dan server target.
Kunci SSH disiapkan untuk mengizinkan pengguna barman di server Barman mengautentikasi dengan server target sebagai pengguna postgres tanpa sandi.
Ruang disk kosong yang cukup di server target untuk menyimpan database yang dipulihkan.
Memulihkan menggunakan cadangan tertentu
Di server target, hentikan AlloyDB Omni.
Docker
dockerstopCONTAINER_NAME
Ganti CONTAINER_NAME dengan nama yang Anda tetapkan ke container AlloyDB Omni saat Anda menginstalnya—misalnya, my-omni.
Podman
podmanstopCONTAINER_NAME
Ganti CONTAINER_NAME dengan nama yang Anda tetapkan ke container AlloyDB Omni saat Anda menginstalnya—misalnya, my-omni.
TARGET_LABEL: label yang Anda tetapkan ke server dalam file konfigurasi Barman.
BACKUP_ID: ID cadangan yang akan dipulihkan, yang diidentifikasi pada langkah sebelumnya—misalnya, 20230810T210200.
DATA_PATH: jalur ke subdirektori data dari direktori data server target—misalnya, /home/your-username/alloydb-data/data.
Di server database target AlloyDB Omni, mulai layanan:
Docker
dockerstartCONTAINER_NAME
Podman
podmanstartCONTAINER_NAME
Setelah layanan dimulai ulang, hubungkan ke server AlloyDB Omni Anda.
Anda akan melihat database dan data yang dipulihkan.
Memulihkan ke titik waktu tertentu
Untuk melakukan pemulihan point-in-time, ikuti langkah-langkah yang sama yang tercantum di bagian sebelumnya, dengan satu
modifikasi. Saat menjalankan perintah barman recover, Anda juga harus menentukan salah satu opsi pemulihan point-in-time Barman.
Perintah berikut menunjukkan contoh penggunaan barman recover dengan AlloyDB Omni dengan
opsi pemulihan point-in-time:
[[["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-04 UTC."],[[["\u003cp\u003eThis page guides users through restoring an AlloyDB Omni cluster using backups created with Barman, an open-source database backup server.\u003c/p\u003e\n"],["\u003cp\u003eThe restoration techniques and commands described in the Barman manual are applicable to AlloyDB Omni due to its compatibility with PostgreSQL.\u003c/p\u003e\n"],["\u003cp\u003eRestoration to a specific backup or a specific point-in-time is achievable using the \u003ccode\u003ebarman recover\u003c/code\u003e command with appropriate options and target information.\u003c/p\u003e\n"],["\u003cp\u003ePrior to starting the data recovery process, the user will need a target server with the same major version of AlloyDB Omni installed, \u003ccode\u003ersync\u003c/code\u003e utility, a Barman backup server, SSH connectivity between the servers, and sufficient disk space.\u003c/p\u003e\n"],["\u003cp\u003eRestoring a backup to a target server overwrites any existing data in the target server's data directory.\u003c/p\u003e\n"]]],[],null,["# Restore an AlloyDB Omni cluster using Barman\n\nSelect a documentation version: 15.5.4keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/clone-omni-barman)\n- [16.8.0](/alloydb/omni/16.8.0/docs/clone-omni-barman)\n- [16.3.0](/alloydb/omni/16.3.0/docs/clone-omni-barman)\n- [15.12.0](/alloydb/omni/15.12.0/docs/clone-omni-barman)\n- [15.7.1](/alloydb/omni/15.7.1/docs/clone-omni-barman)\n- [15.7.0](/alloydb/omni/15.7.0/docs/clone-omni-barman)\n- [15.5.5](/alloydb/omni/15.5.5/docs/clone-omni-barman)\n- [15.5.4](/alloydb/omni/15.5.4/docs/clone-omni-barman)\n- [15.5.2](/alloydb/omni/15.5.2/docs/clone-omni-barman)\n\n\u003cbr /\u003e\n\nThis page shows you how to restore an AlloyDB Omni cluster using a backup created with [Barman](https://pgbarman.org/), an open-source database backup server.\n\n\u003cbr /\u003e\n\nBecause AlloyDB Omni is compatible with PostgreSQL,\nthe data-restoration commands and techniques described by [the Barman manual](https://docs.pgbarman.org/release/latest/)\napply to AlloyDB Omni as well. This page demonstrates a selection\nof common recovery tasks, with examples of relevant commands.\n\nFor more information about configuring Barman to work with AlloyDB Omni, see\n[Set up Barman for AlloyDB Omni](/alloydb/omni/15.5.4/docs/install-configure-barman).\n\n\n| The information on this page applies only to AlloyDB Omni for containers. It does not apply to AlloyDB Omni for Kubernetes.\n\n\u003cbr /\u003e\n\nBefore you begin\n----------------\n\nBefore restoring your AlloyDB Omni data, you need\nthe following:\n\n- A target database server, running the same major version of AlloyDB Omni as the source database server. For more information about installing AlloyDB Omni, see [Install AlloyDB Omni](/alloydb/omni/15.5.4/docs/install).\n\n The target server can be the same machine as the source server.\n- The `rsync` utility, installed on the target server.\n\n- A Barman backup server, with at least one valid Barman backup of the source AlloyDB Omni database on it.\n\n- SSH connectivity between the Barman backup server and the target server.\n\n- SSH keys set up to allow the `barman` user on the Barman server to authenticate\n with the target server as its `postgres` user without a password.\n\n- Enough free disk space on the target server to hold the restored database.\n\nRecover using a specific backup\n-------------------------------\n\n| **Caution:** This operation overwrites any data stored in the target data directory.\n\n1. On the target server, stop AlloyDB Omni.\n\n docker stop \u003cvar translate=\"no\"\u003eOMNI_CONTAINER_NAME\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eOMNI_CONTAINER_NAME\u003c/var\u003e with the name that you assigned to the AlloyDB Omni container when you installed it.\n2. On the Barman server, choose a backup to restore from. To see available backups, run [the `barman list-backups` command](https://docs.pgbarman.org/release/latest/#list-backups).\n To see details about a particular backup, run [the `barman show-backup` command](https://docs.pgbarman.org/release/latest/#show-backup).\n\n3. To recover the chosen backup into the target AlloyDB Omni server,\n run [the `barman recover` command](https://docs.pgbarman.org/release/latest/#recover).\n\n When running the command, include the following:\n - Use [the remote recovery option](https://docs.pgbarman.org/release/latest/#remote-recovery).\n - Specify the target server's data directory as the destination directory.\n\n The following command demonstrates an example use of `barman recover` with AlloyDB Omni: \n\n barman recover --remote-ssh-command \"ssh postgres@\u003cvar translate=\"no\"\u003eTARGET_IP\u003c/var\u003e\" \u003cvar translate=\"no\"\u003eTARGET_LABEL\u003c/var\u003e \u003cvar translate=\"no\"\u003eBACKUP_ID\u003c/var\u003e \u003cvar translate=\"no\"\u003eDATA_PATH\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eTARGET_IP\u003c/var\u003e: the IP address of the target server.\n\n - \u003cvar translate=\"no\"\u003eTARGET_LABEL\u003c/var\u003e: the label that you assigned to the server in Barman's configuration file.\n\n - \u003cvar translate=\"no\"\u003eBACKUP_ID\u003c/var\u003e: the ID of the backup to restore from, identified in a previous step---for example, `20230810T210200`.\n\n - \u003cvar translate=\"no\"\u003eDATA_PATH\u003c/var\u003e: the path to the `data` subdirectory of the target server's data directory---for example, `/home/your-username/alloydb-data/data`.\n\n4. On the AlloyDB Omni target database server, start the\n service:\n\n docker start \u003cvar translate=\"no\"\u003eOMNI_CONTAINER_NAME\u003c/var\u003e\n\nAfter the service restarts, connect to your AlloyDB Omni server.\nYou should see your restored databases and data.\n\nRecover to a specific point in time\n-----------------------------------\n\nTo perform a point-in-time recovery, follow the same steps listed in the previous section, with one\nmodification. When you run the `barman recover` command, you must also specify one of the Barman [point-in-time recovery options](https://docs.pgbarman.org/release/latest/#point-in-time-recovery).\n| **Caution:** This operation overwrites any data stored in the target data directory.\n\nThe following command demonstrates an example use of `barman recover` with AlloyDB Omni with\na point-in-time recovery option: \n\n barman recover --remote-ssh-command \"ssh postgres@\u003cvar translate=\"no\"\u003eTARGET_IP\u003c/var\u003e\" \u003cvar translate=\"no\"\u003eTARGET_LABEL\u003c/var\u003e \u003cvar translate=\"no\"\u003eBACKUP_ID\u003c/var\u003e --target-time=\"\u003cvar translate=\"no\"\u003eRESTORE_TIMESTAMP\u003c/var\u003e\" \u003cvar translate=\"no\"\u003eDATA_PATH\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eTARGET_IP\u003c/var\u003e: the IP address of the target server.\n\n- \u003cvar translate=\"no\"\u003eTARGET_LABEL\u003c/var\u003e: the label that you assigned to the server in Barman's configuration file.\n\n- \u003cvar translate=\"no\"\u003eBACKUP_ID\u003c/var\u003e: the ID of the backup to restore from, identified in a previous step---for example, `20230810T210200`.\n\n- \u003cvar translate=\"no\"\u003eTARGET_TIMESTAMP\u003c/var\u003e: the time to restore to, in any [PostgreSQL `timestamp` format](https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-DATETIME-INPUT-TIME-STAMPS) that specifies both a date and a time---for example, `2024-02-06 00:00:00`.\n\n- \u003cvar translate=\"no\"\u003eDATA_PATH\u003c/var\u003e: the path to the `data` subdirectory of the target server's data directory---for example, `/home/your-username/alloydb-data/data`."]]