### Build and Install DRBD Userspace Utilities Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index These commands build the DRBD management utilities (`drbdadm`, `drbdsetup`, `drbdmeta`) and install them into the system. This process is typically performed after the configure script has been run successfully. Ensure you have the necessary permissions for installation. ```bash $ make $ sudo make install ``` -------------------------------- ### Shorthand for Installing DRBD Kernel Module Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index A shorthand command for installing the DRBD kernel module using module-assistant. Equivalent to 'module-assistant auto-install drbd-module', this command simplifies the installation process. ```bash # m-a a-i drbd-module ``` -------------------------------- ### Promoter Plugin Configuration: Multi-line Service Strings Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This example demonstrates how to define multi-line service strings within the 'start' list of the promoter plugin configuration. This is useful for improving readability of long service definitions, utilizing TOML's multi-line basic string syntax with backslash continuation. ```toml start = [ """ ocf:heartbeat:Filesystem fs_mysql device=/dev/drbd1001 \ directory=/var/lib/mysql fstype=ext4 run_fsck=no""", "mariadb.service", """ ocf:heartbeat:IPaddr2 db_virtip ip=192.168.222.65 \ cidr_netmask=24 iflabel=virtualip""" ] ``` -------------------------------- ### Verify DRBD Build and Install DRBD Components Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index These commands first verify a successful DRBD kernel module build by checking for the `drbd.ko` file and then proceed to install the DRBD kernel module and userspace management tools. The `make install` commands are executed with `sudo` for elevated privileges. ```bash cd drbd-9.0 && sudo make install && cd .. cd drbd-utils && sudo make install && cd .. ``` -------------------------------- ### Install DRBD Proxy using APT Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Installs the DRBD Proxy package using the APT package manager. This command assumes the LINBIT repositories have been correctly configured. ```bash # apt install drbd-proxy ``` -------------------------------- ### Start DRBD Resources Manually Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Starts the DRBD resources using their target systemd service. This is the manual method for bringing DRBD devices online after an upgrade, typically used when not employing a cluster manager. ```bash # systemctl start drbd@.target ``` -------------------------------- ### Install DRBD Proxy using DNF Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Installs the DRBD Proxy package using the DNF package manager. This command assumes the LINBIT repositories have been correctly configured. ```bash # dnf install drbd-proxy ``` -------------------------------- ### DRBD Variable Synchronization Rate Configuration Example Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This snippet shows an example configuration for variable-rate synchronization in DRBD, suitable for deployments with DRBD Proxy. It includes parameters like c-plan-ahead, c-max-rate, and c-fill-target to manage synchronization bandwidth dynamically. The optimal settings depend on network bandwidth, I/O patterns, and link congestion. ```drbd.conf resource { disk { c-plan-ahead 5; c-max-rate 10M; c-fill-target 2M; } } ``` -------------------------------- ### Install DRBD Kernel Module Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Installs the DRBD kernel module using the module-assistant tool. This command automatically installs the necessary modules for the running kernel. It's essential to rebuild the module after kernel upgrades. ```bash # module-assistant auto-install drbd-module ``` -------------------------------- ### Start DRBD Primary Role and Initial Sync Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Initiates the DRBD resource to the primary role, starting the full synchronization process. Progress can be monitored using 'drbdadm status'. This command is essential for bringing a DRBD resource online and ensuring data consistency. ```bash # drbdadm primary --force ``` -------------------------------- ### DRBD Legacy (8.4) Style Configuration Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index An example of a DRBD resource configuration using the older 8.4 style syntax. This format differs in how devices and connections are specified. ```DRBD Configuration resource r0 { on alice { device /dev/drbd1; disk /dev/vg0/lv0; meta-disk internal; address 10.1.1.31:7789; } on bob { device /dev/drbd1; disk /dev/vg0/lv0; meta-disk internal; address 10.1.1.32:7789; } } ``` -------------------------------- ### Install DRBD using Apt (Ubuntu) Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Installs DRBD utilities and the DKMS (Dynamic Kernel Module Support) package on Ubuntu LTS systems using the apt package manager. This assumes the LINBIT PPA repository has been added. ```bash # apt install drbd-utils drbd-dkms ``` -------------------------------- ### Verify DRBD installation on RPM-based systems Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index After enabling LINBIT repositories, this command refreshes the package metadata and displays information about the 'drbd-utils' package, confirming it's being pulled from LINBIT repositories on RPM-based systems. ```bash # dnf --refresh info drbd-utils ``` -------------------------------- ### DRBD Configuration File Structure Example Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This snippet shows the typical structure of the main DRBD configuration file, which includes global common settings and resource-specific configuration files. It highlights the convention of using include statements for modularity and maintainability. ```plaintext include "/etc/drbd.d/global_common.conf"; include "/etc/drbd.d/*.res"; ``` -------------------------------- ### Verify DRBD installation on DEB-based systems Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index After enabling LINBIT repositories, this command updates the package list and displays information about the 'drbd-utils' package, confirming it's being pulled from LINBIT repositories on DEB-based systems. ```bash # apt update && apt info drbd-utils ``` -------------------------------- ### Pacemaker Configuration for DRBD-backed MySQL Service Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This Pacemaker configuration example demonstrates setting up a DRBD-backed MySQL service using the 'master-slave' resource agent. It includes defining the DRBD resource, a multi-state resource, the filesystem, IP address, and the MySQL service itself, along with necessary constraints for proper ordering and colocation. ```crm crm configure crm(live)configure# primitive drbd_mysql ocf:linbit:drbd \ params drbd_resource="mysql" \ op monitor interval="29s" role="Master" \ op monitor interval="31s" role="Slave" crm(live)configure# ms ms_drbd_mysql drbd_mysql \ meta master-max="1" master-node-max="1" \ clone-max="2" clone-node-max="1" \ notify="true" crm(live)configure# primitive fs_mysql ocf:heartbeat:Filesystem \ params device="/dev/drbd/by-res/mysql/0" \ directory="/var/lib/mysql" fstype="ext3" crm(live)configure# primitive ip_mysql ocf:heartbeat:IPaddr2 \ params ip="10.9.42.1" nic="eth0" crm(live)configure# primitive mysqld lsb:mysqld crm(live)configure# group mysql fs_mysql ip_mysql mysqld crm(live)configure# colocation mysql_on_drbd \ inf: mysql ms_drbd_mysql:Master crm(live)configure# order mysql_after_drbd \ inf: ms_drbd_mysql:promote mysql:start crm(live)configure# commit crm(live)configure# exit bye ``` -------------------------------- ### DRBD Proxy configuration in resource file Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index An example DRBD resource configuration file demonstrating how to set up DRBD Proxy. It includes proxy settings, memory limits, and specific inside/outside IP addresses for communication. ```drbd resource r0 { protocol A; device /dev/drbd15; disk /dev/VG/r0; meta-disk internal; proxy { memlimit 512M; plugin { zstd level 7; } } on alice { address 127.0.0.1:7915; proxy on alice { inside 127.0.0.1:7815; outside 192.168.23.1:7715; } } on bob { address 127.0.0.1:7915; proxy on bob { inside 127.0.0.1:7815; outside 192.168.23.2:7715; } } } ``` -------------------------------- ### Show DRBD Proxy Help using drbd-proxy-ctl Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Displays the available commands and usage information for the `drbd-proxy-ctl` utility. This is a fundamental step to understand the tool's capabilities. ```bash # drbd-proxy-ctl --help ``` -------------------------------- ### Install Python 3 on DEB-based systems Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command installs Python 3 on DEB-based Linux distributions (like Debian, Ubuntu) to ensure the linbit-manage-node.py script can run. ```bash # apt -y install python3 ``` -------------------------------- ### Specify OCF Resource Agent in Promoter Plugin Start List Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This example demonstrates how to specify an OCF resource agent within the 'start' list of services for the DRBD Reactor promoter plugin. It includes the OCF vendor, agent name, instance ID, and optional key-value pairs passed as environment variables to the systemd unit file. The OCF resource agents are expected in `/usr/lib/ocf/resource.d/`. ```drbd-reactor-promoter [[promoter]] ... start = ["ocf:heartbeat:IPaddr2 ip_mysql ip=10.43.7.223 cidr_netmask=16"] ... ``` -------------------------------- ### Install DRBD using Yum (CentOS) Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Installs DRBD and its kernel module on CentOS using the yum package manager. Ensure that the necessary repositories (e.g., EPEL) are enabled for DRBD to be available. ```bash # yum install drbd kmod-drbd ``` -------------------------------- ### Get hints from linbit-manage-node.py script Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command re-runs the linbit-manage-node.py script with the --hints flag, which displays helpful suggestions and commands for managing LINBIT nodes and repositories. This is useful if you need to recall previous actions or configurations. ```bash # ./linbit-manage-node.py --hints ``` -------------------------------- ### Configure DRBD Build Environment Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command configures the DRBD build environment with common options for standard filesystem hierarchy. It sets the installation prefix, local state directory, and system configuration directory. Ensure you are in the top directory of your DRBD source tree before running. ```bash $ ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc ``` -------------------------------- ### Install DRBD using YaST2 or Zypper (SLES) Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Installs the DRBD package on SUSE Linux Enterprise Server (SLES) using either the YaST2 graphical tool or the zypper command-line package manager. This is part of the High Availability Extension. ```bash # yast -i drbd ``` ```bash # zypper install drbd ``` -------------------------------- ### Enable and Start SNMP Service Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command enables and starts the SNMP service daemon (`snmpd.service`). If the service is already running, this command will restart it. ```shell # systemctl enable --now snmpd.service ``` -------------------------------- ### Display DRBD Version and Build Information Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command displays the version of the DRBD module currently running on the system, along with detailed build information. It's useful for verifying the DRBD installation and identifying the specific build that is active. ```bash $ cat /proc/drbd version: 9.0.0 (api:1/proto:86-110) GIT-hash: XXX build by linbit@buildsystem.linbit, 2011-10-12 09:07:35 ``` -------------------------------- ### Install Python 3 on RPM-based systems Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command installs Python 3 on RPM-based Linux distributions (like Fedora, CentOS, RHEL) to ensure the linbit-manage-node.py script can run. ```bash # dnf -y install python3 ``` -------------------------------- ### Enable and Promote Stacked DRBD Resources Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Commands to enable and promote DRBD resources in a stacked setup. This involves bringing up the lower-level resource ('r0'), promoting it to primary, creating metadata for the stacked resource ('r0-U'), and then bringing up and promoting the stacked resource. ```bash drbdadm up r0 drbdadm primary r0 # drbdadm create-md --stacked r0-U # drbdadm up --stacked r0-U # drbdadm primary --stacked r0-U # drbdadm create-md r0-U # drbdadm up r0-U ``` -------------------------------- ### Install DRBD Packages on RPM-based Systems Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Installs or updates DRBD packages on RPM-based Linux distributions such as SLES, RHEL, and AlmaLinux using the dnf package manager. ```bash # For new installations: dnf install drbd-utils # For upgrades: dnf update drbd-utils ``` -------------------------------- ### DRBD Resource Configuration with LVM Backing Device Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This DRBD resource configuration example shows how to specify an LVM logical volume ('/dev/foo/bar') as the backing disk for a DRBD resource named 'r0'. It includes separate configurations for nodes 'alice' and 'bob'. ```drbd resource r0 { ... on alice { device /dev/drbd0; disk /dev/foo/bar; ... } on bob { device /dev/drbd0; disk /dev/foo/bar; ... } } ``` -------------------------------- ### Clone Running Kernel Configuration Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Copies the currently running kernel's configuration to the kernel source tree's .config file. Multiple methods are provided depending on the system and kernel build setup. ```bash # zcat /proc/config.gz > .config ``` ```bash # make cloneconfig ``` ```bash # cp /boot/config-$(uname -r).config ``` -------------------------------- ### Verify AgentX Plugin Status Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This shows an example output from `drbd-reactorctl status`, indicating that the AgentX plugin is connecting to the main agent at the specified address. The `[...]` signifies other potential output lines. ```shell /etc/drbd-reactor.d/agentx.toml: AgentX: connecting to main agent at localhost:705 [...] ``` -------------------------------- ### Install SNMP Packages on DEB-based Systems Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command installs the necessary SNMP packages (snmp and snmpd) on Debian-based Linux distributions like Ubuntu using the 'apt' package manager. These packages are prerequisites for configuring the AgentX plugin for SNMP monitoring with DRBD Reactor. ```bash # apt -y install snmp snmpd ``` -------------------------------- ### Install SNMP Packages on RPM-based Systems Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command installs the necessary SNMP packages (net-snmp and net-snmp-utils) on RPM-based Linux distributions like Fedora or CentOS using the 'dnf' package manager. These packages are prerequisites for configuring the AgentX plugin for SNMP monitoring with DRBD Reactor. ```bash # dnf -y install net-snmp net-snmp-utils ``` -------------------------------- ### Creating Systemd Unit File for HA Mount Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This example shows how to create a systemd unit file to manage the mounting of a DRBD-backed device to a specified mount point. The file name must follow systemd's naming conventions, which can be generated using the `systemd-escape` command. ```shell # cat << EOF > /etc/systemd/system/mnt-test.mount [Unit] Description=Mount /dev/drbd1000 to /mnt/test [Mount] What=/dev/drbd1000 Where=/mnt/test Type=ext4 EOF ``` -------------------------------- ### DRBD Resource Configuration Example Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This snippet demonstrates a basic DRBD resource configuration. It defines the device minor number, the underlying disk, the metadata storage method, and network addresses for two cluster nodes, 'alice' and 'bob'. ```drbdconf resource "r0" { device minor 1; disk "/dev/vg0/lv0"; meta-disk internal; on "alice" { address 10.1.1.31:7789; } on "bob" { address 10.1.1.32:7789; } } ``` -------------------------------- ### Build DRBD Kernel Module (Prepared Headers) Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command builds the DRBD kernel module against pre-compiled kernel headers. It requires specifying the `KDIR` variable to point to the correct kernel headers directory. This is useful when kernel sources are not available but headers are installed. ```bash $ cd drbd-9.0 $ make clean $ make KDIR=/usr/src/linux-headers-3.2.0-4-amd64/ ``` -------------------------------- ### Clone DRBD Repository Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Clones the DRBD source code repository recursively to include submodules. This is the initial step for building DRBD from source. ```git git clone --recursive https://github.com/LINBIT/drbd.git ``` -------------------------------- ### Enable and Manage DRBD Reactor Service Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Commands to enable, start, reload, disable, and enable the DRBD Reactor service and its configurations. These commands are essential for applying configuration changes and managing resource availability. ```shell # systemctl enable drbd-reactor.service --now ``` ```shell # drbd-reactorctl status ha-mount ``` ```shell # drbd-reactorctl disable --now ha-mount ``` ```shell # drbd-reactorctl enable ha-mount ``` ```shell # systemctl reload drbd-reactor.service ``` -------------------------------- ### Get Verbose DRBD Resource Status with Statistics Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Provides detailed status information for DRBD resources, including verbose output and performance statistics. This is useful for in-depth troubleshooting and performance analysis. ```bash # drbdsetup status home --verbose --statistics ``` -------------------------------- ### DRBD Events Monitoring with Statistics Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Collects DRBD events along with performance counters and other factual data using 'drbdsetup events2 --statistics'. This enhances real-time monitoring with detailed performance metrics. ```bash # drbdsetup events2 --statistics r0 ``` -------------------------------- ### Create DRBD Metadata (Interactive) Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command initiates the creation of DRBD metadata for a specified resource. It interactively prompts the user to confirm the conversion from v08 to v09 metadata and warns about potential data loss. ```shell # drbdadm create-md You want me to create a v09 style flexible-size internal meta data block. There appears to be a v08 flexible-size internal meta data block already in place on at byte offset Valid v08 meta-data found, convert to v09? [need to type 'yes' to confirm] yes md_offset al_offset bm_offset Found some data ==> This might destroy existing data! <== Do you want to proceed? [need to type 'yes' to confirm] yes Writing meta data... New drbd meta data block successfully created. success ``` -------------------------------- ### Create DRBD Device Metadata Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command initializes DRBD's metadata for a specified resource. It is a crucial step performed only once during initial device creation on both nodes to set up metadata storage for DRBD. ```Shell # drbdadm create-md v09 Magic number not found Writing meta data... initialising activity log NOT initializing bitmap New drbd meta data block successfully created. ``` -------------------------------- ### Checkout Specific DRBD Release Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Navigates into the cloned DRBD directory and checks out a specific release tag. It then updates the submodules to match the checked-out release. ```bash cd drbd git checkout drbd-9.2.3 git submodule update ``` -------------------------------- ### Enable DRBD Proxy systemd service Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Enables and starts the DRBD Proxy socket service using systemd. This allows DRBD Proxy to be managed by systemd and respond to DRBDadm commands. ```bash # systemctl enable --now drbd-proxy.socket ``` -------------------------------- ### Clone DRBD Utilities Repository Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Clones the drbd-utils source code repository recursively. This utility package is essential for managing DRBD and is compatible with various DRBD kernel module versions. ```git git clone --recursive https://github.com/LINBIT/drbd-utils.git ``` -------------------------------- ### Configure DRBD Reactor HA Mount Plugin Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Configures the DRBD Reactor HA mount plugin using a TOML file. This setup ensures that file system mounts are managed by an OCF resource agent, preventing issues with systemd handling of open mount points. ```shell # cat << EOF > /etc/drbd-reactor.d/ha-mount.toml [[promoter]] [promoter.resources.ha-mount] start = [ """ocf:heartbeat:Filesystem fs_test device=/dev/drbd1000 \ directory=/mnt/test fstype=ext4 run_fsck=no""" ] on-drbd-demote-failure = "reboot" EOF ``` -------------------------------- ### Reconfigure DRBD Resources Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Reconfigures operational DRBD resources after changes are made to the configuration files. It synchronizes configurations and applies adjustments using `drbdsetup`. A dry-run option is available. ```bash # drbdadm adjust # drbdadm adjust all # drbdadm -d adjust ``` -------------------------------- ### Show DRBD Performance Statistics Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Displays detailed performance statistics for DRBD volumes and connections. Useful for monitoring and troubleshooting I/O, network, and synchronization metrics. Available via `drbdsetup`. ```bash # drbdsetup status --verbose --statistics # drbdsetup events2 --statistics ``` -------------------------------- ### Configuring O2CB Driver on Debian Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This explains how to configure the O2CB driver on Debian GNU/Linux systems. Unlike SLES, it involves reconfiguring the `ocfs2-tools` package instead of using an init script option. ```bash reconfigure the `ocfs2-tools` package to enable the driver: ``` -------------------------------- ### Get LINSTOR-Created DRBD Resource Name Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command uses `snmpget` to retrieve the name of a LINSTOR-created DRBD resource. LINSTOR resources start from minor number 1000, hence the OID `.1.3.6.1.4.1.23302.1.2.1.2.1000`. ```shell # snmpget -m ALL -v 2c -c public localhost .1.3.6.1.4.1.23302.1.2.1.2.1000 ``` -------------------------------- ### Update and Upgrade Packages on Debian/Ubuntu Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command first updates the package list and then upgrades all installed packages on Debian or Ubuntu systems. It ensures that the system has the latest package information before applying upgrades. ```shell node-2# apt-get update && apt-get upgrade ``` -------------------------------- ### DRBD Network Connection-Mesh Configuration Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This example shows how to configure a DRBD resource with a connection mesh for three hosts: alice, bob, and charlie. It specifies the device, disk, metadata, and network addresses along with node IDs for each host, and defines the mesh connections. ```drbdconf resource r0 { device minor 1; disk "/dev/vg0/lv0"; meta-disk internal; on alice { address 10.1.1.31:7000; node-id 0; } on bob { address 10.1.1.32:7000; node-id 1; } on charlie { address 10.1.1.33:7000; node-id 2; } connection-mesh { hosts alice bob charlie; } } ``` -------------------------------- ### Configuring O2CB Driver on SLES Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This example demonstrates how to configure the O2CB driver on SUSE Linux Enterprise Server (SLES) using the `configure` option of the `o2cb` init script. It prompts the user for settings like loading the driver on boot, cluster name, and various timeout values. ```bash # /etc/init.d/o2cb configure Configuring the O2CB driver. This will configure the on-boot properties of the O2CB driver. The following questions will determine whether the driver is loaded on boot. The current values will be shown in brackets ('[]'). Hitting without typing an answer will keep that current value. Ctrl-C will abort. Load O2CB driver on boot (y/n) [y]: Cluster to start on boot (Enter "none" to clear) [ocfs2]: Specify heartbeat dead threshold (>=7) [31]: Specify network idle timeout in ms (>=5000) [30000]: Specify network keepalive delay in ms (>=1000) [2000]: Specify network reconnect delay in ms (>=2000) [2000]: Use user-space driven heartbeat? (y/n) [n]: Writing O2CB configuration: OK Loading module "configfs": OK Mounting configfs filesystem at /sys/kernel/config: OK Loading module "ocfs2_nodemanager": OK Loading module "ocfs2_dlm": OK Loading module "ocfs2_dlmfs": OK Mounting ocfs2_dlmfs filesystem at /dlm: OK Starting O2CB cluster ocfs2: OK ``` -------------------------------- ### List DRBD Reactor Plugins Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command lists all activated plugins. Use the `--disabled` flag to list disabled plugins instead. ```shell # drbd-reactorctl ls [--disabled] ``` -------------------------------- ### Enable DRBD Resource Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command enables a DRBD resource, associating it with its backing device(s), setting replication parameters, and establishing a connection to its peer. This step is performed on both nodes after metadata creation. ```Shell # drbdadm up ``` -------------------------------- ### Prepare DRBD Metadata and Bring Resource Up (No Sync) Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index These commands are used to create DRBD metadata and bring the resource online without performing an initial full resynchronization. This is suitable for new deployments where data integrity is not yet a concern. Use with caution on existing data. ```bash # drbdadm create-md # drbdadm up ``` -------------------------------- ### Automate LVM Snapshots Before DRBD Synchronization (Shell) Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Configures DRBD resource to automatically create LVM snapshots before synchronization starts and remove them upon successful completion. This prevents data loss if the sync source fails during synchronization. It relies on two shell scripts: `snapshot-resync-target-lvm.sh` and `unsnapshot-resync-target-lvm.sh`. ```shell resource r0 { handlers { before-resync-target "/usr/lib/drbd/snapshot-resync-target-lvm.sh"; after-resync-target "/usr/lib/drbd/unsnapshot-resync-target-lvm.sh"; } } ``` -------------------------------- ### Configure DRBD Reactor Prometheus Plugin Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Sets up the DRBD Reactor Prometheus plugin by creating a TOML configuration file. This plugin exposes DRBD metrics in a Prometheus-compatible format, enabling external monitoring. ```shell # cat << EOF > /etc/drbd-reactor.d/prometheus.toml [[prometheus]] enums = true address = "0.0.0.0:9942" EOF ``` -------------------------------- ### DRBD Global Configuration Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Sets global options for DRBD, including enabling usage statistics. This configuration is typically placed in `/etc/drbd.d/global_common.conf`. ```DRBD Configuration global { usage-count yes; } common { net { protocol C; } } ``` -------------------------------- ### Configure LVM Filter for DRBD Devices (Shell) Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Modifies the LVM configuration file (`/etc/lvm/lvm.conf`) to specify which devices LVM should scan for PV signatures. This example includes all DRBD devices and excludes all others, ensuring LVM only considers DRBD devices. Adjust the filter to match your specific DRBD device naming and setup. ```shell filter = [ "a|drbd.*|", "r|.*|" ] ``` -------------------------------- ### Configure Online Verification in DRBD Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Enables online device verification by specifying a 'verify-alg' in the 'net' section of the resource configuration. Requires synchronization of configuration files and running 'drbdadm adjust'. ```drbd resource net { verify-alg ; } ... } ``` -------------------------------- ### Resize DRBD Backing Block Devices (LVM) Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Extends the backing block devices for DRBD volumes when growing, using LVM as an example. This command should be run on all nodes before resizing the DRBD volume itself. It increases the logical volume size by a specified amount. ```bash # lvextend -L +${additional_gb}g VG/LV ``` -------------------------------- ### Pacemaker Configuration for DRBD-backed MySQL Service Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This snippet demonstrates how to configure Pacemaker resources for a MySQL service using DRBD as the backend storage. It defines a Filesystem resource pointing to the DRBD device, an IP address resource, and the MySQL service itself, then groups them for management within the cluster. The 'auto-promote' feature configured previously simplifies this setup. ```bash crm configure crm(live)configure# primitive fs_mysql ocf:heartbeat:Filesystem \ params device="/dev/drbd/by-res/mysql/0" \ directory="/var/lib/mysql" fstype="ext3" crm(live)configure# primitive ip_mysql ocf:heartbeat:IPaddr2 \ params ip="10.9.42.1" nic="eth0" crm(live)configure# primitive mysqld lsb:mysqld crm(live)configure# group mysql fs_mysql ip_mysql mysqld crm(live)configure# commit crm(live)configure# exit bye ``` -------------------------------- ### One-Shot DRBD Events Monitoring Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Uses the 'drbdsetup events2' command to retrieve a snapshot of the current DRBD events and status. This is suitable for automated monitoring tools that require a single status update. ```bash # drbdsetup events2 --now r0 ``` -------------------------------- ### Display DRBD Reactor Plugin Configuration Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command displays the TOML configuration of a specified plugin configuration file. ```shell # drbd-reactorctl cat ``` -------------------------------- ### Real-time DRBD Events Monitoring Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Continuously monitors DRBD events and status changes by running 'drbdsetup events2' without the '--now' option. This provides real-time updates suitable for active monitoring systems. ```bash # drbdsetup events2 r0 ``` -------------------------------- ### Load New DRBD Kernel Module Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Loads the DRBD kernel module into the system. This command should be executed after successfully unloading the previous module and is a prerequisite for activating the upgraded DRBD version. ```bash # modprobe drbd ``` -------------------------------- ### Create DRBD Metadata on a New Disk Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command initializes the metadata area on a new or replacement hard disk for a DRBD resource. It prepares the disk to be used as backing storage for DRBD, including creating the necessary metadata blocks. ```bash # drbdadm create-md v08 Magic number not found Writing meta data... initialising activity log NOT initializing bitmap New drbd meta data block successfully created. ``` -------------------------------- ### Build DRBD RPMs with 'make rpm' Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This method uses the top-level Makefile to automatically generate spec files and build binary RPM packages. It requires RPM build tools and assumes prerequisites are met. ```bash #!/bin/bash ./configure make rpm ``` -------------------------------- ### Copy DRBD Proxy license file Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Copies the DRBD Proxy license file to the /etc directory on the target machine. This is a required step for DRBD Proxy to function. ```bash # cp drbd-proxy.license /etc/ ``` -------------------------------- ### Trigger DRBD udev Rules for Symlinks Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command manually triggers udev rules to generate symbolic links for DRBD resources. This is necessary on some systems after installing the 'drbd-udev' package or if DRBD resources were created before the udev rules were in place, ensuring correct device naming and accessibility. ```bash udevadm trigger ``` -------------------------------- ### Create Volume Group with DRBD Physical Volume Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command initializes a new LVM Volume Group, incorporating a DRBD device as a Physical Volume. Ensure the DRBD device is already created and configured before executing this command. It's part of the initial setup for using DRBD with LVM. ```bash vgcreate /dev/drbdX ``` -------------------------------- ### Navigate to Kernel Source Directory Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Changes the current directory to the location of the unpacked kernel sources, typically /usr/src/linux or a version-specific subdirectory. ```bash # cd /usr/src/linux ``` -------------------------------- ### Import CRM Configuration into Live Cluster Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Imports a Pacemaker CRM configuration from a specified file into the live cluster configuration. This command is used after defining resources, constraints, and their relationships in a text file. ```bash crm configure < /tmp/crm.txt ``` -------------------------------- ### Upgrade Packages on RHEL/CentOS Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command updates all installed packages on RHEL or CentOS systems to their latest available versions. It is part of the DRBD upgrade process to ensure the latest `drbd-utils` are installed. ```shell node-2# dnf -y upgrade ``` -------------------------------- ### Verify DRBD Kernel Module Version Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Displays the version information for the DRBD kernel module and utilities. This command helps confirm that the newly loaded kernel module is the expected upgraded version. ```bash DRBDADM_BUILDTAG=GIT-hash: [...] build\ by\ buildd@lcy02-amd64-080,\ 2023-03-14\ 10:21:20 DRBDADM_API_VERSION=2 DRBD_KERNEL_VERSION_CODE=0x090202 DRBD_KERNEL_VERSION=9.2.2 DRBDADM_VERSION_CODE=0x091701 DRBDADM_VERSION=9.23.1 ``` -------------------------------- ### Pacemaker CRM Configuration for Right Cluster with Stacked DRBD Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This configuration defines the DRBD resources and IP address for the 'right' Pacemaker cluster, mirroring the setup of the 'left' cluster but with different resource names and IP addresses. It includes primitives for DRBD resources ('right' and 'stacked'), an IP address, and master/slave, colocation, and ordering constraints. ```crmsh primitive p_drbd_right ocf:linbit:drbd \ params drbd_resource="right" primitive p_drbd_stacked ocf:linbit:drbd \ params drbd_resource="stacked" primitive p_ip_stacked_right ocf:heartbeat:IPaddr2 \ params ip="10.9.10.101" nic="eth0" ms ms_drbd_right p_drbd_right \ meta master-max="1" master-node-max="1" \ clone-max="2" clone-node-max="1" \ notify="true" ms ms_drbd_stacked p_drbd_stacked \ meta master-max="1" clone-max="1" \ clone-node-max="1" master-node-max="1" \ notify="true" target-role="Slave" colocation c_drbd_stacked_on_ip_right \ inf: ms_drbd_stacked p_ip_stacked_right colocation c_ip_on_right_master \ inf: p_ip_stacked_right ms_drbd_right:Master order o_ip_before_stacked_right \ inf: p_ip_stacked_right ms_drbd_stacked:start order o_drbd_right_before_stacked_right \ inf: ms_drbd_right:promote ms_drbd_stacked:start ``` -------------------------------- ### Evict DRBD Reactor Promoter Plugin Resource Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command evicts a promoter plugin resource from the current node. Replace `` with the name of the plugin file. ```shell # drbd-reactorctl evict ``` -------------------------------- ### Invoke Online Verification in DRBD Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Initiates an online verification run for a specified resource, peer, and volume. Detects unsynchronized blocks and logs them. Supports resetting bitmaps for resynchronization. ```bash # drbdadm verify :/ # drbdadm invalidate :/volume --reset-bitmap=no # drbdadm invalidate-remote :/volume --reset-bitmap=no # drbdadm disconnect : ## write one block on the primary # drbdadm connect : ``` -------------------------------- ### Configuring HA File System Mount with DRBD Reactor Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This snippet demonstrates the initial steps for setting up a highly available file system mount using DRBD Reactor. It includes commands to make a DRBD resource primary, create a file system on the DRBD device, and then set it back to secondary, allowing DRBD Reactor to manage promotions. ```shell # drbdadm primary ha-mount # mkfs.ext4 /dev/drbd1000 # drbdadm secondary ha-mount ``` -------------------------------- ### Load New DRBD Kernel Module Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command loads the DRBD kernel module into the running system. After unloading the old module and upgrading packages, this step activates the new DRBD 9.x kernel module. ```shell node-2# modprobe drbd ``` -------------------------------- ### Get DRBD Reactor Status Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command displays the status of the DRBD Reactor daemon and its enabled plugins. ```shell # drbd-reactorctl status ``` -------------------------------- ### Enable or Disable DRBD Reactor Plugin Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index These commands enable or disable a specific plugin configuration file. Replace `` with the name of the plugin file. ```shell # drbd-reactorctl enable # drbd-reactorctl disable ``` -------------------------------- ### DRBD Simple Resource Configuration Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Defines a basic DRBD resource named 'r0' for a two-node cluster ('alice' and 'bob'). It specifies the underlying disk device, metadata storage, and network connection details. ```DRBD Configuration resource "r0" { device minor 1; disk "/dev/vg0/lv0"; meta-disk internal; on "alice" { node-id 0; } on "bob" { node-id 1; } connection { host "alice" address 10.1.1.31:7789; host "bob" address 10.1.1.32:7789; } } ``` -------------------------------- ### Automate Online Verification with Cron Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Automates DRBD online verification using cron jobs. A cron entry can be created to run 'drbdadm verify' for a specific resource or all resources on a schedule. ```cron 42 0 * * 0 root /sbin/drbdadm verify 42 0 * * 0 root /sbin/drbdadm verify all ``` -------------------------------- ### Interact with DRBD Proxy Connections via drbd-proxy-ctl (v3) Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Demonstrates how to send commands to `drbd-proxy-ctl` for managing connections, specifically using the `-c` parameter for DRBD Proxy v3. This includes showing human-readable connection information. ```bash drbd-proxy-ctl -c "show hconnections" ``` -------------------------------- ### Clean Kernel Source Tree Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Cleans the kernel source tree by removing old configuration and build artifacts. It's recommended to back up the .config file before running this command. ```bash # make mrproper ``` -------------------------------- ### Create OCFS2 Filesystem (Shell) Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Creates an OCFS2 filesystem on a DRBD device (`/dev/drbd0`). This command initializes the filesystem with two node slots and labels it 'ocfs2_drbd0'. Refer to `mkfs.ocfs2` man page for advanced options. ```Shell # mkfs -t ocfs2 -N 2 -L ocfs2_drbd0 /dev/drbd0 mkfs.ocfs2 1.4.0 Filesystem label=ocfs2_drbd0 Block size=1024 (bits=10) Cluster size=4096 (bits=12) Volume size=205586432 (50192 clusters) (200768 blocks) 7 cluster groups (tail covers 4112 clusters, rest cover 7680 clusters) Journal size=4194304 Initial number of node slots: 2 Creating bitmaps: done Initializing superblock: done Writing system files: done Writing superblock: done Writing backup superblock: 0 block(s) Formatting Journals: done Writing lost+found: done mkfs.ocfs2 successful ``` -------------------------------- ### Promote DRBD Resource to Primary Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Manually promotes a DRBD resource from a secondary role to a primary role. This is essential for making the resource actively writable. The command targets a specific resource. ```bash # drbdadm primary ``` -------------------------------- ### Mount OCFS2 Filesystem Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Demonstrates how to mount an OCFS2 filesystem on a DRBD device. This command is used after successfully configuring the cluster and creating the filesystem. It assumes the DRBD device is `/dev/drbd0` and the mount point is `/shared`. ```bash # mount -t ocfs2 /dev/drbd0 /shared ``` -------------------------------- ### Install DRBD Packages on DEB-based Systems Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Installs DRBD utility and kernel module packages on DEB-based Linux distributions like Debian and Ubuntu using the apt package manager. The kernel module package name is dynamically generated based on the current kernel version. ```bash apt install drbd-utils drbd-module-$(uname -r) ``` -------------------------------- ### Download and Execute LINBIT Node Management Script Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Downloads the LINBIT helper script 'linbit-manage-node.py' from a specified URL and makes it executable. This script is used by LINBIT customers to register cluster nodes and configure access to LINBIT's customer repositories. ```bash # Download the script curl -O https://my.linbit.com/linbit-manage-node.py # Make the script executable chmod +x ./linbit-manage-node.py # To run the script (example): # ./linbit-manage-node.py --register --customer-id ``` -------------------------------- ### Verify Standard MIB Exposure via SNMP Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command queries the SNMP service to verify that a standard MIB, specifically the system description, is exposed. It uses public community string and SNMP version 2c. ```shell # snmpwalk -Os -c public -v 2c localhost iso.3.6.1.2.1.1.1 ``` -------------------------------- ### TLSHD Configuration for DRBD TLS Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This configuration file specifies the paths to TLS certificates and keys required by the `tlshd` utility for authenticating and encrypting DRBD connections. It includes settings for both client and server authentication. ```INI [authenticate.client] x509.certificate=/etc/tlshd.d/tls.crt x509.private_key=/etc/tlshd.d/tls.key x509.truststore=/etc/tlshd.d/ca.crt [authenticate.server] x509.certificate=/etc/tlshd.d/tls.crt x509.private_key=/etc/tlshd.d/tls.key x509.truststore=/etc/tlshd.d/ca.crt ``` -------------------------------- ### Upgrade DRBD Packages (RPM-based) Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Upgrades all installed packages on an RPM-based system, including DRBD, to their latest available versions. This command requires root privileges and non-interactive execution. ```bash # dnf -y upgrade ``` -------------------------------- ### Get DRBD Resource Role Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command retrieves the current role of a DRBD resource. The role indicates whether the resource is acting as primary (read/write access) or secondary (receiving updates). ```bash # drbdadm role Primary ``` -------------------------------- ### Create DRBD Metadata (Forced) Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command creates DRBD metadata for one or more resources, forcefully bypassing interactive prompts. It allows specifying the maximum number of peers and includes a `--force` flag to skip confirmation steps. Use with extreme caution due to potential data loss. ```shell drbdadm -v --max-peers= -- --force create-md ``` -------------------------------- ### Restart DRBD Reactor Plugins or Daemon Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command restarts specified plugins or the entire DRBD Reactor daemon if no plugins are specified. Replace `` with the name of the plugin file to restart specific plugins. ```shell # drbd-reactorctl restart [] ``` -------------------------------- ### Build DRBD RPMs with 'rpmbuild' and custom spec file Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This flexible approach allows customization of spec files before building RPMs. It involves enabling spec file generation with configure, creating a tarball, copying it to the RPM source directory, and then using 'rpmbuild'. ```bash #!/bin/bash ./configure --enable-spec make tgz cp drbd*.tar.gz $(rpm -E %sourcedir) rpmbuild -bb drbd.spec ``` -------------------------------- ### Get Basic DRBD Resource Status Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Retrieves the current status of DRBD resources, indicating roles, disk states, and connection states for each node. This command provides a high-level overview. ```bash # drbdadm status home ``` -------------------------------- ### Enable DRBD Resources Manually Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Manually enables DRBD resources. This command can be used for individual resources or all configured resources simultaneously. Typically, cluster management applications or systemd units handle automatic enabling. ```bash # drbdadm up # drbdadm up all ``` -------------------------------- ### DRBD: Resize Online Resource Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command is used to resize a DRBD resource when its backing block devices can be grown online and the resource is in the 'Connected' state. It triggers a synchronization of the new section from the primary to the secondary node. ```bash # drbdadm resize ``` -------------------------------- ### DRBD: Create New Metadata Area (Internal Metadata) Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command re-initializes the metadata area on a DRBD device. It is used after growing the backing block device and before re-importing adjusted metadata when using internal metadata. ```bash # drbdadm create-md ``` -------------------------------- ### Upgrade DRBD Packages (DEB-based) Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Updates the package list and upgrades all installed packages on a DEB-based system, including DRBD, to their latest available versions. This command requires root privileges and non-interactive execution. ```bash # apt update && apt -y upgrade ``` -------------------------------- ### Promoter Plugin Configuration: Basic DRBD Resource Management Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This configuration snippet defines how the DRBD Reactor promoter plugin manages a specific DRBD resource. It specifies dependencies, actions on demotion failure, and preferred nodes for promotion. This requires a TOML parser to interpret. ```toml [[promoter]] [promoter.resources.my_drbd_resource] dependencies-as = "Requires" target-as = "Requires" start = ["path-to-my-file-system-mount.mount", "foo.service"] on-drbd-demote-failure = "reboot" secondary-force = true preferred-nodes = ["nodeA", "nodeB"] ``` -------------------------------- ### Get DRBD Disk State Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index This command displays the current disk state for a DRBD resource. The disk state indicates the consistency and availability of the data on the local block device, such as UpToDate, Inconsistent, or Diskless. ```bash # drbdadm dstate UpToDate ``` -------------------------------- ### DRBD Resource Configuration for Automatic Recovery Source: https://linbit.com/drbd-user-guide/drbd-guide-9_0-en/index Example configuration within a DRBD resource file to enable automatic recovery for a primary node that loses quorum and has suspended I/O operations. This involves setting `rr-conflict` and `on-suspended-primary-outdated` options. ```drbd.conf resource { net { rr-conflict retry-connect; } options { quorum majority; # or explicit value on-no-quorum suspend-io; on-no-data-accessible suspend-io; on-suspended-primary-outdated force-secondary; } } ```