DRBD8 에서 primary/primary 설정하기 (소스컴파일)
이내용은 DRBD-8.0.1 컴파일 버젼이다 (bye 이재원)
RPM 패키지를 이용하여 간단히 구성할시는 202번 글을 참조하라
필자가 8점대를 컴파일한 이유는 (primary/primary)구성을 위해서다 이구성이 필요없으면 간단히 RPM으로 설치하기바란다
1. 커널의 버젼을 맞춰준다.. (2.6.9-42.0.2.EL)
2. 현 커널과 같은 버젼의 srpm 커널 소스를 받아 설치한다
# rpm –ivh kernel-2.6.9-42.0.2.EL.src.rpm
# cd /usr/src/redhat/SPECS
# rpmbuild –bp ––target=i686 kernel-2.6.spec
# ln –s /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9 /usr/src/linux
3. 커널 컨피그 정보를 복사해온다..
# cp /boot/kernel-xxx.config /usr/src/linux/.config
# make -s oldconfig_nonint ; make -s oldconfig_nonint (안되면 무시)
# vi /usr/src/linux/Makefile 을열어서 EXTRAVERSION 부분을 현커널버젼과 동일하게 한다
ex) EXTRAVERSION -42.0.2.EL
# make /usr/src/linux/include/linux/version.h
# make modules_prepare
4. DRBD 소스버젼을 /usr/src 디렉토리에 풀어놓는다
# tar xvfz drbd-0.8.1.tar.gz -C /usr/src ; cd /usr/src/drbd-0.8.1
# make clean all
# /lib/modules/`uname -r`/build <–체크
# cd /usr/src/drbd-0.8.1
# make tools
# make install (인스톨시작)
# make install-tools
5. 각 노드에서 drbd 모듈 로딩
# modprobe drbd
# lsmod | grep drbd
6. /etc/drbd.conf 파일설정 (각노드에 복사해놓는다)
——————————————————————
#
# please have a a look at the example configuration file in
# /usr/share/doc/drbd.conf
#
resource export {
protocol C;
startup {
wfc-timeout 0; ## Infinite!
degr-wfc-timeout 60; ## 2 minutes.
}
disk {
on-io-error detach;
}
net {
# timeout 60;
# connect-int 10;
# ping-int 10;
# max-buffers 2048;
# max-epoch-size 2048;
allow-two-primaries;
}
syncer {
rate 60M;
# group 0;
al-extents 257;
}
on dr1.epersnet.com {
device /dev/drbd5;
disk /dev/sdb1;
address 10.10.10.1:7789;
meta-disk internal;
}
on dr2.epersnet.com {
device /dev/drbd5;
disk /dev/sdb1;
address 10.10.10.2:7789;
meta-disk internal;
}
}
—————————————————————-
%% 만약 리소스가 2개이상이라면 반드시 포트번호를 다르게 지정할것
[node1]
# drbdadm -d adjust export
# drbdadm create-md export <– export는 리소스이름
yes 입력
# drbdadm adjust export
[node2]
# drbdadm adjust export
[node1]
# /etc/init.d/drbd start
# drbdsetup /dev/drbd0 primary -o
[node2]
# /etc/init.d/drbd start
# drbdsetup /dev/drbd0 primary -o
cat [node1] /proc/drbd (상태확인)
Connected st:Primary/Primary ds:UpToDate/UpToDate C r—
cat [node2] /proc/drbd (상태확인)
Connected st:Primary/Primary ds:UpToDate/UpToDate C r—
만약 아래와 같은 에러가 발생한다면 아래부분을 참조하여 해결할것
State change failed: (-2) Refusing to be Primary without at least one UpToDate disk
================== [ if error acct ] ======================
drbd642:~# /etc/init.d/drbd stop
Stopping all DRBD resources.
drbd642:~# drbdadm create-md export
Valid meta-data already in place, recreate new?
[need to type ‘yes’ to confirm] yes
Creating meta data…
initialising activity log
initialising bitmap (208844 KB)
100%
New drbd meta data block sucessfully created.
drbd642:~# /etc/init.d/drbd start
Starting DRBD resources: [ d0 s0 n0 ].
drbd642:~# drbdsetup /dev/drbd0 primary -o
drbd642:~# cat /proc/drbd
version: 8.0pre5 (api:84/proto:83)
SVN Revision: 2481M build by root@drbd64, 2006-11-01 16:42:55
0: cs:Connected st:Primary/Secondary ds:UpToDate/Diskless r—
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0
resync: used:0/31 hits:0 misses:0 starving:0 dirty:0 changed:0
act_log: used:0/127 hits:0 misses:0 starving:0 dirty:0 changed:0
===================================================================