1 Linux disk configuration 1The Linux machine should betterhas second disk, because we don’t want to sync the system partition. 2 The partition DRBD used to syncshould have same size. 3The partition DRBD used must benot mounted arbitrarily, because we need to mount the logical device of DRBDnot the physical disk. 2 Build the DRBD
This step will build the RPM package fromsource code. It requires that the CPP compiler is installed on the machine. 1Download the source code.tar.gz from http://oss.linbit.com/drbd/,or if the Linux machine can connect to the internet, use “wget” down the sourcecode “wget http://oss.linbit.com/drbd/8.3/drbd-8.3.10.tar.gz”,
####################################################
[iyunv@rh56 etc]# wget http://oss.linbit.com/drbd/8.3/drbd-8.3.10.tar.gz
--2011-06-22 23:35:39-- http://oss.linbit.com/drbd/8.3/drbd-8.3.10.tar.gz
Resolving oss.linbit.com... 212.69.161.111
Connecting to oss.linbit.com|212.69.161.111|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 521798 (510K) [application/x-gzip]
Saving to: `drbd-8.3.10.tar.gz'
100%[========================================================================================================================================>] 521,798 51.7K/s in 14s
2Extract the source package, goto the extraction dir, execute “./configure”.
####################################################
[iyunv@rh56 drbd-8.3.10]# ./config
-bash: ./config: No such file or directory
[iyunv@rh56 drbd-8.3.10]# ./config
config.status configure
[iyunv@rh56 drbd-8.3.10]# ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether ln -s works... yes
checking for sed... /bin/sed
checking for grep... /bin/grep
checking for flex... /usr/bin/flex
checking for rpmbuild... /usr/bin/rpmbuild
checking for xsltproc... /usr/bin/xsltproc
checking for tar... /bin/tar
checking for git... no
checking for dpkg-buildpackage... no
checking for udevadm... false
checking for udevinfo... /usr/bin/udevinfo
configure: WARNING: No dpkg-buildpackage found, building Debian packages is disabled.
configure: WARNING: Cannot update buildtag without git. You may safely ignore this warning when building from a tarball.
checking for /etc/gentoo-release... no
checking for /etc/redhat-release... yes
checking for /etc/slackware-version... no
checking for /etc/debian_version... no
checking for /etc/SuSE-release... no
configure: configured for Red Hat (includes Fedora, RHEL, CentOS).
checking for /etc/fedora-release... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating user/Makefile
config.status: creating scripts/Makefile
config.status: creating documentation/Makefile
config.status: creating user/config.h
config.status: user/config.h is unchanged
[iyunv@rh56 drbd-8.3.10]#
#########################################################
3Execute “make rpm” and “makekm-rpm” if the configuration is successful.
######################not full log############################
You have now:
/usr/src/redhat/RPMS/i386/drbd-utils-8.3.10-1.i386.rpm
/usr/src/redhat/RPMS/i386/drbd-debuginfo-8.3.10-1.i386.rpm
/usr/src/redhat/RPMS/i386/drbd-bash-completion-8.3.10-1.i386.rpm
/usr/src/redhat/RPMS/i386/drbd-8.3.10-1.i386.rpm
/usr/src/redhat/RPMS/i386/drbd-xen-8.3.10-1.i386.rpm
/usr/src/redhat/RPMS/i386/drbd-heartbeat-8.3.10-1.i386.rpm
/usr/src/redhat/RPMS/i386/drbd-pacemaker-8.3.10-1.i386.rpm
/usr/src/redhat/RPMS/i386/drbd-km-debuginfo-8.3.10-1.i386.rpm
/usr/src/redhat/RPMS/i386/drbd-km-2.6.18_238.el5-8.3.10-1.i386.rpm
/usr/src/redhat/RPMS/i386/drbd-udev-8.3.10-1.i386.rpm
[iyunv@rh56 drbd-8.3.10]#
#########################################################
4Go to the /usr/src/redhat/RPMS/i386dir, execute “rpm –i all” to install all rpm packages. 5Edit the DRBD configurationfile, /etc/drbd.conf to following,
global { usage-count yes; }
common { syncer { rate 100M; } }
resource r0 {
protocol A;
net {
cram-hmac-alg sha1;
shared-secret"cedrdb";
}
on rh56 {
device /dev/drbd1; # the logical device, whichDRBD used
disk /dev/sdb1;# the physical disk
address 192.168.70.253:7789;
meta-disk internal;
}
on cerh564 {
device /dev/drbd1;
disk /dev/sdb1;
address 192.168.70.251:7789;
meta-disk internal;
}
}
6Do the same thing on anothermachine. 3 Start the DRBD and test 1Execute “drbdadm create-md r0”to create the resource. 2 Execute “/etc/init.d/drbd start”to start the drbd. 3“drbdadm -- --overwrite-data-of-peer primary r0”to change the machine to the primary machine. 4 “mount /dev/drbd1 /drbdtest” tomount the DRBD device. 5Execute “cat /proc/drbd” tooverview the status of the DRBD. 6“drbdadm secondary r0” willchange the node to secondary, this command must executed after umount the/dev/drbd1. 7Make some file to dir /drbdteston the primary node, then change the secondary node to primary, and mount the/dev/drbd1, you will find the file created on the primary node is on thesecondary node already. 8Note on the first time DRBDstart, it will spend some time to sync the whole disk partition.