You can protect your AlloyDB Omni data using any database backup technology that works with PostgreSQL. For example, you can configure AlloyDB Omni to allow connections from a Barman server that you control. This enables the Barman server to perform continuous backups of the data stored in your AlloyDB Omni server.
After you configure your Barman and AlloyDB Omni servers to work together, you can subsequently run Barman commands to accomplish a variety of data-protection and disaster-recovery tasks, including the following:
- Create an on-demand backup of your data.
- Set up synchronous WAL streaming of your data changes to your backup server.
- Restore from a specific backup.
- Perform a point-in-time restoration.
For more information about the operation of Barman, see the Barman manual.
Before you begin
Before configuring AlloyDB Omni to work with Barman, you need the following:
AlloyDB Omni installed and running on a server that you control.
Barman installed on a separate server. The server that you installed Barman on must be able to communicate with the AlloyDB Omni server over TCP.
Configure AlloyDB Omni to work with Barman
To prepare your AlloyDB Omni server to work with Barman, run the following commands on the server where you have installed AlloyDB Omni.
Create the
barmandatabase user, with the appropriate privileges:/usr/lib/postgresql/18/bin/psql -h localhost -U postgres -c " CREATE USER barman; GRANT EXECUTE ON FUNCTION pg_backup_start(text, boolean) to barman; GRANT EXECUTE ON FUNCTION pg_backup_stop(boolean) to barman; GRANT EXECUTE ON FUNCTION pg_switch_wal() to barman; GRANT EXECUTE ON FUNCTION pg_create_restore_point(text) to barman; GRANT pg_read_all_settings TO barman; GRANT pg_read_all_stats TO barman; CREATE USER streaming_barman WITH REPLICATION; GRANT pg_read_all_settings TO streaming_barman; "
Add the following lines in the
DATA_DIR/pg_hba.conffile before the `host all all all * line that exists in the file:host all barman BARMAN_IP/32 AUTHN_METHOD host replication streaming_barman BARMAN_IP/32 AUTHN_METHODReplace the following:
DATA_DIR: the file system path used for the AlloyDB Omni data directory.BARMAN_IP: the IP address of the Barman server.AUTHN_METHOD: the PostgreSQL authentication method that your AlloyDB for PostgreSQL server expects from the Barman server. We recommend one of the following values:To allow the Barman server to authenticate without a password, use
trust.To require a password from the Barman server, use
scram-sha-256.
Add the following lines to the
DATA_DIR/postgresql.conffile:archive_command='/bin/true' archive_mode=on listen_addresses='*' wal_level='replica'Restart the AlloyDB Omni service:
sudo systemctl restart alloydbomni18
Confirm the necessary parameters are all set appropriately by running the following command:
/usr/lib/postgresql/18/bin/psql -h localhost -U postgres -c " SELECT name, setting FROM pg_catalog.pg_settings WHERE name IN ('archive_command', 'archive_mode', 'listen_addresses', 'wal_level') ORDER BY name;"