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 to define ...

Get PostgreSQL 12 High Availability Cookbook 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.