Da AlloyDB Omni mit PostgreSQL kompatibel ist, gelten die im Barman-Handbuch beschriebenen Befehle und Techniken zur Datenwiederherstellung auch für AlloyDB Omni. Auf dieser Seite werden einige häufige Wiederherstellungsaufgaben mit Beispielen für relevante Befehle beschrieben.
Weitere Informationen zum Konfigurieren von Barman für die Verwendung mit AlloyDB Omni finden Sie unter Barman für AlloyDB Omni einrichten.
Hinweise
Bevor Sie Ihre AlloyDB Omni-Daten wiederherstellen können, benötigen Sie Folgendes:
Ein Zieldatenbankserver, auf dem dieselbe Hauptversion von AlloyDB Omni wie auf dem Quelldatenbankserver ausgeführt wird. Weitere Informationen zur Installation von AlloyDB Omni finden Sie unter AlloyDB Omni installieren.
Der Zielserver kann derselbe Computer wie der Quellserver sein.
Das Dienstprogramm rsync, das auf dem Zielserver installiert ist.
Ein Barman-Sicherungsserver mit mindestens einer gültigen Barman-Sicherung der AlloyDB Omni-Quelldatenbank.
SSH-Verbindung zwischen dem Barman-Sicherungsserver und dem Zielserver
SSH-Schlüssel, die so eingerichtet sind, dass sich der barman-Nutzer auf dem Barman-Server ohne Passwort als postgres-Nutzer auf dem Zielserver authentifizieren kann.
Auf dem Zielserver ist genügend freier Speicherplatz für die wiederhergestellte Datenbank vorhanden.
Mit einer bestimmten Sicherung wiederherstellen
Beenden Sie AlloyDB Omni auf dem Zielserver.
dockerstopOMNI_CONTAINER_NAME
Ersetzen Sie OMNI_CONTAINER_NAME durch den Namen, den Sie dem AlloyDB Omni-Container bei der Installation zugewiesen haben.
Wählen Sie auf dem Barman-Server eine Sicherung aus, aus der Sie Daten wiederherstellen möchten. Führen Sie den Befehl barman list-backups aus, um verfügbare Sicherungen aufzurufen.
Wenn Sie Details zu einer bestimmten Sicherung aufrufen möchten, führen Sie den Befehl barman show-backup aus.
Führen Sie den Befehl barman recover aus, um die ausgewählte Sicherung auf dem Zielserver von AlloyDB Omni wiederherzustellen.
Fügen Sie beim Ausführen des Befehls Folgendes ein:
TARGET_LABEL: Das Label, das Sie dem Server in der Konfigurationsdatei von Barman zugewiesen haben.
BACKUP_ID: die ID der Sicherung, aus der die Wiederherstellung erfolgen soll, die in einem vorherigen Schritt ermittelt wurde, z. B. 20230810T210200.
DATA_PATH: der Pfad zum Unterverzeichnis data des Datenverzeichnisses des Zielservers, z. B. /home/your-username/alloydb-data/data.
Starten Sie auf dem AlloyDB Omni-Zieldatenbankserver den Dienst:
dockerstartOMNI_CONTAINER_NAME
Stellen Sie nach dem Neustart des Dienstes eine Verbindung zu Ihrem AlloyDB Omni-Server her.
Sie sollten Ihre wiederhergestellten Datenbanken und Daten sehen.
Wiederherstellung zu einem bestimmten Zeitpunkt
Führen Sie für die Wiederherstellung zu einem bestimmten Zeitpunkt dieselben Schritte aus, die im vorherigen Abschnitt aufgeführt sind, mit einer Änderung. Wenn Sie den Befehl barman recover ausführen, müssen Sie auch eine der Barman-Optionen für die Point-in-Time-Wiederherstellung angeben.
Der folgende Befehl zeigt ein Beispiel für die Verwendung von barman recover mit AlloyDB Omni mit einer Point-in-Time-Wiederherstellungsoption:
TARGET_LABEL: Das Label, das Sie dem Server in der Konfigurationsdatei von Barman zugewiesen haben.
BACKUP_ID: die ID der Sicherung, aus der die Wiederherstellung erfolgen soll, die in einem vorherigen Schritt ermittelt wurde, z. B. 20230810T210200.
TARGET_TIMESTAMP: die Zeit, zu der die Wiederherstellung erfolgen soll, in einem beliebigen PostgreSQL-timestamp-Format, das sowohl ein Datum als auch eine Uhrzeit angibt, z. B. 2024-02-06 00:00:00.
DATA_PATH: der Pfad zum Unterverzeichnis data des Datenverzeichnisses des Zielservers, z. B. /home/your-username/alloydb-data/data.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-17 (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`."]]