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
14/stable 363 21 Feb 2024
Ubuntu 22.04
14/candidate 405 03 May 2024
Ubuntu 22.04
14/beta 409 23 May 2024
Ubuntu 22.04
14/edge 409 21 May 2024
Ubuntu 22.04
juju deploy postgresql --channel 14/stable
Show information

Platform:

Ubuntu
22.04

How to create and list backups

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

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

If you are using an earlier version, be aware that:

  • juju run replaces juju run-action --wait in juju v.2.9
  • juju integrate replaces juju relate and juju add-relation in juju v.2.9

For more information, check the Juju 3.0 Release Notes.

Prerequisites

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 restore a (foreign) backup | Manage cluster passwords.

Create backups

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

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

  • TLS enabled: disables the command from running on primary units.
  • TLS not enabled: disables the command from running on non-primary units.

List backups

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

juju run postgresql/leader list-backups

Help improve this document in the forum (guidelines). Last updated 3 months ago.