All aspects of DRBD are controlled by a single
configuration file, /etc/drbd.conf. You
should always make sure this configuration file is
exactly identical on both participating
cluster nodes.
The DRBD source tarball contains an example configuration
file in the scripts
subdirectory. Binary installation packages will either install
this example configuration directly in
/etc, or in a package-specific
documentation directory such as
/usr/share/doc/packages/drbd.
![]() | Note |
|---|---|
This section describes only those few aspects of the configuration file which are absolutely necessary to understand in order to get DRBD up and running. The configuration file's syntax and contents are documented in great detail in drbd.conf(5). |
For the purposes of this guide, we assume a minimal setup in line with the examples given in the previous sections:
global {
usage-count yes;
}
common {
protocol C;
}
resource r0 {
on alice {
device /dev/drbd1;
disk /dev/sda7;
address 10.1.1.31:7789;
meta-disk internal;
}
on bob {
device /dev/drbd1;
disk /dev/sda7;
address 10.1.1.32:7789;
meta-disk internal;
}
}
This example configures DRBD in the following fashion:
You "opt in" to be included in DRBD's usage statistics (see below).
Resources are configured to use fully synchronous replication (Protocol C) unless explicitly specified otherwise.
Our cluster consists of two nodes,
alice and bob.
We have a resource arbitrarily named r0
which uses /dev/sda7 as the
lower-level device, and is configured with internal meta
data.
The resource uses TCP port 7789 for its network connections, and binds to the IP addresses 10.1.1.31 and 10.1.1.32, respectively.
This section is allowed only once, preferrably at the very top of the configuration file. Of the few options available in this section, only one is of relevance to most users:
usage-count. The DRBD project keeps statistics about the usage of
various DRBD versions. This is done by contacting an HTTP server
every time a new DRBD version is installed on a system. This
can be disabled by setting usage-count no;.
The default is usage-count ask; which will
prompt you every time you upgrade DRBD.
![]() | Note |
|---|---|
DRBD's usage statistics are, of course, publicly available: see http://usage.drbd.org. |
This section provides a shorthand method to define configuration settings inherited by every resource. You may define any option you can also define on a per-resource basis.
Including a common section is not strictly
required, but strongly recommended if you are using more
than one resource. Otherwise, the configuration quickly
becomes convoluted by repeatedly-used options.
In the example above, we included
protocol C; in the common
section, so every resource configured (including
r0) inherits this option unless it has another
protocol option configured explicitly. For
other synchronization protocols available, see the section called “Replication modes”.
Any DRBD resource you define must be named by
specifying resource
in the
configuration file. You may use any arbitrary identifier,
however the name must not contain characters other than those
found in the US-ASCII character set, and must also not include
whitespace. name
Every resource configuration must also have two
on
sub-sections (one for every cluster node). host
All other configuration settings are either inherited
from the common section (if it exists), or
derived from DRBD's default settings.
In fact, you can use a shorthand notation for the
on
sub-sections, too: every option whose values are equal on
both hosts may be specified directly in the
hostresource section. Thus, we can further
condense this section, in comparison with the example
cited above:
resource r0 {
device /dev/drbd1;
disk /dev/sda7;
meta-disk internal;
on alice {
address 10.1.1.31:7789;
}
on bob {
address 10.1.1.32:7789;
}
}
This notation is available in DRBD versions 8.2.1 and above.