Skip to content

Instantly share code, notes, and snippets.

@zhouyuan
Last active July 6, 2016 00:54
Show Gist options
  • Save zhouyuan/f47767eb6f79e6426ac010086e7320be to your computer and use it in GitHub Desktop.
Save zhouyuan/f47767eb6f79e6426ac010086e7320be to your computer and use it in GitHub Desktop.

#DRBD(distributed replication block deivce kernel module) 8.4.4 was shiped with Ubuntu 14.04 defautly.

  • install drbd on both nodes apt-get update; apt-get install drbd8-utils

  • load kernel module modprobe drbd

  • create disk resource


cat /etc/drbd.d/disk1.res
resource disk1
{
   startup {
   wfc-timeout 30;
   outdated-wfc-timeout 20;
   degr-wfc-timeout 30;
 }

net {
   cram-hmac-alg sha1;
   shared-secret sync_disk;
 }

syncer {
   rate 200M;
   verify-alg sha1;
 }

on ctc {               # Node1 defined
   device /dev/drbd0;
   disk /dev/sde;                    # Device to use with DRBD
   address 10.44.44.7:7789;       # IP Address and port of Node1
   meta-disk internal;
 }

on ctd {               # Node2 defined
   device /dev/drbd0;
   disk /dev/sdb;                    # Device to use with DRBD
   address 10.44.44.152:7789;       # IP Address and port of Node2
   meta-disk internal;
 }
}
  • create metadata on both nodes drbdadm create-md disk1

  • start drbd daemon on both nodes /etc/init.d/drbd start

  • set the primary copy drbdadm -- --overwrite-data-of-peer primary all

  • check drbd status by default the drbd will sync the primay disk to replica disk now the block device will be at /dev/drbd0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment