Announcing Google Cloud Storage (GCS) Support for pgBackRest

Craig Kerstiens

2 min read

Crunchy Data is pleased to announce its most recent release of pgBackRest: 2.33 with a number of new features including multiple repository support and GCS support. With pgBackRest 2.33 we are especially excited to add support for Google Cloud Storage (GCS), a new addition to Amazon AWS S3 and Azure Repository support.

pgBackRest is a reliable, high performance, easy-to-use backup and restore solution for Postgres that can seamlessly scale up to the largest databases and workloads by utilizing algorithms that are optimized for database-specific requirements.

How Can You Use pgBackRest To Backup Your Postgres Database to GCS?

pgBackRest stores backups in GCS within a specific bucket. pgBackRest repositories can be stored in the bucket root by setting repoX-path=/ (where "X" is the repo number), but it is usually best to specify a prefix, such as /repo, so logs and other GCS generated content can also be stored in the bucket. Currently only GCS service authentication is supported.

Here's a basic configuration:

[global]
repo1-type=gcs
repo1-path=/repo
repo1-gcs-bucket=your-bucket
repo1-gcs-key=/path/to/service-key.json

/path/to/service-key.json is the key file downloaded from a service account that has the Storage Object Admin permission on the bucket. It is also possible to use per-file ACLs but this is unlikely to be useful unless the bucket is being shared with other processes.

And that's it! Create a new stanza to initialize your backup repository (pgbackrest stanza-create) and try taking your first full backup to GCS (pgbackrest backup). When completed, run pgbackrest info and you should see output similar to:

stanza: demo
    status: ok
    cipher: none

    db (current)
        wal archive min/max (13): 000000010000000000000001/000000010000000000000003

        full backup: 20210406-115852F
            timestamp start/stop: 2021-04-06 11:58:52 / 2021-04-06 11:59:05
            wal start/stop: 000000010000000000000002 / 000000010000000000000002
            database size: 23.4MB, database backup size: 23.4MB
            repo1: backup set size: 2.8MB, backup size: 2.8MB

Now that pgBackRest has native GCS support, when is Crunchy Bridge available on GCP? When is GCS support coming to the Crunchy Data Postgres Operator (PGO)? Sign up for our newsletter and you will be the first to know.

Avatar for Craig Kerstiens

Written by

Craig Kerstiens

April 6, 2021 More by this author