Rename
Fixed the
Fixed the
Abstracted code to determine which database cluster is the master and which are standbys.
+Abstracted code to determine which database cluster is the primary and which are standbys.
Fixed an issue where tablespaces were copied from the master during standby backup.
+Fixed an issue where tablespaces were copied from the primary during standby backup.
Exclude contents of
Exclude contents of
Backup from a standby cluster. A connection to the primary cluster is still required to start/stop the backup and copy files that are not replicated, but the vast majority of files are copied from the standby in order to reduce load on the master.
+Backup from a standby cluster. A connection to the primary cluster is still required to start/stop the backup and copy files that are not replicated, but the vast majority of files are copied from the standby in order to reduce load on the primary.
More flexible configuration for databases. Master and standby can both be configured on the backup server and
More flexible configuration for databases. Master and standby can both be configured on the backup server and
{[user-guide-os]} packages for
If
The new version can now be installed.
-To perform a backup of the
The
Use the
Backups can protect you from a number of disaster scenarios, the most common of which are hardware failure and data corruption. The easiest way to simulate data corruption is to remove an important
Starting the cluster without this important file will result in an error.
-To restore a backup of the
By default
When
Here an error is intentionally caused by removing repository permissions.
-Even when the permissions are fixed
Enabling the
Now
Set
Backup
Archive is expired because WAL segments were generated before the oldest backup. These are not useful for recovery — only WAL segments generated after a backup can be used to recover that backup.
-Set rolling
set of differentials for the last day or more. This allows quick restores to recent points-in-time but reduces overall space consumption.
Backup
Now performing a differential backup will expire the previous differential and incremental backups leaving only one differential backup.
-Expiring archive will never remove WAL segments that are required to make a backup consistent. However, since Point-in-Time-Recovery (PITR) only works on a continuous WAL stream, care should be taken when aggressively expiring archive outside of the normal backup expiration process.
-Restore a Backup in Quick Start required the database cluster directory to be cleaned before the
To demonstrate this feature two databases are created: test1 and test2. A fresh backup is run so
Each test database will be seeded with tables and data to demonstrate that recovery works with selective restore.
-One of the main reasons to use selective restore is to save space. The size of the test1 database is shown here so it can be compared with the disk utilization after a selective restore.
-Stop the cluster and restore only the test2 database. Built-in databases (
Once recovery is complete the test2 database will contain all previously created tables and data.
-The test1 database, despite successful recovery, is not accessible. This is because the entire database was restored as sparse, zeroed files.
It is clear that the test1 database uses far less disk space during the selective restore than it would have if the entire database had been restored.
-At this point the only action that can be taken on the invalid test1 database is
Now that the invalid test1 database has been dropped only the test2 and built-in databases remain.
-Point-in-Time Recovery (PITR) allows the WAL to be played from the last backup to a specified time, transaction id, or recovery point. For common recovery scenarios time-based recovery is arguably the most useful. A typical recovery scenario is to restore a table that was accidentally dropped or data that was accidentally deleted. Recovering a dropped table is more dramatic so that's the example given here but deleted data would be recovered in exactly the same way.
-It is important to represent the time as reckoned by
Now that the time has been recorded the table is dropped. In practice finding the exact time that the table was dropped is a lot harder than in this example. It may not be possible to find the exact time, but some forensic work should be able to get you close.
-Now the restore can be performed with time-based recovery to bring back the missing table.
-The
The
This example was rigged to give the correct result. If a backup after the required time is chosen then
Now take a new backup and attempt recovery from the new backup.
-Looking at the log output it's not obvious that recovery failed to restore the table. The key is to look for the presence of the recovery stopping before...
and last completed transaction...
log messages. If they are not present then the recovery to the specified point-in-time was not successful.
Using an earlier backup will allow
The default behavior for restore is to use the last backup but an earlier backup can be specified with the
Now the the log output will contain the expected recovery stopping before...
and last completed transaction...
messages showing that the recovery was successful.
Commands are run exactly as if the repository were stored on a local disk.
-File creation time in
For this example a new host named
For this example a new host named
The database host must be configured with the backup host/user. The default for the
The repository directory will also be removed from the database host. It will not be used anymore so leaving it around may be confusing later on.
-Check that the configuration is correct on both the
To perform a restore of the
NOTE: In the original implementation of asynchronous archiving, WAL segments were copied to the spool directory before compression and transfer. The new implementation copies WAL directly from the
The spool path must be configured and asynchronous archiving enabled. Asynchronous archiving automatically confers some benefit by reducing the number of ssh connections made to the backup server, but setting
The
Now the log file will contain parallel, asynchronous activity.
-Sometimes it is useful to prevent
Sometimes it is useful to prevent
Specify the
Start
It is also possible to stop
The stanza must also be specified when starting the
Replication allows multiple copies of a
Replication allows multiple copies of a
An easy way to test that replication is properly configured is to create a table on
An easy way to test that replication is properly configured is to create a table on
So, what went wrong? Since
So, what went wrong? Since
This can be done manually by calling pg_switch_xlog()
which pushes the current WAL segment to the archive (a new WAL segment is created to contain further changes).
pg_switch_xlog()
Instead of relying solely on the WAL archive, streaming replication makes a direct connection to the master and applies changes as soon as they are made on the master. This results in much less lag between the master and standby.
+Instead of relying solely on the WAL archive, streaming replication makes a direct connection to the primary and applies changes as soon as they are made on the primary. This results in much less lag between the primary and standby.
Streaming replication requires a user with the replication privilege.
-The
The
The standby needs to know how to contact the master so the
The standby needs to know how to contact the primary so the
It is possible to configure a password in the
By default {[user-guide-os]} stores the
By default {[user-guide-os]} stores the
Now when a table is created on pg_switch_xlog()
.
Now when a table is created on pg_switch_xlog()
.
Both the master and standby databases are required to perform the backup, though the vast majority of the files will be copied from the standby to reduce load on the master. The database hosts can be configured in any order.
Both the primary and standby databases are required to perform the backup, though the vast majority of the files will be copied from the standby to reduce load on the primary. The database hosts can be configured in any order.
This incremental backup shows that most of the files are copied from the
This incremental backup shows that most of the files are copied from the
The following instructions are not meant to be a comprehensive guide for upgrading
The following instructions are not meant to be a comprehensive guide for upgrading
Create the new cluster. If the
Stop the old cluster on the standby since it will be restored from the newly upgraded cluster to ensure the database system id is identical on both the master and standby.
+Stop the old cluster on the standby since it will be restored from the newly upgraded cluster to ensure the database system id is identical on both the primary and standby.
Stop the old cluster on the master and perform the upgrade.
+Stop the old cluster on the primary and perform the upgrade.
-Configure the new cluster settings and port.
-Update the
Start the new cluster and confirm it is successfully installed.
-Test configuration using the
Remove the old cluster.
-