DRBD 8.4 on Debian Jessie
From www.linbit.com:
"The Distributed Replicated Block Device (DRBD) is a software-based, shared-nothing, replicated storage solution mirroring the content of block devices (hard disks, partitions, logical volumes etc.) between hosts.
DRBD mirrors data
- in real time. Replication occurs continuously while applications modify the data on the device.
- transparently. Applications need not be aware that the data is stored on multiple hosts.
-
synchronously or asynchronously. With synchronous mirroring, applications
are notified of write completions after the writes have been carried out on
all hosts. With asynchronous mirroring, applications are notified of write
completions when the writes have completed locally, which usually is before
they have propagated to the other hosts."
Lets go and prepare two nodes d01 and d02
During linux nodes installation we must setup IP, hostame and domain name.d01.xxx.local 192.168.50.131
d02.xxx.local 192.168.50.132
Install on both nodes:
#apt-get install ntpdate#service ntp restart
# apt-get install drbd8-utils
# modprobe drbd
Test:
# lsmod | grep drbddrbd 193312 0
lru_cache 5042 1 drbd
cn 4563 1 drbd
Clear config and configure on both nodes:
# :> /etc/drbd.conf# nano /etc/drbd.conf
global { usage-count no; }
common {
disk {
on-io-error detach;
no-disk-flushes;
no-disk-barrier;
c-plan-ahead 10;
c-fill-target 24M;
c-min-rate 10M;
c-max-rate 700M;
}
}
resource r0 {
protocol C;
startup {
wfc-timeout 15;
degr-wfc-timeout 60;
}
net {
max-buffers 36k;
sndbuf-size 1024k ;
rcvbuf-size 2048k;
# cram-hmac-alg sha1;
# shared-secret "enteryoursharedsecret";
}
on d01 { #important - dont use domain name here only short hostname
device /dev/drbd0;
disk /dev/sdb1;
address 192.168.50.131:7788;
meta-disk internal;
}
on d02 { #important - dont use domain name here only short hostname
device /dev/drbd0;
disk /dev/sdb1;
address 192.168.50.132:7788;
meta-disk internal;
}
}
Enable resourceon both nodes
# /etc/init.d/drbd start# drbdadm create-md r0
# drbdadm up r0
Setup primary node
# drbdadm primary --force r0Check sync
# watch cat /proc/drbdAfter full sync make fs and mount it to directory
# mkfs.ext3 /dev/drbd0# mkdir /data
# mount /dev/drbd0 /data
Test if is mounted
# df -hudev 2,0G 0 2,0G 0% /dev
tmpfs 396M 5,5M 391M 2% /run
/dev/sda1 12G 1006M 11G 9% /
tmpfs 2,0G 0 2,0G 0% /dev/shm
tmpfs 5,0M 0 5,0M 0% /run/lock
tmpfs 2,0G 0 2,0G 0% /sys/fs/cgroup
tmpfs 396M 0 396M 0% /run/user/1000
/dev/drbd0 243G 61M 230G 1% /data
TEST after failure
Create some fileson d01
# touch /data/alfa.txt
#touch /data/beta.txt
unmount it and promote d01 to secondary
#umount /data
# drbdadm secondary r0
promote d02 to primary and mount data
on d02:
# drbdadm primary r0
# mkdir /data
# mount /dev/drbd0 /data
Now you should see your files here
# ls /data
alfa.txt beta.txt lost+found
THATS ALL :)
Komentarze
Prześlij komentarz