Configuring the DRBD Environment
To set up DRBD, MySQL, and Heartbeat, you follow a number of steps that affect the operating system, DRBD and your MariaDB installation.
Before starting the installation process, be aware of the following information, terms and requirements on using DRBD:
- DRBD works through two (or more) servers, each called a node.
- Ensure that your DRBD nodes are as identically configured as possible, so that the secondary machine can act as a direct replacement for the primary machine in the event of system failure.
- The node that contains the primary data, has read/write access to the data, and in an HA environment is the currently active node is called the primary.
- The server to which the data is replicated is called the secondary.
- A collection of nodes that are sharing information is referred to as a DRBD cluster.
- For DRBD to operate, you must have a block device on which the information can be stored on each DRBD node. The lower-level block device can be a physical disk partition, a partition from a volume group or RAID device or any other block device.
Typically, you use a spare partition on which the physical data is stored. On the primary node, this disk holds the raw data that you want replicated. On the secondary nodes, the disk holds the data replicated to the secondary server by the DRBD service. Ideally, the size of the partition on the two DRBD servers should be identical, but this is not necessary as long as there is enough space to hold the data that you want distributed between the two servers.
- For the distribution of data to work, DRBD is used to create a logical block device that uses the lower level block device for the actual storage of information. To store information on the distributed device, a file system is created on the DRBD logical block device.
- When used with MySQL, once the file system has been created, you move the MariaDB data directory (including InnoDB data files and binary logs) to the new file system.
- When you set up the secondary DRBD server, you set up the physical block device and the DRBD logical block device that stores the data. The block device data is then copied from the primary to the secondary server.
The overview for the installation and configuration sequence is as follows:
- First, set up your operating system and environment. This includes setting the correct host name, updating the system and preparing the available packages and software required by DRBD, and configuring a physical block device to be used with the DRBD block device. See , "Setting Up Your Operating System for DRBD".
- Installing DRBD requires installing or compiling the DRBD source code and then configuring the DRBD service to set up the block devices to be shared. See , "Installing and Configuring DRBD".
- After configuring DRBD, alter the configuration and storage location of the MariaDB data, as explained in , "Configuring MariaDB for DRBD".
Optionally, configure high availability using the Linux Heartbeat service. See , "Using Linux HA Heartbeat", for more information.