The DRBD User's Guide

Florian Haas

Philipp Reisner

Lars Ellenberg

This guide has been released to the DRBD community, and its authors strive to improve it permanently. Feedback from readers is always welcome and encouraged. Please use the DRBD public mailing list for enhancement suggestions and corrections. Recent content additions are marked with Draft status; feedback on those sections is particularly highly appreciated.

Trademarks used in this book

DRBD, the DRBD logo, LINBIT, and the LINBIT logo are trademarks or registered trademarks of LINBIT Information Technologies GmbH in Austria, the United States and other countries.

AMD is a registered trademark of Advanced Micro Devices, Inc.

Debian is a registered trademark of Software in the Public Interest, Inc.

IBM is a registered trademark of International Business Machines Corporation.

Intel is a registered trademark of Intel Corporation.

Linux is a registered trademark of Linus Torvalds.

MySQL and MySQL Enterprise are trademarks or registered trademarks of MySQL AB and/or Sun Microsystems, Inc.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates.

Red Hat, Red Hat Enterprise Linux, and RPM are trademarks or registered trademarks of Red Hat, Inc.

SuSE, SUSE, and SUSE Linux Enterprise Server are trademarks or registered trademarks of Novell, Inc.

Xen is a registered trademark of XenSource, Inc.

Other names mentioned in this book may be trademarks or registered trademarks of their respective owners.


Table of Contents

About this guide
I. Introduction to DRBD
1. DRBD Fundamentals
Kernel module
User space administration tools
Resources
Resource roles
2. DRBD Features
Single-primary mode
Dual-primary mode
Replication modes
Efficient synchronization
On-line device verification
Replication traffic integrity checking
Automatic split brain recovery
Support for disk flushes
Disk error handling strategies
Strategies for dealing with outdated data
II. Building, installing and configuring DRBD
3. Installing pre-built DRBD binary packages
Packages supplied by LINBIT
Packages supplied by distribution vendors
4. Building and installing DRBD from source
Downloading the DRBD sources
Building DRBD from source
Checking build prerequisites
Preparing the kernel source tree
Compiling DRBD as a kernel module
Patching DRBD into the kernel
Installing DRBD
Building a DRBD RPM package
Building a DRBD Debian package
5. Configuring DRBD
Preparing your lower-level storage
Preparing your network configuration
Configuring your resource
Example configuration
The global section
The common section
The resource sections
Enabling your resource for the first time
The initial device synchronization
III. Working with DRBD
6. Common administrative tasks
Checking DRBD status
Status information in /proc/drbd
Connection states
Resource roles
Disk states
Enabling and disabling resources
Enabling resources
Disabling resources
Reconfiguring resources
Promoting and demoting resources
Enabling dual-primary mode
Using on-line device verification
Enabling on-line verification
Invoking on-line verification
Automating on-line verification
Configuring the rate of synchronization
Permanent syncer rate configuration
Temporary syncer rate configuration
Configuring I/O error handling strategies
Resizing resources
Growing on-line
Growing off-line
Shrinking on-line
Shrinking off-line
Disabling backing device flushes
7. Troubleshooting and error recovery
Dealing with hard drive failure
Manually detaching DRBD from your hard drive
Automatic detach on I/O error
Replacing a failed disk when using internal meta data
Replacing a failed disk when using external meta data
Dealing with node failure
Dealing with temporary secondary node failure
Dealing with temporary primary node failure
Dealing with permanent node failure
Dealing with split brain
IV. DRBD-enabled applications
8. Integrating DRBD with Heartbeat clusters
Heartbeat primer
The Heartbeat cluster manager
Heartbeat resources
Heartbeat resource agents
Heartbeat communication channels
Heartbeat configuration
The ha.cf file
The authkeys file
Propagating the cluster configuration to cluster nodes
Using DRBD in Heartbeat R1-style clusters
Heartbeat R1-style configuration
Managing Heartbeat R1-style clusters
Using DRBD in Heartbeat CRM-enabled clusters
Heartbeat CRM configuration
Managing Heartbeat CRM clusters
Using Heartbeat with dopd
Heartbeat configuration
DRBD Configuration
Testing dopd functionality
9. Using LVM with DRBD
LVM primer
Using a Logical Volume as a DRBD backing device
Configuring a DRBD resource as a Physical Volume
Nested LVM configuration with DRBD
10. Using GFS with DRBD
GFS primer
Creating a DRBD resource suitable for GFS
Configuring LVM to recognize the DRBD resource
Configuring your cluster to support GFS
Red Hat Enterprise Linux 4
Creating a GFS filesystem
Using your GFS filesystem
11. Using Xen with DRBD
Xen primer
Creating a DRBD resource suitable to act as a Xen VBD
Using DRBD VBDs
Starting, stopping, and migrating DRBD-backed domU's
Internals of DRBD/Xen integration
Integrating Xen with Heartbeat
V. Learning more about DRBD
12. DRBD Internals
DRBD meta data
Internal meta data
External meta data
Estimating meta data size
Generation Identifiers
Data generations
The generation identifier tuple
How generation identifiers change
How DRBD uses generation identifiers
The Activity Log
Purpose
Active extents
Selecting a suitable Activity Log size
The quick-sync bitmap
The peer outdater interface
13. Getting more information
Public mailing list
Commercial DRBD support
Publications
Other useful resources
A. DRBD system manual pages
drbd.conf — Configuration file for DRBD's devices
drbdadm — Administration tool for DRBD
drbdsetup — Setup tool for DRBD
drbdmeta — DRBD's meta data management tool

List of Figures

1.1. DRBD's position within the Linux I/O stack
9.1. LVM overview
12.1. GI tuple changes at start of a new data generation
12.2. GI tuple changes at start of re-synchronization
12.3. GI tuple changes at completion of re-synchronization

List of Tables

12.1. Peer outdater exit codes

List of Examples

A.1. A small drbd.conf file

List of Equations

2.1. Synchronization time
6.1. Syncer rate example, 110MB/s effective available bandwidth
6.2. Syncer rate example, 80MB/s effective available bandwidth
12.1. Calculating DRBD meta data size (exactly)
12.2. Estimating DRBD meta data size (approximately)
12.3. Active extents calculation based on sync rate and target sync time
12.4. Active extents calculation based on sync rate and target sync time (example)