Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Server \ CentOS 6.5 installation configuration DRBD     - Hadoop 2.0 Detailed Configuration Tutorial (Server)

- Linux firewall settings -DNS server articles (Server)

- RHEL7.0 log system (Linux)

- To install and deploy Java applications under CentOS 6.5 (Linux)

- Can not remember how to solve the problem under Ubuntu brightness setting (Linux)

- Linux virtual memory and physical memory (Linux)

- Linux directory permissions to read and execute permissions difference (Linux)

- Hackers is how the invasion and control of Things devices? (Linux)

- Customize the output format in Linux history (Linux)

- Ubuntu 14.04 LTS to compile the source code Android4.4.2 (Linux)

- CentOS7 install NTFS-3G driver (Linux)

- Understanding and Memcached MongoDB arbitration node, Zookeeper, Redis Recovery Programme Thoughts (Database)

- Improve WordPress performance (Server)

- ASM required disk format process in Solaris platforms (Linux)

- RocketMQ Message Queuing simple deployment (Linux)

- Try to use Lets Encrypt (Linux)

- GO five stages of language learning (Programming)

- Print Linux system error codes (Linux)

- Access clipboard content across multiple vim instances in a terminal (Linux)

- Zabbix configure DataGuard monitoring (Database)

  CentOS 6.5 installation configuration DRBD
  Add Date : 2018-11-21      
  lab environment:

(1) using two versions CentOS6.5

(2) using 163 yum source (configuration reference below)

(3) add two virtual machines the same virtual hard disk, I used the 10G

Operating system host name IP drbd disk

CentOS6.5 local.aaa.com / dev / sdb4

CentOS6.5 local2.aaa.com / dev / sdb4


(1) ip address configuration please make sure if there are DNS host name of the virtual machine in line with FQDA, and do the normal DNS resolution, or write to the hosts file (/ etc / hosts)

(2) Close selinux (setenforce 0) Close iptables (service iptables stop) or written rules

A, DRBD ready

1, yum configuration

(1) enter yum source configuration directory cd /etc/yum.repos.d

(2) backup system comes yum source mv CentOS-Base.repo CentOS-Base.repo.bak

(3) downloads 163 Netease yum source: wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

(4) Change the file name mv CentOS6-Base-163.repo CentOS-Base.repo

(5) Play yum update source, execute the command below to update yum configuration, make the operation effective immediately yum clean all yum makecache

2, DRBD installation

After (1) First, we want to upgrade the kernel, we restart the upgrade yum -y update kernel

yum install kernel-devel Note here that you want to load the new kernel

(2) rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm

(3) Install DRBD yum -y install drbd83-utils kmod-drbd83

(4) to load the DRBD kernel module modprobe drbd

(5) detecting DRBD successfully installed lsmod | grep drbd

Display information: drbd 332493 0

(6) modprobe -l | grep -i drbd can view the path

Generates a startup script after installation /etc/init.d/drbd

3, initialize the disk

(1) First, make sure you use fdisk -l add new virtual disk disk number

(2) Use fdisk / dev / disk partition numbers do not need to format (For details, see (http://liumingyuan.blog.51cto.com/9065923/1604923)


Two, DRBD configuration

(DRBD configuration file is divided into three scores: global, common resource at run time and the path of the default configuration file is read /etc/drbd.conf, this document describes some of the configuration parameters and DRBD devices with hard disk partitions. mapping, default is empty, but contains a sample configuration file in the DRBD source code package)

Under normal circumstances global_common.conf (this experiment file directory /etc/drbd.d/) file that contains only global and common part of the configuration (configured as a global understanding), the file is defined in /etc/drbd.d/*.res in a resource (understood as the host definition).

In fact, you can configure DRBD into drbd.conf file, but doing so in a case where more resources will become confused.

(1) The use of distributed configuration First we configure /etc/drbd.d/global_common.conf

It reads as follows:

global {

usage-count no; # whether to participate in DRBD user statistics, the default is to participate


common {

syncer {rate 200M;} # When the primary and standby nodes synchronized network maximum rate

protocol C; # use DRBD third synchronization protocol, after receiving the express written confirmation of the remote host that the write is complete

handlers {

pri-on-incon-degr "echo o> / proc / sysrq-trigger; halt -f";

pri-lost-after-sb "echo o> / proc / sysrq-trigger; halt -f";

local-io-error "echo o> / proc / sysrq-trigger; halt -f";

fence-peer "/ usr / lib64 / heartbeat / drbd-peer-outdater -t 5";

pri-lost ". echo pri-lost Have a look at the log files | mail -s' DRBD Alert'root.";

split-brain "/usr/lib/drbd/notify-splot-brain.sh root";

out-of-sync "/usr/lib/drbd/notify-out-of-sync.sh root";


net {authentication mode and password to use when synchronizing #DRBD

cram-hmac-alg "sha1";

shared-secret "MySQL-HA";


disk {# use dpod function (drbd outdate-peer daemon) to ensure data synchronization can not switch

on-io-error detach;

fencing resource-only;


startup {

wfc-timeout 120;

degr-wfc-timeout 120;



(2) Second, we have to create a file with the extension .res at drbd.d directory, the file is created in this directory is /etc/drbd.d/ drbd.res

It reads as follows:

resource r0 {# define the resource name r0

Description on local.aaa.com {# back to the beginning of each host is the host name on hostname

# Define logical paths DRBD disk usage; device / dev / drbd0

disk / dev / sdb4; # / dev / drbd0 use disk partitions

address; # set DRBD listening port to communicate with another host

meta-disk internal; #DRBD way internal metadata stored inside


on local2.aaa.com {

device / dev / drbd0;

disk / dev / sdb4;


meta-disk internal;



(3) Create haclient group and set permissions reason is: we will use drbd-peer-outdater fence-peer programs. Use this mechanism dopd heartbeat plug-ins, you need to be able to call drbdsetup and drbdmeta root privileges.

Command is as follows:

groupadd haclient

chgrp haclient / sbin / drbdsetup

chmod o-x / sbin / drbdsetup

chmod u + s / sbin / drbdsetup

chgrp haclient / sbin / drbdmeta

chmod o-x / sbin / drbdmeta

chmod u + s / sbin / drbdmeta

Copy (4) using scp profile to another computer scp* /etc/drbd.d/

And perform groupadd haclient

chgrp haclient / sbin / drbdsetup

chmod o-x / sbin / drbdsetup

chmod u + s / sbin / drbdsetup

chgrp haclient / sbin / drbdmeta

chmod o-x / sbin / drbdmeta

chmod u + s / sbin / drbdmeta

(5) Before starting DBRD, respectively, on the two hosts you need to specify the partition (here sdb4) created to provide information on the record DRBD block

drbdadm create-md r0 (r0 represents the resource previously defined) or perform drbdadm create-md all

Correct tips are:

Writing meta data ...

initializing activity log

NOT initialized bitmap

New drbd meta data block successfully created.

(6) Start DRBD Services script on both nodes located /etc/init.d/drbd

/etc/init.d/drbd start

(7) implementation of cat / proc / drbd

Output follows

version: 8.3.16 (api: 88 / proto: 86-97)

GIT-hash: a798fa7e274428a357657fb52f0ecf40192c1985 build by phil @ Build64R6, 2014-11-24 14:51:37

0: cs: Connected ro: Secondary / Secondary ds: Inconsistent / Inconsistent C r -----

ns: 0 nr: 0 dw: 0 dr: 0 al: 0 bm: 0 lo: 0 pe: 0 ua: 0 ap: 0 ep: 1 wo: f oos: 10482024

Output Interpreter:

ro represents the role of information when you first start DRBD, both nodes are in the default state Secondary

ds disk status information, "nconsistent / Inconsistent" or "Inconsistent / inconsistent" state indicates that the disk data between two nodes is not the same

ns indicates packet of information sent over the network

dw indicate disk writes information

dr represents disk reads information

(8) set the master node with no default primary and alternate nodes points therefore need to set up two of the primary and secondary hosts, select the need to set up the main host computer to perform the following command node

drbdsetup / dev / drbd0 primary -o can also execute the following command drbdadm - --overwrite-data-of-peer primary all

After executing the master node which needs to be set, you can use another command

/ Sbin / drbdadm primary r0 or / sbin / drbdadm primary all

After a few moments to view the / proc / drbd

Output is as follows:

version: 8.3.16 (api: 88 / proto: 86-97)

GIT-hash: a798fa7e274428a357657fb52f0ecf40192c1985 build by phil @ Build64R6, 2014-11-24 14:51:37

0: cs: Connected ro: Primary / Secondary ds: UpToDate / UpToDate C r -----

ns: 10482024 nr: 0 dw: 0 dr: 10482696 al: 0 bm: 640 lo: 0 pe: 0 ua: 0 ap: 0 ep: 1 wo: f oos: 0

ro state becomes Primary / Secondary

ds state has become UpToDate / UpToDate showing real-time synchronization

(9) mounted DRBD device to mount the following on the master node

mkfs.ext4 / dev / drbd0

mount / dev / drbd0 / mnt (this is mounted under mnt mount according to their own needs)

(10) test data mirroring DRBD

Create a file under the mount point of the master node / mnt

dd if = / dev / zero of = / mnt / ceshi.tmp bs = 10M count = 20

Are Upon completion then view on the standby host file synchronization later

First stop DRBD service, in order to ensure data consistency

/etc/init.d/drbd stop

mount / dev / sdb4 / mnt (mount here is / dev / sdb4 physical partition, because the time will start DRBD DRBD device is loaded into the system)

ls / mnt to view the file

After the check is complete umount unloading mount point in the open service
- Depth understanding of C language (Programming)
- Linux IO redirection (Linux)
- CentOS ClamAV antivirus package updates (Linux)
- Linux command line to put on your coat GUI (Linux)
- Browser caching mechanism on the analysis (Linux)
- CentOS 7 Test Marathon start Docker container (Server)
- CoreCLR compiled in Linux CentOS (Linux)
- Writing Better Bash build script 8 (Programming)
- Compare several ways to transfer files between Linux hosts (Linux)
- How to create an alternative Android / iOS connected wireless hotspot AP in Ubuntu 15.04 (Linux)
- Android Fragment really fully resolve (Programming)
- Thinking in Java study notes - Generics (Programming)
- The virtual memory (Linux)
- Use Elasticsearch + Logstash + Kibana set up centralized log Practice Analysis Platform (Server)
- Based on Google Cloud Storage Mirroring open Maven Central Repository (Server)
- MongoDB fragmentation (Cluster) (Database)
- How to Check notebook CPU temperature in Ubuntu (Linux)
- Teach you to diagnose problems with strace (Linux)
- Ease of use "Explain Shell" script to understand Shell command (Linux)
- PL / SQL -> UTL_FILE use presentation package (Database)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.