[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-21。"],[[["\u003cp\u003eThis guide demonstrates how to restore an AlloyDB Omni cluster using pgBackRest, the open-source backup solution included with the AlloyDB Omni Docker container.\u003c/p\u003e\n"],["\u003cp\u003eRestoration techniques in the pgBackRest manual apply to AlloyDB Omni because it is compatible with PostgreSQL.\u003c/p\u003e\n"],["\u003cp\u003eTo perform a restore, use the \u003ccode\u003epgbackrest restore\u003c/code\u003e command, providing details such as the location of \u003ccode\u003epgbackrest.conf\u003c/code\u003e, the backup repository, the local file system location, and the specific backup or point in time to restore.\u003c/p\u003e\n"],["\u003cp\u003eThis guide only pertains to single-server deployments of AlloyDB Omni and not Kubernetes-based deployments, which have their own separate instructions.\u003c/p\u003e\n"],["\u003cp\u003eA practical example is provided, showing how to execute a point-in-time recovery (PITR) using Docker or Podman, including stopping the container, renaming directories, moving restored data, and restarting the container.\u003c/p\u003e\n"]]],[],null,["Select a documentation version: 15.5.5keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/restore-pgbackrest)\n- [16.8.0](/alloydb/omni/16.8.0/docs/restore-pgbackrest)\n- [16.3.0](/alloydb/omni/16.3.0/docs/restore-pgbackrest)\n- [15.12.0](/alloydb/omni/15.12.0/docs/restore-pgbackrest)\n- [15.7.1](/alloydb/omni/15.7.1/docs/restore-pgbackrest)\n- [15.7.0](/alloydb/omni/15.7.0/docs/restore-pgbackrest)\n- [15.5.5](/alloydb/omni/15.5.5/docs/restore-pgbackrest)\n- [15.5.4](/alloydb/omni/15.5.4/docs/restore-pgbackrest)\n- [15.5.2](/alloydb/omni/15.5.2/docs/restore-pgbackrest)\n\n\u003cbr /\u003e\n\nThis page shows you how to restore an AlloyDB Omni cluster using a backup created with [pgBackRest](https://pgbackrest.org/), the open-source backup solution included with the AlloyDB Omni Docker container.\n\n\u003cbr /\u003e\n\nBecause AlloyDB Omni is compatible with PostgreSQL,\nthe data-restoration commands and techniques described by [the pgBackRest manual](https://pgbackrest.org/user-guide-index.html)\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 pgBackRest to work with AlloyDB Omni, see\n[Set up pgBackRest for AlloyDB Omni](/alloydb/omni/15.5.5/docs/set-up-pgbackrest).\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\nSee [Back up and restore in Kubernetes](/alloydb/omni/15.5.5/docs/backup-kubernetes) for Kubernetes-based information.\n\nBefore you begin\n\nBefore configuring AlloyDB Omni to work with pgBackrest, you need to have [AlloyDB Omni installed and running](/alloydb/omni/15.5.5/docs/install) on a server that you control.\n\n- A target database server, running the same major version of AlloyDB Omni as the backup you want to restore. For more information about installing AlloyDB Omni, see [Install AlloyDB Omni](/alloydb/omni/15.5.5/docs/install).\n\n- A pgBackRest backup repository containing at least one backup of the source AlloyDB Omni database.\n\n- Enough free disk space on the target server to hold the restored database.\n\nOverview\n\nTo perform an AlloyDB Omni restore using pgBackRest, run\n[the `pgbackrest restore` command](https://pgbackrest.org/command.html#command-restore). The parameters that you\nprovide the command vary depending upon your situation.\n\nIn general, you\nrun the `pgbackrest restore` command with flags that provide the following information:\n\n- The location of your `pgbackrest.conf` file.\n- The name of pgBackRest backup repository that you want to restore to. These repositories are named and defined in the `pgbackrest.conf` file.\n- The location on the local file system to write the restored data to.\n- An identifier of the particular backup or point in time that you want to restore from.\n\nWhen running the containerized `pgbackrest restore` commands, remember to use file\nsystem paths from the container's point of view. For example, the path\nto your AlloyDB Omni data directory is always `/var/lib/postgresql/data`,\nno matter its location on your host server. For more information, see\n[A note about file system paths](/alloydb/omni/15.5.5/docs/set-up-pgbackrest#paths).\n\nPerform a point-in-time restore\n\nThis example restores data from a pgBackRest repository, naming a particular\npoint in time to restore to. If you have defined multiple repositories in\nthe target environment's `pgbackrest.conf` file, then pgBackRest chooses\nthe repository to restore from based on availability, expected speed, and other factors.\n\nThe example assumes the following:\n\n- You have a `pgbackrest.conf` file located at the\n top level of your target AlloyDB Omni data directory. This makes\n the file available to the containerized `pgbackrest` as\n `/var/lib/postgresql/data`.\n\n- [You have enabled continuous backups](/alloydb/omni/15.5.5/docs/set-up-pgbackrest#continuous) with your pgBackRest configuration.\n\n1. In the target environment, perform a PITR restore, specifying a timestamp to restore to:\n\n Docker \n\n docker exec \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e pgbackrest \\\n --config-path=/var/lib/postgresql/data \\\n --stanza=\u003cvar translate=\"no\"\u003eSTANZA\u003c/var\u003e \\\n --type=time \\\n --pg1-path=/var/lib/postgresql/data/data-RESTORED \\\n --target=\"\u003cvar translate=\"no\"\u003eTIMESTAMP\u003c/var\u003e\" \\\n restore\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e: the name that you assigned to the AlloyDB Omni container when you installed it---for example, `my-omni`.\n\n - \u003cvar translate=\"no\"\u003eSTANZA\u003c/var\u003e: the configuration stanza, defined by the `pgbackrest.conf` file,\n to apply to this restore---for example, `omni`.\n\n - \u003cvar translate=\"no\"\u003eTIMESTAMP\u003c/var\u003e: the time to restore to---for example, `2024-02-22 19:50:00`.\n\n Podman \n\n podman exec \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e pgbackrest \\\n --config-path=/var/lib/postgresql/data \\\n --stanza=\u003cvar translate=\"no\"\u003eSTANZA\u003c/var\u003e \\\n --type=time \\\n --pg1-path=/var/lib/postgresql/data/data-RESTORED \\\n --target=\"\u003cvar translate=\"no\"\u003eTIMESTAMP\u003c/var\u003e\" \\\n restore\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e: the name that you assigned to the AlloyDB Omni container when you installed it---for example, `my-omni`.\n\n - \u003cvar translate=\"no\"\u003eSTANZA\u003c/var\u003e: the configuration stanza, defined by the `pgbackrest.conf` file,\n to apply to this restore---for example, `omni`.\n\n - \u003cvar translate=\"no\"\u003eTIMESTAMP\u003c/var\u003e: the time to restore to---for example, `2024-02-22 19:50:00`.\n\n2. On the target environment, stop the container using the following command:\n\n Docker \n\n docker container stop \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e\n\n Podman \n\n podman container stop \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e\n\n3. Rename the `data` subdirectory of your data directory,\n as a safety precaution:\n\n cd \u003cvar translate=\"no\"\u003eDATA_DIR\u003c/var\u003e\n sudo mv data data-OLD\n\n Replace \u003cvar translate=\"no\"\u003eDATA_DIR\u003c/var\u003e with the file system path to your AlloyDB Omni\n data directory.\n4. Move the restored data into place, and clean up `postgresql.auto.conf`:\n\n sudo mv data-RESTORED data\n sudo sed -i 's|data-RESTORED|data|' data/postgresql.auto.conf\n\n5. Start the AlloyDB Omni container with the database server:\n\n Docker \n\n docker container start \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e\n\n Podman \n\n podman container start \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e\n\nYou can now connect to your database using `psql` and confirm that the data\nhas been restored as you expect. If so, you can delete the `data-OLD` copy\nof the `data` subdirectory that you created earlier.\n\nFor more information about PITR in pgBackRest, see [Point-in-Time Recovery](https://pgbackrest.org/user-guide.html#pitr).\nFor more information about preparing\na `pgbackrest.conf` file for use with AlloyDB Omni, see [Set up pgBackRest for AlloyDB Omni](/alloydb/omni/15.5.5/docs/set-up-pgbackrest).\n\nOther options\n\nThe `pgbackrest restore` command is very flexible, with an array of options and\nfeatures that you can control through passing in different command-line options. These include the following:\n\n- Limiting a restore only to changed files.\n- Restoring only selected databases.\n\nFor a complete guide to performing restores in pgBackRest, see [Restore](https://pgbackrest.org/user-guide.html#restore)."]]