====== Configuring DRBD in a Debian OpenSSI Cluster ====== ===== Overview About DRBD ===== - DRBD is The Distributed Replicated Block Device. ===== 요구사항(Requirements) ===== - Two computers that are connected to a common switch or hub. - The two computers should also be connected by a Null Modem serial cable \\ to provide the 'heartbeat' system an alternate means of communication. - Each system must independantly have sufficient disk space to provide file service. ===== 가정(Assumptions) ===== host-a 10.0.0.10 host-b 10.0.0.20 fs-cluster 10.0.0.30 ===== 과정(Procedure) ===== ==== DRBD 모듈설치 ==== - 양쪽 장비(both hosts) 모두 컴파일하고, 설치한다. # apt-get install drbd0.7-module-source # apt-get install drbd0.7-utils # apt-get install dpatch # cd /usr/src # tar -zxf drbd0.7.tar.gz # cd /usr/src/modules/drbd # module-assistant prepare # module-assistant automatic-install drbd0.7-module-source Navigate the module package creation procedure as logically as possible; details for this procedure are not provided. # cd /usr/src # dpkg -i drbd0.7-module-2.4.27-2-k7_0.7.10-3+2.4.27-8_i386.deb ==== DRBD 구성 ==== - 양쪽 장비에 /etc/drbd.conf 파일에 동일하게 구성한다. resource drbd-resource-0 { protocol C; incon-degr-cmd "halt -f"; # killall heartbeat would be a good alternative :-> disk { on-io-error panic; } syncer { rate 10M; # Note: 'M' is MegaBytes, not MegaBits } on host-a { device /dev/drbd0; disk /dev/hda8; address 10.0.0.10:7789; meta-disk internal; } on host-b { device /dev/drbd0; disk /dev/hda8; address 10.0.0.20:7789; meta-disk internal; } } - 양쪽장비에서 DRBD를 실행한다. # /etc/init.d/drbd start - 장비 중 하나를 Primary 로 선언한다. host-a: # drbdadm primary all - DRBD 지정한다. host-a: # drbdsetup /dev/drbd0 primary --do-what-I-say - Primary 장비에서 DRBD를 위한 파일시스템을 활성화시킨다. host-a: # mkreiserfs /dev/drbd0 (or mke2fs, or whatever filesystem you prefer) host-a: # mkdir /share host-a: # mkdir /share/spool0 host-a: # mount /dev/drbd0 /share/spool0 - Primary 장비에서 NFS 아래의 공유디렉토리를 생성한다. host-a: # mkdir /share/spool0/data - 양쪽노드에 NFS 설정을 한다. - Debian 패키지를 설치한다. # apt-get install nfs-kernel-server - NFS 서버를 정지시킨다. # /etc/init.d/nfs-kernel-server stop - /etc/exports 파일을 설정한다. # echo "/share/spool0/data 10.3.11.0/255.255.255.0(rw,sync)" >> /etc/exports - 양쪽장비의 NFS 서비스를 자동으로 실행되지 않게 한다. # update-rc.d -f nfs-kernel-server remove (for non-Debian systems you can probably just delete /etc/init.d/ nfs or /etc/init.d/nfs-server) - Primary 장비에서 nfs 설정을 공유디스크에 카피하고, 링크시킨다. host-a: # mv /var/lib/nfs /share/spool0/varlibnfs host-a: # ln -s /share/spool0/varlibnfs /var/lib/nfs - /etc/default/nfs-common 파일설정을 한다. # vi /etc/default/nfs-common ... 'STATDOPTS="-n my_clusters_name" ... ==== heartbeat 설정 ==== - 패키지를 설치한다. # apt-get install heartbeat - 양쪽 장비의 /etc/ha.d/ha.cf 를 설정한다. \\ 아래는 Primary 장비의 설정이다. \\ 장비별로 ucast는 다르다. \\ node-b는 10.0.0.20 대신 ucast eth0 10.0.0.10 설정한다. keepalive 1 deadtime 10 warntime 5 initdead 60 udpport 694 baud 19200 serial /dev/ttyS0 ucast eth0 10.0.0.20 auto_failback off watchdog /dev/watchdog node node-a node node-b * auto_failback is off; we should not fail back unless a human has confirmed that the DRBD state is consistent - heartbeat resource 생성한다. # echo 'killall -9 nfsd ; exit 0' > /etc/heartbeat/resource.d/killnfsd # chmod 755 /etc/heartbeat/resource.d/killnfsd - /etc/heartbeat/haresources 에 Primary 장비에 설정한다. host-a drbddisk::drbd-resource-0 \ Filesystem::/dev/drbd0::/share/spool0/data::reiserfs \ killnfsd \ nfs-common \ nfs-kernel-server \ Delay::3::0 \ IPaddr::10.0.0.30/24/eth0 - HA 서버로부터 마운트시킨다. client-a: # mkdir /mnt/hafs client-a: # echo "fs-cluster:/share/spool0/data /mnt/hafs nfs defaults 0 0" >> /etc/fstab client-a: # mount -a ===== References ===== - http://www.linux-ha.org/DRBD/NFS