2015-08-05

리눅스에서 drbd 설치

How to Install DRBD
& default Setting on Linux



Ends.


※ following steps should be performed both node that comprise the cluster.
 
  1. How to add Disk to OS.

I tested it on Virtual machine. if you use the VM, you cat it with VM setting page.
do the following steps..
<fig.1>
<fig.2>
  1. Make partition on new Disk with FDISK.

New Disk is only possiable check with fdisk command.
1. first, check disk list with ‘l’ option.
2. make a new partition on new Disk with ‘n’ option.
3. store Setting infomation to disk with ‘w’ option.
[root@left ~]# fdisk -l
…........................... (middle part Omission) ...............

Disk /dev/sdc: 268 MB, 268435456 bytes
64 heads, 32 sectors/track, 256 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

  Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         256      262128   83  Linux
[root@left ~]#
  1. Download DRBD RPMs from mirror site of centOS.

Download DRBD RPMs as follow List.
kmod-drbd83-8.3.13-1.el5.centos.x86_64.rpm
drbd83-8.3.13-2.el5.centos.x86_64.rpm
※ You can download from here.
if you use another Linux Distribution likes UBUNTU and SUSE, Check this page.


kernel-2.6.18-308.el5.x86_64.rpm


  1. Install DRBD package & kmod (kernel module)

simply done , just run rpms.
[root@right Download]# rpm -ivh drbd83-8.3.13-2.el5.centos.x86_64.rpm
warning: drbd83-8.3.13-2.el5.centos.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
  1:drbd83                 ########################################### [100%]
[root@right Download]# rpm -ivh kmod-drbd83-8.3.13-1.el5.centos.x86_64.rpm
warning: kmod-drbd83-8.3.13-1.el5.centos.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing...                ########################################### [100%]
  1:kmod-drbd83        ########################################### [100%]


  1. Make default drbd.conf

Very simple configure. just configure Active-Standby with Protocol C that means full syncronization.
resource r0
{
       protocol C;
       on left
       {
               device    /dev/drbd1;
               disk      /dev/sdc1;
               address   10.10.10.101:7789;
               meta-disk internal;
       }
       on right
       {
               device    /dev/drbd1;
               disk      /dev/sdc1;
               address   10.10.10.102:7789;
               meta-disk internal;
       }
}


  1. Make DRBD meta data

Internal meta-disk means that make mata-data on last part of the device.
howeve in this ‘internal’ case, it can’t create index.
[root@right ~]# drbdadm create-md r0
Writing meta data...
initializing activity log
NOT initialized bitmap
New drbd meta data block successfully created.
               --== Creating metadata ==--
As with nodes, we count the total number of devices mirrored by DRBD at
at http://usage.drbd.org.
The counter works anonymously. It creates a random number to identify
the device and sends that random number, along with
DRBD's version number, to usage.drbd.org.
http://usage.drbd.org/cgi-bin/insert_usage.pl?nu=7994833865736912708&ru=5179791256307207409&rs=268419072
* If you wish to opt out entirely, simply enter 'no'.
* To continue, just press [RETURN]
success


  1. Start drbd service

[root@right ~]# service drbd start
Starting DRBD resources: [ d(r0) s(r0) n(r0) ]..........
***************************************************************
DRBD's startup script waits for the peer node(s) to appear.
- In case this node was already a degraded cluster before the
  reboot the timeout is 120 seconds. [degr-wfc-timeout]
- If the peer was available before the reboot the timeout will
  expire after 0 seconds. [wfc-timeout]
  (These values are for resource 'r0'; 0 sec -> wait forever)
To abort waiting enter 'yes' [  20]:


  1. DO First sync.

do first full syncronization.
[root@left ~]# drbdadm -- --overwrite-data-of-peer primary all


  1. Check Mirror (primary-secondary) state.

[root@left ~]# drbdadm role all
Primary/Secondary
[root@left ~]# service drbd status
drbd driver loaded OK; device status:
version: 8.3.13 (api:88/proto:86-96)
GIT-hash: 83ca112086600faacab2f157bc5a9324f7bd7f77 build by mockbuild@builder10.centos.org, 2012-05-07 11:56:36
^[[A^[[Am:res  cs         ro                 ds                 p  mounted  fstype
1:r0   Connected  Primary/Secondary  UpToDate/UpToDate  C
[root@left ~]# cat /proc/drbd
version: 8.3.13 (api:88/proto:86-96)
GIT-hash: 83ca112086600faacab2f157bc5a9324f7bd7f77 build by mockbuild@builder10.centos.org, 2012-05-07 11:56:36

1: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----
   ns:0 nr:16 dw:16 dr:0 al:0 bm:1 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
[root@left ~]#


  1. Ends.

To do failover test.

No comments:

Post a Comment