Collapse AllExpand All

Configure DRBD

High Availability
High Availability
This section is for Eucalyptus HA. If you are not using HA, skip this section.
Before you begin, ensure that you have the following information:
  • The IP address and hostname of each Walrus
  • The DRBD block device name of each Walrus. In the following examples, we assume that DRBD block device name is /dev/drbd1.
  • The DRBD backing disk partition names on each Walrus. A partition (either on a new disk or an existing disk) should be dedicated to Walrus. The partition sizes should be identical.
Tip
Tip
Consider backing the DRBD resource with a logical volume using LVM, this will make growing the backing store easier in the future if you are running low on disk space.
Configuring DRBD requires that you edit the Eucalyptus DRBD file to include your Walrus information, and edit the master DRBD file to tell it to look for the Eucalyptus DRBD file.
To configure DRBD:

  1. Log in to the primary Walrus.
  2. Load the DRBD module
    modprobe drbd
    There is no output from this command.
  3. Copy the example Eucalyptus DRBD file (/etc/eucalyptus/drbd.conf.example) to /etc/eucalyptus/drbd.conf.
  4. Open the /etc/eucalyptus/drbd.conf file and make the following edits:
    • Change the value of <walrus-host-1> to the hostname (output of `uname -n`) of the primary Walrus.
    • Change the value of <drbd-block-dev, e.g., /dev/drbd1> to /dev/drbd1
    • Change the value of <drbd-backing-disk-dev, e.g. /dev/sdb1> to /dev/sdb1
    • Change the value of <walrus-host-1-ip> to the IP address of the primary Walrus.
    • Change the value of <walrus-host-2> to the hostname (output of `uname -n`) of the secondary Walrus.
    • Change the value of <drbd-block-dev, e.g., /dev/drbd1> to /dev/drbd1
    • Change the value of <drbd-backing-disk-dev, e.g. /dev/sdb1> to /dev/sdb1
    • Change the value of <walrus-host-2-ip> to the IP address of the secondary Walrus.
    The file should look like the following example:
    common {
      protocol C;
    }
    
    resource r0 {
      
      on walrus00.eucalyptus.com {
        device    /dev/drbd1;
        disk      /dev/sdb1;
        address   192.168.58.1:7789;
        meta-disk internal;
      }
    
      on walrus01.eucalyptus.com {
        device    /dev/drbd1;
        disk      /dev/sdb1;
        address   192.168.58.2:7789;
        meta-disk internal;
      }
    
      syncer {
        rate 40M;
      }
    
      net {
        after-sb-0pri discard-zero-changes;
        after-sb-1pri discard-secondary;
      }
    }
    Important
    Important
    On RHEL 6 and Ubuntu, remove the common section (common { protocol C; }). The configuration in these distributions already include a common section.
  5. Save and close the file.
  6. Open the master DRBD file (/etc/drbd.conf) and append the following line:
    include "/etc/eucalyptus/drbd.conf";
    Important
    Important
    For Ubuntu, you must also remove the common section (common { protocol C; }) and the line include "drbd.d/*.res";.
  7. Save and close the file.
  8. On both primary and secondary Walrus, open the file /etc/fstab and append the following line for the DRBD resource to allow the eucalyptus user to mount and unmount the device:
    /dev/drbd1 /var/lib/eucalyptus/bukkits ext3 noauto,owner 0 0
  9. Save and close the file.
  10. Open the /etc/eucalyptus/eucalyptus.conf file and make the following configuration:
    CLOUD_OPTS="-Dwalrus.storage.manager=DRBDStorageManager"
  11. Copy the /etc/drbd.conf, the /etc/eucalyptus/drbd.conf, and the /etc/eucalyptus/eucalyptus.conf files to the secondary Walrus server.
  12. Restart Walrus, first on the primary, and then on the secondary. Restarting the primary Walrus will trigger an HA failover to the secondary, and restarting the secondary will fail back, preparing the entire system for the next steps.
    service eucalyptus-cloud restart
  13. Monitor the failover with euca-describe-services. If successful, stop the eucalyptus-cloud service again on both Walruses whilst you configure the DRBD device.
    service eucalyptus-cloud stop
  14. On the primary Walrus, associate the DRBD block device (/dev/drbd1) with the disk partition allocated for Walrus (/dev/sdb1).
    drbdmeta --force /dev/drbd1 v08 /dev/sdb1 internal create-md
    drbdadm up r0
    Important
    Important
    Repeat this step on the secondary Walrus.
  15. Set up the DRBD block device on the primary Walrus:
    Tip
    Tip
    With a large DRBD device, the initial synchronization can take a considerable amount of time. Consult Skipping Initial Device Synchronization for instructions on how to skip the synchronization.
    drbdsetup /dev/drbd1 syncer -r 110M
    drbdadm -- --overwrite-data-of-peer primary r0
  16. On the primary Walrus only, run the following command to indicate whether the data on the DRBD primary and secondary is consistent:
    drbdadm dstate r0
    Wait for the output to display UpToDate/UpToDate, then continue to the next step.
    Tip
    Tip
    To view the synchronization process in near-realtime, run watch -n 2 cat /proc/drbd.
  17. On the primary Walrus, create a filesystem on /dev/drbd1. Eucalyptus supports ext3 or ext4. For example:
    mkfs.ext3 /dev/drbd1
  18. With the DRBD device now configured, start the eucalyptus-cloud service on both Walruses.
    service eucalyptus-cloud start
  19. On the primary CLC, tell Eucalyptus to use DRBD parameters configured in the DRBD config file so Walrus can write to the correct device:
    euca-modify-property -p walrus.blockdevice=/dev/drbd1
    euca-modify-property -p walrus.resource=r0