DRBD + Heartbeat + NFS high-availability File Sharing storage

Source: Internet
Author: User

I. Overview

1. Architecture Diagram

2. Software Overview

Heartbeat (Linux-HA) Working principle: heartbeat consists of two core parts: Heartbeat monitoring and resource management. heartbeat monitoring can be performed through network links and serial ports, and supports redundant links, they send messages to each other to inform the other party of their current status. If the message is not sent to the other party within the specified time, the other party is deemed invalid, in this case, you need to start the resource management module to take over the resources or services on the other host.

DRBD: drbd is a software solution for real-time, synchronous, and asynchronous data image block storage replication. Its main function is implemented through the Linux kernel. DRBD writes local files in a way similar to the network RAID-1 function.

3. Resource allocation

System: CentOS6.5 _ x64

Host Name

Role

IP address

Masternfs

Primary NFS

Eth0: 192.168.0.202/24

Backupnfs

Backup NFS

Eth0: 192.168.0.203/24

 

VIP

192.168.0.204/24

4. Configure two hosts records
[Root @ masternfs ~] # Vi/etc/hosts
192.168.0.202 masternfs
192.168.0.203 backupnfs

Ii. install and configure DRBD (the configurations of the two servers are basically the same)
Install the epel Source:
Rpm-ivh http://mirrors.ustc.edu.cn/Fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
Download drbd software: http://oss.linbit.com/drbd/
1. Install the dependency package
1 [root @ masternfs ~] # Yum install-y gcc-c ++ make perl kernel-devel kernel-headers flex drbd84-utils kmod-drbd84

2. Install DRBD and load it to the kernel
[Root @ masternfs ~] # Tar zxvf drbd-8.4.4.tar.gz
[Root @ masternfs ~] # Cd drbd-8.4.4
[Root @ masternfs ~] #./Configure -- prefix =/usr/local/drbd -- with-km # -- with-km, enable the kernel module
[Root @ masternfs ~] # Make KDIR =/usr/src/kernels/2.6.32-358.23.2.el6.x86 _ 64/# specify the kernel source code path
[Root @ masternfs ~] # Make install
[Root @ masternfs ~] # Chkconfig -- add drbd
[Root @ masternfs ~] # Chkconfig drbd on
[Root @ masternfs ~] # Cp drbd/drbd. ko/lib/modules/'uname-R'/kernel/lib/# load the DRBD module to the kernel
[Root @ masternfs ~] # Modprobe drbd
[Root @ masternfs ~] # Lsmod | grep drbd # Check whether the drbd module has been loaded.
Drbd 333755 0
Libcrc32 C 1246 1 drbd

3. Configure DRBD
[Root @ masternfs ~] # Cd/usr/local/drbd/
[Root @ masternfs ~] # Vi/usr/local/drbd/etc/drbd. d/global_common.conf
Global {
Usage-count yes;
}
Common {
Protocol C;
Disk {
On-io-error detach;
}
Syncer {
Rate 100 M;
}
}
Resource web {
On masternfs {
Device/dev/drbd0;
Disk/dev/sdb1;
Address 192.168.0.202: 7899;
Meta-disk internal;
}
On backupnfs {
Device/dev/drbd0;
Disk/dev/sdb1;
Address 192.168.0.203: 7899;
Meta-disk internal;
}
}

4. Create a data block for the DRBD to record information
[Root @ masternfs ~] # Drbd admcreate-md web
Writing meta data...
Initializing activity log
NOT initializing bitmap
New drbd meta data blocksuccessfully created.
Success
[Root @ masternfs ~] # Mkdir-p/usr/local/drbd/var/run/drbd # create a Resource Directory
[Root @ masternfs ~] # Service drbd start


5. If there is no master-slave node by default, you need to set

[Root @ masternfs ~] # Cat/proc/drbd
Version: 8.4.4 (api: 1/proto: 86-101)
GIT-hash: 599f286440bd633d15d5ff985204aff4bccffadd build by phil @ Build64R6, 2013-10-1415: 33: 06
0: cs: Connected ro: Secondary/Secondaryds: UpToDate/UpToDate C r -----
Ns: 64 nr: 112 dw: 176 dr: 6088 al: 1 bm: 0 lo: 0 pe: 0 ua: 0 ap: 0 ep: 1wo: f oos: 0

[Root @ masternfs ~] # Drbdadm -- overwrite-data-of-peer primary web
[Root @ db-backup ~] # Drbdadm secondary web # backupnfs server settings slave Node

# Check that the status is already master-slave
[Root @ masternfs ~] # Drbd-overview
0: mysql/0 Connected Primary/Secondary UpToDate/UpToDate C r -----

Note:
Cs: two data connection statuses
Ro: status of two hosts
Ds: the disk status is "UpToDate/UpToDate.
6. Format and mount the partition
123 [root @ masternfs ~] # Mkfs. ext4/dev/drbd0
[Root @ masternfs ~] # Mkdir/web
[Root @ masternfs ~] # Mount/dev/drbd0/web

DRBD details: click here
DRBD: click here

DRBD for Linux high availability (HA) CLUSTERS

DRBD Chinese application guide PDF

Installation and configuration notes for DRBD in CentOS 6.3

High-availability MySQL based on DRBD + Corosync

Install and configure DRBD in CentOS 6.4

  • 1
  • 2
  • Next Page

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.