PostgreSQL 9.3: "One line - one standby"

01.2013 / Category: , / Tags:

Sometimes it happens that you reach a point where you know that things cannot be any easier than they already are.

I think in PostgreSQL 9.3 we will pretty much have reached this point when we fire up a simple replica. Back in the old times you had to call pg_start_backup, rsync the entire stuff, call pg_stop_backup and finally come up with a recovery.conf file to setup a single standby.

Things have changed and some time ago pg_basebackup made life so much easier. No more rsync (in the typical case), no more function calls. But still, a normal user had to come up with a simple recovery.conf file to control the recovery process.

However, when you take a look at pg_basebackup, you'll figure out that the call itself already has all info a user will typically need to write a simple recovery.conf file. So, why not use this info and write a recovery.conf file straight away if desired?

This is exactly what Zoltan has implemented for 9.3:
The patch just got committed recently

What does it mean for a typical user?
If the primary database has been configured correctly, it means that a typical PostgreSQL user can add a standby to an existing PostgreSQL replication setup with just ONE line.

All you have to do is to call pg_basebackup with the "-R" option. A simple recovery.conf file will be written automatically. The only thing left to do now is to fire up your brand new standby (pg_ctl start ...).

I guess there is no way to make it any easier.

Comments are closed.

CYBERTEC Logo white
CYBERTEC PostgreSQL International GmbH
Römerstraße 19
2752 Wöllersdorf

+43 (0) 2622 93022-0

Get the newest PostgreSQL Info & Tools

    This site is protected by reCAPTCHA and the Google Privacy Policy & Terms of Service apply.

    CYBERTEC PostgreSQL International GmbH
    phone-handsetmagnifiercrosscross-circle linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram