O'Reilly logo

Troubleshooting PostgreSQL by Hans-Jürgen Schönig

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making use of asynchronous replication

While point-in-time recovery is nice, it might not be enough. In many cases, people want an up-to-date standby server that can also serve as a read-only slave. A feature called streaming replication is exactly what is needed in this case.

Setting up streaming replication is easy and can be performed in a handful of steps:

  1. Adapt postgresql.conf on the master server.
  2. Change pg_hba.conf to allow remote base backups.
  3. Run pg_basebackup to get an initial copy.
  4. Fire up the slave.

To set up postgresql.conf, the following settings are needed:

wal_level = hot_standby
max_wal_senders = 5
hot_standby = on

The first two settings are mandatory on the master. The wal_level field tells the server to create enough xlog to allow streaming ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required