Backup & Restore

Concepts

Consistent backupIt is the backup taken when all committed transactions are written to the databasefiles, i.e., all the dirty buffer in memory is written to disk.Consistent backup can be taken by stopping the database in smart/fast mode. Inconsistent/Online BackupIt is the backup taken when the data files are not up-to-date, i.e., all committedtransactions have not Concepts

Backup Types

Logical backup is a backup in text format whose content can be read and changed witha text editor. In small builds, logical backup (pg_dump) can be used for builds whererestoring to the previous day isn’t a problem, such as web pages with little movement.However, backup policies should be decided by the institution. Physical backup is Backup Types

Archive Mode Configuration

It is recommended that the “/RA” (Recovery Area) directory be on a different disk thanthe operating system and database.wal_level determines the contents of wal files. This must be at least replica (defaultvalue) for archiving. In addition to replica, it also has logical option, which contains thenecessary information for logical standby.archive_command is required to test where Archive Mode Configuration

Online (Hot) Backup, pg_basebackup

While the Postgresql database is running, i.e., when the instance is up, it can bebacked up with pg_basebackup. Users are not affected during the backup process,and both full recovery and point-in recovery can be performed with this backup. Inaddition, this backup can be used for hot standby setup. Basebackup automatically takes the database in backup Online (Hot) Backup, pg_basebackup

Restore from Backup to a Specific Time(Point-in Recovery – PITR)

PITR allows restoring to a point between the full backup and the last WAL file.Recovery can be done to the desired point with the recovery_target_time/name/xid/lsn parameters.Since the database cannot be closed in live environments and other objects continue to be updated (DML), PITR is performed on a different server and the necessary data can be Restore from Backup to a Specific Time(Point-in Recovery – PITR)

PGBackRest

Pgbackrest is an easy-to-use open source (MT licensed) postgresql backup tool,supported by algorithms, for performance in large-scale and heavy-duty databases.(Compatible with postgresql 9 and above.)Backup can be taken by installing pgbackrest in the local of the database server, orby installing it on the backup server on the network. Thus, if there are many postgresdatabase servers PGBackRest