Downloading backup files from an sftp server

You can download a specific backup file from the sftp server to the Backup and Restore Pod.

About this task

In the following commands, note that you use the -n <backup file name> parameter to specify a particular backup file.

Procedure

  • Authenticate using the sftp key:
    kubectl exec $POD -n <namespace> -- bash -c "/sftp/backup.sh -D -H $HOST -u $USERNAME \ 
      -k /sshd/sftp-key -d $DIRECTORY -n <backup file name>"
  • Alternatively, authenticate using username/password:
    kubectl exec $POD -n <namespace> -- bash -c "/sftp/backup.sh -D -H $HOST -u $USERNAME \ 
      -p $PASSWORD -d $DIRECTORY -n <backup file name>"
  • Alternatively, if running within the interactive shell of the Backup and Restore Pod:
    /sftp/backup.sh -D -H $HOST -u $USERNAME -k /sshd/sftp-key \ 
        -d $DIRECTORY -n <backup file name>
    /sftp/backup.sh -D -H $HOST -u $USERNAME -p $PASSWORD \ 
        -d $DIRECTORY -n <backup file name>

Example

This example restore an earlier backup from the sftp server and makes it available for restore. Use the pgbackrest info command within the Backup and Restore Pod to list the available backups known to Postgres Backrest Repo:

$ pgbackrest info
stanza: db
    status: ok
    cipher: none

    db (current)
        wal archive min/max (12-1): 000000010000000000000001/000000050000000000000097

        full backup: 20200826-152658F
            timestamp start/stop: 2020-08-26 15:26:58 / 2020-08-26 15:27:23
            wal start/stop: 000000010000000000000002 / 000000010000000000000002
            database size: 31MB, backup size: 31MB
            repository size: 3.7MB, repository backup size: 3.7MB

        full backup: 20200826-154646F
            timestamp start/stop: 2020-08-26 15:46:46 / 2020-08-26 15:47:11
            wal start/stop: 000000020000000000000006 / 000000020000000000000006
            database size: 31MB, backup size: 31MB
            repository size: 3.7MB, repository backup size: 3.7MB

        full backup: 20200826-160010F
            timestamp start/stop: 2020-08-26 16:00:10 / 2020-08-26 16:00:36
            wal start/stop: 000000030000000000000009 / 000000030000000000000009
            database size: 31MB, backup size: 31MB
            repository size: 3.7MB, repository backup size: 3.7MB

        full backup: 20200826-161301F
            timestamp start/stop: 2020-08-26 16:13:01 / 2020-08-26 16:13:29
            wal start/stop: 00000004000000000000000C / 00000004000000000000000C
            database size: 31MB, backup size: 31MB
            repository size: 3.7MB, repository backup size: 3.7MB

        full backup: 20200826-162422F
            timestamp start/stop: 2020-08-26 16:24:22 / 2020-08-26 16:24:48
            wal start/stop: 00000005000000000000000F / 00000005000000000000000F
            database size: 31MB, backup size: 31MB
            repository size: 3.7MB, repository backup size: 3.7MB

The last full backup is 20200826-162422F.