http://www.drbd.org/docs/about/
http://oss.linbit.com/drbd/
Installing DRBD
# wget http://oss.linbit.com/drbd/8.4/drbd-8.4.3.tar.gz
# tar ZXVF drbd-8.4.3.tar.gz
# CD drbd-8.4.3
#./configure--PREFIX=/USR/LOCAL/DRBD--with-km
# Make kdir=/usr/src/kernels/2.6.32-279.el6.x86_64/
Yum-y Install Kernel-devel Kernel-headers Flex
Note: Installation kernel-devel must be consistent with the kernel version that you uname-r see, it is recommended that Kernel-devel be installed with a local source and not installed with a network source
[Email protected] soft]# tar zxf drbd-8.4.3.tar.gz
[Email protected] soft]# CD drbd-8.4.3
[Email protected] drbd-8.4.3]#/configure--PREFIX=/USR/LOCAL/DRBD--with-km
Note:--with-km is enabled for kernel modules
[email protected] ~]# make kdir=/usr/src/kernels/2.6.32-358.el6.i686
Note the path of the Kdir (this kernel source path needs to be modified according to its own system)
[[email protected] drbd-8.4.3]# make install
[Email protected] ~]# mkdir-p/USR/LOCAL/DRBD/VAR/RUN/DRBD
[Email protected] ~]# cp/usr/local/drbd/etc/rc.d/init.d/drbd/etc/rc.d/init.d/
[Email protected] ~]# chkconfig--add DRBD
[[email protected] ~]# chkconfig DRBD on
Installing the DRBD module
Go back to the directory where you just unzipped the DRBD and
[[Email protected] drbd-8.4.3]# CD DRBD
[[email protected] drbd]# make clean
[[Email protected]]# make kdir=/usr/src/kernels/2.6.32-358.el6.i686
[[email protected] drbd]# cp drbd.ko/lib/modules/' uname-r '/kernel/lib/
[Email protected] drbd]# modprobe DRBD
To see if the module was loaded successfully
[Email protected] drbd]# Lsmod | grep DRBD
DRBD 292307 0
First look at the kernel version of the system
# uname-r (current version)
2.6.32-279.el6.x86_64
The following is an example of installing the DRBD module
After the DRBD module is properly installed, load with modprobe
# modprobe DRBD
Fatal:module DRBD not found.
Appears as above error
Cause: This is because the system default kernel does not support this module, so you need to update the kernel
Ways to update the kernel:
Can be updated with yum install kernel* mode.
If you want to save some time, you can only update a few packages:
Kernel-devel
Kernel
Kernel-headers
After the update, remember to restart the operating system!!!
# Depmod
Description: After compiling and preparing a Linux kernel load module, the command depmod must be executed before modprobe, which generates a new MODULES.DEP.
[Email protected] ~]# Depmod
[Email protected] ~]# modprobe DRBD
[Email protected] ~]# Lsmod|grep DRBD
DRBD 325786 0
LIBCRC32C 1246 1 DRBD
Edit a text
[Email protected] ~]# vi/etc/drbd.conf
Resource r0{
Protocol C;
startup {Wfc-timeout 0; degr-wfc-timeout 120;}
disk {On-io-error detach;}
net{
Timeout 60;
Connect-int 10;
Ping-int 10;
Max-buffers 2048;
Max-epoch-size 2048;
}
syncer {rate 30M;}
On bd1{
device/dev/drbd0;
DISK/DEV/SDB1;
Address 172.16.2.1:7788;
Meta-disk internal;
}
On bd2{
device/dev/drbd0;
DISK/DEV/SDB1;
Address 172.16.2.2:7788;
Meta-disk internal;
}
}
Creating partitions
# FDISK/DEV/SDB
----------------
N-p-1-1-"+1G"-W
----------------
# Mkdir/data
Create a DRBD device and activate the RO resource : (primary,secondary)
# Mknod/dev/drbd0 B 147 0
# Drbdadm CREATE-MD R0
Wait a moment, show success indicates that the DRBD block was created successfully
--== Thank-participating in the Global Usage survey ==--
The server ' s response is:
You is the 19411th user to install this version
No Resources defined!
Because the distribution error should be in the following position, not/etc/drbd.conf
[Email protected] ~]# vi/usr/local/drbd/etc/drbd.conf
[Email protected] ~]# Drbdadm CREATE-MD r0
Writing Meta Data ...
Initializing activity log
Not initializing bitmap
New DRBD Meta data block successfully created.
Success