Book Image

PostgreSQL 9 High Availability Cookbook

By : Shaun Thomas
Book Image

PostgreSQL 9 High Availability Cookbook

By: Shaun Thomas

Overview of this book

A comprehensive series of dependable recipes to design, build, and implement a PostgreSQL server architecture free of common pitfalls that can operate for years to come. Each chapter is packed with instructions and examples to simplify even highly complex database operations. If you are a PostgreSQL DBA working on Linux systems who want a database that never gives up, this book is for you. If you've ever experienced a database outage, restored from a backup, spent hours trying to repair a malfunctioning cluster, or simply want to guarantee system stability, this book is definitely for you.
Table of Contents (12 chapters)
11
Index

Cloning a database with walctl


One of the utilities that walctl includes is a script dedicated to creating a copy of the source database. Why don't we just use pg_basebackup? When dealing with large databases common to high availability systems, we want to copy as little data as possible. The pg_basebackup utility is a great basic tool, but it always copies every file. The walctl_clone program that we use in this recipe relies on rsync.

Of course, this raises another question: why not just use rsync directly? Due to its extensive capabilities, rsync is inherently dangerous. Did you accidentally transpose the source and target destination parameters? If you did so, you've just erased or corrupted your database master. The walctl_clone tool wraps rsync in such a way that it can only retrieve data from a master node. We can stay safe by limiting its use to clone servers.

In this recipe, we'll introduce and invoke the walctl_clone command, which does a few other useful things on our behalf. Not...