DRBD is a distributed storage system in the storage layer of the Linux kernel. Now we need to share Block devices between two Linux servers as clusters. Here we choose drbd. (Iscsi also works)
Host Name IP address system environment
Node1 192.168.1.50redhat 6.3
Node2 192.168.1.51redhat 6.3
Preparations before configuration
1. Download the installation package
Http://oss.linbit.com/drbd/
Here my version is: drbd-8.4.3.tar.gz
2. Set hostname
Vim/etc/hosts
Node1 192.168.1.50
Node2 192.168.1.51
3. Disk Planning
Here we 'd better use two partitions of the same size on the two nodes (Note: Do not format the partition after splitting !)
1. Now we can deploy DRBD:
In the previous package, the following error was reported due to kernel and version mismatch:
Can not load the drbd module.
So here we use the compilation method to generate the rpm package and then install it:
Tar xvf drbd-8.4.3.tar.gz
Cd drbd-8.4.3
Mkdir-p ~ /Rpmbuild/{BUILD, BUILDROOT, RPMS, SOURCES, SPECS, SRPMS}
./Configure
Make rpm
Make km-rpm
Find the package we just generated and install it:
Cd ~ /Rpmbuild/RPMS/x86_64/
Rpm-ivh drbd-*. rpm
2. Check whether DRBD is successfully installed.
Modprobe drbd
Lsmode | grep drbd
Drbd xxxxx x is successfully installed.
Iii. drbd Configuration
By default, the configuration file/etc/drbd. conf is run. Here, the configuration file is under/etc/drbd. d/global_common.conf. We will configure it below:
Vim/etc/drbd. d/global_common.conf
Global {
Usage-count no;
}
Common {
Syncer {rate 100 M ;}
}
Resource r0 {
Protocol C;
Handlers {
Pri-on-incon-degr "/usr/lib/drbd/notify-pri-on-incon-degr.sh;/usr/lib/drbd/notify-emergency-reboot.sh; echo B>/proc/sysrq-trigger; reboot-f ";
Pri-lost-after-sb "/usr/lib/drbd/notify-pri-lost-after-sb.sh;/usr/lib/drbd/notify-emergency-reboot.sh; echo B>/proc/sysrq-trigger; reboot-f ";
Local-io-error "/usr/lib/drbd/notify-io-error.sh;/usr/lib/drbd/notify-emergency-shutdown.sh; echo o>/proc/sysrq-trigger; halt-f ";
Fence-peer "/usr/lib/drbd/crm-fence-peer.sh ";
Out-of-sync "/usr/lib/drbd/notify-out-of-sync.sh root ";
}
Startup {
Wfc-timeout 120;
Degr-wfc-timeout 120;
}
Options {
# Cpu-mask on-no-data-accessible
}
Disk {
On-io-error detach;
Fencing resource-only;
}
Net {
Cram-hmac-alg "sha1 ";
Shared-secret "FooFunFactory ";
}
Device/dev/drbd0;
On node1 {
Disk/dev/sdb1;
Address 192.168.1.50: 7788;
Meta-disk internal;
}
On node2 {
Disk/dev/sdb1;
Address 192.168.1.51: 7788;
Meta-disk internal;
}
}
The parameters here are not described in detail.
In the same way, the generated configuration file is scp to node2.