How it works...

We begin by creating a configuration file for DRBD with the least amount of information necessary. In the pg.res file, we define a DRBD resource named pg for our PostgreSQL data. DRBD resource numbers start at zero, so we use the define keyword to set the DRBD minor device number to 0. This means our DRBD device will be named /dev/drbd0.

After setting the device number, we specify which storage volume this DRBD resource should use with the disk keyword. The meta-disk keyword allows us to define a device to store DRBD metadata. To keep things simple, we've used the internal setting so that metadata is stored on the same device as the data we are synchronizing.

The last thing we do in the resource configuration file is define ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.