Setting up streaming replication
Physical replication is a technique used by many database management systems. The primary database node records changes in a transaction log (WAL), and then the log data is sent from the primary to the standby, where the log is replayed.
In PostgreSQL, PSR transfers WAL data directly from the primary to the standby, giving us integrated security and a shorter replication delay.
There are two main ways to set up streaming replication: with or without an additional archive. We present how to set it up without an external archive, as this is simpler and generally more efficient. However, there is one downside related to the retention of WAL at the primary, suggesting that the simpler approach may not be appropriate for larger databases, which is explained later in this recipe.
Getting ready
If you haven’t read the Replication concepts and Replication best practices recipes at the start of this chapter, go and read them now. Note...