±âº»È¯°æ : - ¸®´ª½º ¼¹ö 2´ë (CentOS release 5.4 / 2.6.18-164.11.1.el5xen x86_64)
¾Æ·¡¿Í °°ÀÌ RedHat °è¿¿¡¼´Â CentOS ÆÄÀÏÀ» ÀÌ¿ëÇ϶ó°í ÇßÁö¸¸... Fedora Core8_386 ¹öÀü¿¡¼´Â ¸ÕÁö¸ð¸£´Âµ¥ ÀÚ²Ù ¿¡·¯°¡ ¶á´Ù.
±×³É ±ò²ûÈ÷ CentOS ·Î ¹Ð°í ¼³Á¤À» Àâ¾Ò´Ù.
RedHat
RedHat does not provide DRBD? packages for RHEL although such are available in the ¡æ CentOS extras repository. Since CentOS is a binary compatible clone of RedHat, you can use the CentOS packages on RedHat as well.
1. RPM ¼³Ä¡
Centos ¿¡¼´Â yum ÀÌ Áö¿øÀ» ÇÑ´Ù.
http://mirror.centos.org/centos/5/extras/x86_64/RPMS/
[root@localhost drbd]# yum install *-drbd83*
[root@localhost drbd]# rpm -qa |grep drbd
kmod-drbd83-8.3.2-6.el5_3
drbd83-8.3.2-6.el5_3
kmod-drbd83-xen-8.3.2-6.el5_3
2. ȯ°æ¼³Á¤ (/etc/drbd.conf)
- ¼³Á¤ÆÄÀÏÀº /etc/drbd.conf ÀÌ¸ç ±âº»ÆÄÀÏ¿¡ ¾Æ·¡ ³»¿ëÀ» Ãß°¡ÇØÁÖ¸é µÈ´Ù.
- /dev/hda5 ¿Í /dev/sda9 ÆÄƼ¼ÇÀ» µ¿±âÈ ½Ãų°ÍÀÌ´Ù.
# please have a a look at the example configuration file in
# /usr/share/doc/drbd83/drbd.conf
#
global { usage-count yes; }
common { syncer { rate 10M; } }
resource r0 {
protocol C;
disk { on-io-error detach; }
syncer {
}
on node1 { # Master ¼¹ö
device /dev/drbd0;
disk /dev/hda5;
address 218.236.115.225:7791;
meta-disk internal;
}
on node2 { # Secondary ¼¹ö
device /dev/drbd0;
disk /dev/sda9;
address 218.236.115.226:7791;
meta-disk internal;
}
}
- Hostname º¯°æ
[root@node1 ~]# cat /etc/hosts
218.236.115.225 node1
218.236.115.226 node2
- Meta Data ¸¦ »ý¼ºÇÑ´Ù. (Master / Secondary ¼¹ö µÎ´ë¿¡¼ ¸ðµÎÁøÇà)
Meta Data ???
µ¥ÀÌÅÍ¿¡ °üÇÑ ±¸Á¶ÈµÈ µ¥ÀÌÅÍ·Î, ´Ù¸¥ µ¥ÀÌÅ͸¦ ¼³¸íÇØ ÁÖ´Â µ¥ÀÌÅÍ·Î ¼Ó¼ºÁ¤º¸¶ó°íµµ ÇÑ´Ù.
´ë·®ÀÇ Á¤º¸ °¡¿îµ¥¿¡¼ ã°í ÀÖ´Â Á¤º¸¸¦ È¿À²ÀûÀ¸·Î ã¾Æ³»¼ ÀÌ¿ëÇϱâ À§ÇØ ÀÏÁ¤ÇÑ ±ÔÄ¢¿¡ µû¶ó ÄÜÅÙÃ÷¿¡ ´ëÇÏ¿© ºÎ¿©µÇ´Â µ¥ÀÌÅÍÀÌ´Ù. ¿©±â¿¡´Â ÄÜÅÙÃ÷ÀÇ À§Ä¡¿Í ³»¿ë, ÀÛ¼ºÀÚ¿¡ °üÇÑ Á¤º¸, ±Ç¸® Á¶°Ç, ÀÌ¿ë Á¶°Ç, ÀÌ¿ë ³»·Â µîÀÌ ±â·ÏµÇ¾î ÀÖ´Ù. ÄÄÇ»ÅÍ¿¡¼´Â º¸Åë ¸ÞŸµ¥ÀÌÅ͸¦ µ¥ÀÌÅ͸¦ Ç¥ÇöÇϱâ À§ÇÑ ¸ñÀû°ú µ¥ÀÌÅ͸¦ »¡¸® ã±â À§ÇÑ ¸ñÀûÀ¸·Î »ç¿ëÇÏ°í ÀÖ´Ù.
ÄÄÇ»ÅÍ¿¡¼ Á¤º¸ÀÇ À妽º(Index) ±¸½ÇÀ» ÇÑ´Ù. ¿ì¸®°¡ ¸¹ÀÌ »ç¿ëÇÏ´Â µ¥ÀÌŸº£À̽ºµµ ÀÌ·¯ÇÑ ¸ÞŸµ¥ÀÌÅÍ°¡ Àß ±¸¼ºµÇ¾î Àֱ⠶§¹®¿¡ µ¥ÀÌÅ͸¦ »¡¸® ãÀ» ¼ö ÀÖ´Ù.
À§¿Í°°Àº ¿¡·¯¸Þ½ÃÁö°¡ ¹ß»ýÇÒ°ÍÀÌ´Ù.
ÆÄÀϽýºÅÛÀ» ÀÌ¹Ì »ç¿ëÁßÀÌ¶ó¼ ¾Æ·¡ ¼¼°¡Áö ¹æ¹ýÁß Çϳª¸¦ ¼±ÅÃÇ϶ó´Â ÀǹÌÀÌ´Ù.
* use external meta data (recommended)
* shrink that filesystem first
* zero out the device (destroy the filesystem)
³ª´Â /dev/hda5 ¿¡ ÀÌ¹Ì ext3 ÆÄÀϽýºÅÛÀÌ ¸¶¿îÆ®µÈ »óÅ·ΠÁ¸ÀçÇؼ ³ªÅ¸³ª´Â ¿¡·¯·Î È®ÀÎÇÏ°í
umount ÇÏ°í µð½ºÅ©¸¦ ÃʱâÈ ½ÃÄ×´Ù. zero out the device¸¦ Çعö¸°´Ù.
°£´ÜÇÏ°Ô dd ·Î ¹Ð¾î ¹ö¸®°í ´Ù½Ã meta data ¸¦ ¸¸µé¾î º¸ÀÚ.
¿¹Àü¿¡ ¸¸µé¾ú´ø ÈçÀûÀÌ ÀÖ´Ù¸é overwirte ÇÒ°ÍÀÎÁö ¹°¾î º¸Áö¸¸ óÀ½ ¸¸µç´Ù¸é ¹Ù·Î ¸¸µé¾îÁø´Ù.
[root@node1 ~]# vim /etc/fstab
[root@node1 ~]# umount /dev/hda5
[root@node1 ~]# dd if=/dev/zero of=/dev/hda5 bs=1M count=128
128+0 records in
128+0 records out
134217728 bytes (134 MB) copied, 0.333406 seconds, 403 MB/s
[root@node1 ~]# drbdadm create-md all
v08 Magic number not found
v07 Magic number not found
v07 Magic number not found
v08 Magic number not found
Writing meta data...
initialising activity log
NOT initialized bitmap
New drbd meta data block sucessfully 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 completely anonymous. A random number gets created for
this device, and that randomer number and the devices size will be sent.
http://usage.drbd.org/cgi-bin/insert_usage.pl?nu=2977384434883995994&ru=1067486578812435670&rs=9245214720Enter ¡¯no¡¯ to opt out, or just press [return] to continue:
success
¡Ø dd ¿É¼Ç
if=FILE
read from FILE instead of stdin
Ç¥ÁØÀԷ´ë½Å ÁöÁ¤ÇÑ ÆÄÀÏ¿¡¼ ºÒ·¯µéÀδÙ.
of=FILE
write to FILE instead of stdout
Ç¥ÁØÃâ·Â´ë½Å ÁöÁ¤ÇÑ ÆÄÀÏ¿¡ ÀÛ¼ºÇÑ´Ù.
bs=BYTES
force ibs=BYTES and obs=BYTES
ÁöÁ¤ÇÑ »çÀÌÁŠÀÐ°í ¾´´Ù.
count=BLOCKS
copy only BLOCKS input blocks
ÁöÁ¤ÇÑ ºí·ÏÀÇ ibs Å©±â¸¸Å º¹»çÇÑ´Ù.
3. µ¥¸ó ½ÃÀÛ (µÎ´ë ¸ðµÎ¿¡ µ¥¸óÀ» ¿Ã¸°´Ù)
[root@node1 ~]# /etc/init.d/drbd start
Starting DRBD resources: [ d(r0) s(r0) n(r0) ].
[root@node2 ~]# /etc/init.d/drbd start
Starting DRBD resources: [ d(r0) s(r0) n(r0) ].
4. µð½ºÅ© SYNC
ÇöÀç´Â µÎ ¼¹ö ¸ðµÎ µ¥ÀÌŸ°¡ ¾øÁö¸¸ µ¿±âÈÀÛ¾÷Àº ¸¶½ºÅÍ¿Í º¸Á¶¼¹ö¸¦ ´Ù½ÃÇѹø È®ÀÎÇÏ°í ÀÛ¾÷À» ÇؾߵȴÙ..
¸ÕÀú ¾çÂÊ ³ëµå°£ÀÇ HDDÀÇ ¸ÞŸÁ¤º¸¸¦ °¡Áö°í µð½ºÅ© SYNC ÀÛ¾÷À» ÇØÁØ´Ù.
/proc/drbd ¿¡¼ »ìÆì º¼¼ö ÀÖÀ¸¸ç, ³ª´Â node1 ¼¹ö´Â ¸¶½ºÅÍ·Î µÎ°í node2¸¦ ¹é¾÷¼¹ö·Î ¼³Á¤ÇÒ°ÍÀÌ´Ù.
¾çÂʵð½ºÅ©¿¡ ¾ÅÅ©¸¦ ¸ÂÃß´Â ÀÛ¾÷ÀÌ ÁøÇàµÇ´Â°Ô È®ÀÎÀÌ µÉ°ÍÀÌ°í ½Ã°£ÀÌ Á¶±Ý °É¸°´Ù.
[root@node1 ~]# drbdadm -- --overwrite-data-of-peer primary all
5. È®ÀÎ
ÇØ´çÀåÄ¡¸¦ ¿øÇÏ´Â °÷À¸·Î ¸¶¿îÆ®¸¦ °É°í ¹Ì·¯¸µÀÌ ÀߵǰíÀÖ´ÂÁö È®ÀÎÀ» Çغ¸ÀÚ... ¿ë·®ÀÌ Á» Å«°É·Î.....
[root@node1 ~]# mkfs -t ext3 -j /dev/drbd0
[root@node1 ~]# mount /dev/drbd0 /test
[root@node1 test]# du -sh *
861M TestFile
0 aaa
0 bbb
0 ccc
16K lost+found
[root@localhost /]# umount /test/
[root@localhost /]# drbdsetup /dev/drbd0 secondary
[root@node2 home]# drbdsetup /dev/drbd0 primary
[root@node2 home]# mount /dev/drbd0 /home/
[root@node2 home]# du -sh *
861M TestFile
0 aaa
0 bbb
0 ccc
16K lost+found
1±â°¡°¡·® µÇ´Â µ¥ÀÌŸ°¡ ¼ø°£ µ¿±âȵǾîÀÖ´Ù.
µ¥ÀÌŸ µ¿±âÈ °úÁ¤Àº /proc/drbd ¸¦ ÅëÇؼ ¸ð´ÏÅ͸µÇÏ½Ã¸é µË´Ï´Ù.
¾Æ·¡´Â 800¸Þ°¡ µ¥ÀÌŸ¸¦ ¾÷·Îµå ÇÏ¸é¼ Ä¸ÃĶá°Å ÀÔ´Ï´Ù.