DRBD

From Alessandro's Wiki
Revision as of 13:03, 8 May 2012 by Xunil (talk | contribs) (Created page with " = fedora = ln -sf /lib/systemd/system/runlevel3.target /etc/systemd/system/default.target yum -y groupinstall Clustering yum -y groupinstall “Cluster Storage” yum -y o...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

fedora

ln -sf /lib/systemd/system/runlevel3.target /etc/systemd/system/default.target


yum -y groupinstall Clustering yum -y groupinstall “Cluster Storage” yum -y openssh-server chkconfig sshd on

  1. disabled firewall (for testing)

chkconfig iptables off

  1. disable selinux (for testing)

setenforce 0 (and also in /etc/selinux/config )

net

/etc/hosts 192.168.55.1 hostsrv 192.168.55.101 virtualb02 192.168.55.102 virtualb01

DRBD

  • using official howto:

http://www.drbd.org/users-guide-8.3/ch-admin.html

install

  • version 8.3.11
yum install drbd
  • disk

/dev/sdb1 2048 2097151 1047552 83 Linux


config

/etc/drdb.d/
/etc/drdb.d/r0.res

global {

 usage-count yes;

} common {

 protocol C;

} resource r0 {

 on virtualb01 {
   device    /dev/drbd1;
   disk      /dev/sdb1;
   address   192.168.55.102:7789;
   meta-disk internal;
 }
 on virtualb02 {
   device    /dev/drbd1;
   disk      /dev/sdb1;
   address   192.168.55.101:7789;
   meta-disk internal;
 }

}


resource r0 {

 device    /dev/drbd1;
 disk      /dev/sdb1;
 meta-disk internal;
 on virtualb01 {
   address   192.168.55.102:7789;
 }
 on virtualb02 {
   address   192.168.55.101:7789;
 }

}

common (changes for dual-primary mode)


startup {

              become-primary-on both;

net {

               allow-two-primaries;
  • split brain (and its policies):
 handlers {
   split-brain "/usr/lib/drbd/notify-split-brain.sh root";

net {

               after-sb-0pri discard-zero-changes;
               after-sb-1pri discard-secondary;
               after-sb-2pri disconnect;

-- meaning sequentially: [ If there is any host on which no changes occurred at all, simply apply all modifications made on the other and continue.] [ Whichever host is currently in the Secondary role, make that host the split brain victim.]

  • limiting speed?
 syncer {
   rate 16M;
  • verification: (needed ?)
 syncer {
   verify-alg sha1;
 }
  • checksum ?
 syncer {
   csums-alg sha1;
  • error handling: (recommended)
 disk {
   on-io-error detach;
  • replication traffic integrity:
 net {
   data-integrity-alg sha1
  • disk flushes
    • replicated data set
 disk {
   no-disk-flushes;
    • DRBD's meta data
 disk {
   no-md-flushes;

+++++++++++++++++

drbdadm verify resource

  • possible scheduling from crond

42 0 * * 0 root /sbin/drbdadm verify resource


  • network:

ports 7788-7799

first start

[root@virtualb01 ~]# drbdadm create-md r0 Writing meta data... initializing activity log NOT initialized bitmap New drbd meta data block successfully created. success


quick commands

drbd-overview # Checking DRBD status watch cat /proc/drbd # same, but old school way.. drbdadm up resource drbdadm primary resource # promote node drbdadm disconnect resource drbdadm connect resource drbdadm verify resource drbdadm dump-md resource > /tmp/metadata # backing up metadata drbdsetup /dev/drbd1 syncer -r 110M # changing speed at runtime drbdadm adjust resource # revert to startup setting drbdadm resize resource drbdadm -- --size=new-size resize resource # shrink (online)

remarks

You’ll want these settings:

disk {

       fencing resource-and-stonith;

} handlers {

       # Make sure the other node is confirmed
       # dead after this!
       outdate-peer "/sbin/kill-other-node.sh";

}


GFS

just notes

[root@virtualb01 ~]# drbdadm create-md r0 Writing meta data... initializing activity log NOT initialized bitmap New drbd meta data block successfully created. success [root@virtualb01 ~]# drbdadm attach r0 [root@virtualb01 ~]# drbdadm syncer r0 [root@virtualb01 ~]#


--- The server's response is:

node already registered Writing meta data... initializing activity log NOT initialized bitmap New drbd meta data block successfully created. success [root@virtualb02 ~]# drbdadm attach r0 [root@virtualb02 ~]# drbdadm syncer r0 [root@virtualb02 ~]# drbdadm connect r0 1: Failure: (125) Device has a net-config (use disconnect first) Command 'drbdsetup 1 net ipv4:192.168.55.101:7789 ipv4:192.168.55.102:7789 C --set-defaults --create-device --after-sb-2pri=disconnect --after-sb-1pri=discard-secondary --after-sb-0pri=discard-zero-changes --allow-two-primaries' terminated with exit code 10 [root@virtualb02 ~]#



[root@virtualb01 ~]# cat /proc/drbd version: 8.3.11 (api:88/proto:86-96) srcversion: 21CA73FE6D7D9C67B0C6AB2

1: cs:SyncTarget ro:Primary/Primary ds:Inconsistent/UpToDate C r-----
   ns:0 nr:24148 dw:23552 dr:76 al:0 bm:1 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:1023932

[>....................] sync'ed: 2.8% (1023932/1047484)K finish: 0:13:00 speed: 1,308 (1,308) want: 250 K/sec [root@virtualb01 ~]#


[root@virtualb02 ~]# cat /proc/drbd version: 8.3.11 (api:88/proto:86-96) srcversion: 21CA73FE6D7D9C67B0C6AB2

1: cs:SyncSource ro:Primary/Primary ds:UpToDate/Inconsistent C r-----
   ns:20308 nr:0 dw:0 dr:20980 al:0 bm:1 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:1027772

[>....................] sync'ed: 2.4% (1027772/1047484)K finish: 0:12:50 speed: 1,312 (1,312) K/sec

    1. resource devices #################

[root@virtualb02 ~]# ls -Rl /dev/drbd /dev/drbd: total 0 drwxr-xr-x 2 root root 60 May 8 14:28 by-disk drwxr-xr-x 2 root root 60 May 8 14:28 by-res

/dev/drbd/by-disk: total 0 lrwxrwxrwx 1 root root 11 May 8 14:28 sdb1 -> ../../drbd1

/dev/drbd/by-res: total 0 lrwxrwxrwx 1 root root 11 May 8 14:28 r0 -> ../../drbd1

++++++++++++++++++++++

[root@virtualb01 ~]# ls -Rl /dev/drbd /dev/drbd: total 0 drwxr-xr-x 2 root root 60 May 8 14:28 by-disk drwxr-xr-x 2 root root 60 May 8 14:28 by-res

/dev/drbd/by-disk: total 0 lrwxrwxrwx 1 root root 11 May 8 14:28 sdb1 -> ../../drbd1

/dev/drbd/by-res: total 0 lrwxrwxrwx 1 root root 11 May 8 14:28 r0 -> ../../drbd1