Charmed PostgreSQL VM

Channel Revision Published Runs on
latest/stable 345 09 Nov 2023
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
latest/stable 239 09 Feb 2022
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
latest/stable 226 01 Apr 2021
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
14/stable 468 11 Sep 2024
Ubuntu 22.04
14/stable 467 11 Sep 2024
Ubuntu 22.04
14/candidate 529 29 Nov 2024
Ubuntu 22.04
14/candidate 528 29 Nov 2024
Ubuntu 22.04
14/beta 529 28 Nov 2024
Ubuntu 22.04
14/beta 528 28 Nov 2024
Ubuntu 22.04
14/edge 535 13 Dec 2024
Ubuntu 22.04
14/edge 534 13 Dec 2024
Ubuntu 22.04
16/edge 527 27 Nov 2024
Ubuntu 24.04
16/edge 526 27 Nov 2024
Ubuntu 24.04
juju deploy postgresql --channel 14/stable
Show information

Platform:

Ubuntu
24.04 22.04 20.04 18.04 16.04 14.04

Note: All commands are written for juju >= v.3.0

If you are using an earlier version, check the Juju 3.0 Release Notes.

How to create and list backups

This guide contains recommended steps and useful commands for creating and managing backups to ensure smooth restores.

Prerequisites

Summary


Save your current cluster credentials

For security reasons, charm credentials are not stored inside backups. So, if you plan to restore to a backup at any point in the future, you will need the operator, replication, and rewind user passwords for your existing cluster.

You can retrieve them with:

juju run postgresql/leader get-password username=operator
juju run postgresql/leader get-password username=replication
juju run postgresql/leader get-password username=rewind

For more context about passwords during a restore, check How to migrate a cluster > Manage cluster passwords.

Create a backup

Once you have a three-node cluster with configurations set for S3 storage, check that Charmed PostgreSQL is active and idle with juju status.

Once Charmed PostgreSQL is active and idle, you can create your first backup with the create-backup command:

juju run postgresql/leader create-backup

By default, backups created with the command above will be full backups: a copy of all your data will be stored in S3. There are 2 other supported types of backups (available in revision 416+):

  • Differential: Only modified files since the last full backup will be stored.
  • Incremental: Only modified files since the last successful backup (of any type) will be stored.

To specify the desired backup type, use the type parameter:

juju run postgresql/leader create-backup type={full|differential|incremental}

Tip: To avoid unnecessary service downtime, always use non-primary units for the action create-backup. Keep in mind that:

  • When TLS is enabled, create-backup can only run on replicas (non-primary)
  • When TLS is not enabled, create-backup can only run in the primary unit

List backups

You can list your available, failed, and in progress backups by running the list-backups command:

juju run postgresql/leader list-backups