The /etc/drbd.conf, is read by /etc/init.d/drbd and /etc/ha.d/resrouce.d/datadisk which are included in the drbd distribution.
The file format was designed as to allow to have a verbatim copy of the file on both nodes of the cluster, and in order to keep your configuration manageable you should also do so.
Example 1. A small drbd.conf file
resource drbd0 { protocol=C fsck-cmd=fsck.ext2 -p -y on thost1 { device=/dev/nb1 disk=/dev/hda7 address=10.1.1.31 port=7789 } on thost2 { device=/dev/nb1 disk=/dev/hda7 address=10.1.1.32 port=7789 } } |
There may be multiple resource sections in a singe drbd.conf file.
The file consists of sections and parameter lines. A section begins with a keyword, sometimes an additional name and an opening brace. A section ends with a closing brace.
A parameter line starts with the identifier of the parameter followed by an equal sign ("="). Every subsequent character on that line is considered as part of the parameters value. There must not be a single white space between the identifier and the equal sing. A special case are Boolean parameters which only consists of the identifier.
Comment lines may be placed into the configuration file and must begin with a hash sign ("#") in the leftmost column.
Configures a DRBD resource. Each resource section needs to have two host sections (keyword on) and may have a net and a disk section. Required parameter in this section: protocol, fsck-cmd.
Carries the necessary configuration parameters for a DRBD device of the enclosing resource. Required parameters in this section: device, disk, address, port.
This section is used to fine tune DRBD's properties in respect to the low level storage. Please refer to drbdsetup(8) for detailed description of the parameters. Allowed parameters: disk-size, do-panic.
This section is used to fine tune DRBD's properties. Please refer to drbdsetup(8) for detailed description of this section's parameters. Allowed parameters: sync-rate, connect-int, skip-sync, ping-int, timeout, tl-size.
prot-id may be A, B or C.
Upon resource takeover datadisk runs the command on the device of the resource. Specify here the command that brings your file system into a consistent state. In case of a journaling file system you may use /bin/true instead.
Each DRBD resource needs a TCP port number which is used to connect to the node's partner device. Two DRBD resources may not use the same port.
The name of the block device node of the resource being described. You must use this device with your application (file system) and you must not use the block device which is specified with the disk= parameter.
The device nodes must have the same major number as the DRBD driver has. With the current implementation major 43 is used and the corresponding device nodes are usually named /dev/nb0, /dev/nb1, etc.
DRBD uses this block device to actually store and retrieve the data. Never access such a device while DRBD is running on top of it. This holds also true for dumpe2fs(8) and similar commands.
A resource needs one IP address per device, which is used to wait for incoming connections from the partner device respectively to reach the partner device.