Configuring DRBD under Linux

Source: Internet
Author: User



Today, the construction of DRBD, in order to review the convenience, but also want to help the people who need, so the document, share to everyone.

My system is CentOS6.7 version

Drbd

1. Add HDD after reboot

Cat/pro/parttions

Partition

Fdisk/dev/sdb

Partprobe/dev/sdb reloading the file system

cat/pro/parttions can see sdb1

2. load yum source

Yum Clean All

Yum Repolist

3. Synchronization Time

Ntpdate-u asia.pool.ntp.org Note: I was in sync before yum clean all succeeded.

4. start the package, ready to compile and install

Yum install gcc gcc-c++ make glibc flex kernel kernel-devel kernel-headers after the package because there is a kernel so restart the server

5. download the drbd

wget http://oss.linbit.com/drbd/8.4/drbd-8.4.3.tar.gz

Tar XF drbd-. tar.gz Decompression

CD drbd-8.4.3

6. Compiling the installation

./configure –prefix=/usr/local/drbd –with-km specified path

Make kdir=/usr/src/kernels/2.6.32- ... ./    compile to give the kernel path

Make Install build installation

Mkdir-p/USR/LOCAL/DRBD/VAR/RUN/DRBD

CP/USR/LOCAL/DTBD/ETC/RC.D/INIT.D/DRBD/ETC/RC.D/INIT.D Copy the startup file from DRBD to the native boot file so that it can be powered on

Chkconfg –add DRBD adds drbd to the boot entry

Chkconfig DRBD on let drbd start

modprobe DRBD Reload the drbd module

Lsmod |grep drbd View

7. Configure DRBD

Vim/usr/local/drbd/etc/drbd.conf

Resource r0{

Protocol C;

startup {Wfc-timeout 0; degr-wfc-timeout 120;}

NET {

Timeout 60;

Connect-int 10;

Ping-int 10;

Max-buffers 2048;

Max-epoch-size 2048;

}

syncer {rate 30M;}

On DRBD1 {

device/dev/drbd0;

DISK/DEV/SDB1;

Address 192.168.122.101:7788;

Meta-disk internal;

}

on drbd2 {

device/dev/drbd0;

DISK/DEV/SDB1;

Address 192.168.122.101:7788;

Meta-disk internal; }

}

8. Create a block device

MKNOD/DEV/DRBD0 B 147 0

9. Activate

Drbdadm CREATE-MD R0

Drbdadm CREATE-MD R0

Kai Service

Service DRBD Start

CAT/PROC/DRBD or service DRBD status see DRBD State if there is no error in the configuration file, the services status will show that it is connected and is Secondary Status

One . Setting up a master device

DRBDSETUP/DEV/DRBD0 Primary--force Note When you first set up master/slave, the primary device must be forced, and when you view the DRBD state, you can see that the status is set to the primary device Primary

drbd0 Gecheng ext4 format and mount it

Mkfs.ext4/dev/drbd0

Mount/dev/drbd0/data

Here , the configuration of DRBD is over, and it can be tested.

Now write in the /data directory on the drbd1 of primary .

then will drbd0 unload, and will drbd1 secondary

change its status to primaryon drbd1 , and then mount the drbd0 in the /data directory, You can see The data written in/data.

Note: only when theDRBDstatus isPrimarywhen you are able todrbd0mount successfully, and you can see/datadata, so there is room for further improvement in theDRBDStart upHeartbeat, letHeartbeatto monitorDRBD, when any one Down, you can automatically switch master-slave.


Configuring DRBD under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.