Book Image

PostgreSQL 9 High Availability Cookbook

By : Shaun Thomas
Book Image

PostgreSQL 9 High Availability Cookbook

By: Shaun Thomas

Overview of this book

Table of Contents (17 chapters)
PostgreSQL 9 High Availability Cookbook
About the Author
About the Reviewers

Adding block-level replication

DRBD is the next component of our software stack. Unlike LVM, it requires at least two servers to function normally. One server acts as the data Primary, and the other acts as a Secondary. These roles can be switched at any time, depending on which server is running PostgreSQL.

For now, we are going to focus on configuring and activating DRBD as part of our stack.

Getting ready

By now, we hope you've followed the recipe in Getting started with the Linux Volume Manager on two servers with /dev/sdb as physically identical storage on each server. While DRBD can operate in standalone mode on a single server, this is actually more advanced usage. The steps in this recipe are best applied the same on both of the servers simultaneously, unless noted otherwise.

How to do it...

For the purposes of this recipe, we will assume that the /dev/VG_DRBD/LV_DATA device already exists. The two PostgreSQL nodes for this example are named pg1 and pg2 and are located on the 192.168...