How it  works...

It may seem impossible that such a simple command can clone an entire database. Yet, in the previous recipe we wrote a configuration file, and that's all walctl needs to operate. The walctl_clone command only has two parameters: the hostname of the database we are cloning and the name of the database superuser necessary to invoke a backup. Given these settings, walctl_clone performs a number of actions on our behalf:

  • Puts the master node into backup mode.
  • Retrieves all files from the database. If data files already exist in the PGDATA directory, it only copies changed files.
  • Ends backup mode on the master node.
  • Creates a recovery.conf file that will continuously retrieve files from pg-arc and connect as a streaming standby ...

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.