CentOS 5.5 64bit에서 테스트한 내용임.
대략의 순서
. DRBD 및 OCFS2 설치
. DRBD 설정 및 최초 sync
. DRBD Dual Active 설정 적용
. OCFS2 설정 및 format
. DRBD Dual Active 테스트(OCFS2)
. KVM 설치
/etc/hosts 설정
192.168.0.10 kvma1
192.168.0.20 kvma2
DRBD 설치
yum install drbd83 kmod-drbd83
DBBD 설정
/etc/drbd.conf
global { usage-count yes; }
# you may want to lower the rate, if you’re not using a dedicated GBit link
# between both peers; 20M worked well on EC2
common { syncer { rate 1000M; } }
resource res0 {
protocol C;
startup {
wfc-timeout 20;
degr-wfc-timeout 10;
# we will keep this commented until tested successfully:
# become-primary-on both;
}
net {
# the encryption part can be omitted when using a dedicated link for DRBD only:
# cram-hmac-alg sha1;
# shared-secret anysecrethere123;
allow-two-primaries;
after-sb-0pri discard-zero-changes;
after-sb-1pri discard-secondary;
after-sb-2pri disconnect;
}
on green {
device /dev/drbd0;
disk /dev/sda6;
address 192.168.0.10:7789;
meta-disk internal;
}
on green2 {
device /dev/drbd0;
disk /dev/sda6;
address 192.168.0.20:7789;
meta-disk internal;
}
disk {
fencing dont-care;
}
}
DRBD 동기화
# drbd-overview
1:res0 Unconfigured . . . .
# create meta data information:
$ drbdadm create-md repdata
# let’s make both nodes communicate:
$ drbdadm up repdata
# check the status again:
$ drbd-overview
1:repdata Connected Secondary/Secondary Inconsistent/Inconsistent C r—-
# first node
$ drbdadm — –overwrite-data-of-peer primary repdata
$ drbd-overview
1:repdata Connected Primary/Secondary UpToDate/UpToDate C r—-
# On the second node
$ drbdadm primary repdata
$ drbd-overview
1:repdata Connected Primary/Primary UpToDate/UpToDate C r—-
uncomment this line in /etc/drbd.conf:
previously:
# become-primary-on both;
now:
become-primary-on both;
OCFS2 설치
last kernel 다운로드 경로 (http://centos.mirror.cdnetworks.com/5.5/updates/x86_64/RPMS/)
wget http://centos.mirror.cdnetworks.com/5.5/updates/x86_64/RPMS/kernel-2.6.18-194.26.1.el5.x86_64.rpm
last ocfs2 module (커널 버젼과 맞춘다) (
wget http://oss.oracle.com/projects/ocfs2/dist/files/RedHat/RHEL5/x86_64/1.4.7-1/2.6.18-194.26.1.el5/ocfs2-2.6.18-194.26.1.el5-1.4.7-1.el5.x86_64.rpm
wget http://oss.oracle.com/projects/ocfs2-tools/dist/files/RedHat/RHEL5/x86_64/1.4.4-1/ocfs2-tools-1.4.4-1.el5.x86_64.rpm
다운로드 경로
http://oss.oracle.com/projects/ocfs2/files/RedHat/RHEL5/x86_64/1.4.7-1/2.6.18-194.26.1.el5/
http://oss.oracle.com/projects/ocfs2-tools/files/RedHat/RHEL5/x86_64/1.4.4-1/
rpm -Uvh *.rpm
reboot
[root@kvma1 rpm]# rpm -Uvh *.rpm
warning: kernel-2.6.18-194.26.1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
warning: ocfs2-2.6.18-194.26.1.el5-1.4.7-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing… ########################################### [100%]
1:ocfs2-tools ########################################### [ 33%]
2:kernel ########################################### [ 67%]
3:ocfs2-2.6.18-194.26.1.e########################################### [100%]
설정
mkdir /etc/ocfs2
/etc/ocfs2/cluster.conf 작성
cluster:
node_count = 2
name = ocfs2
node:
ip_port = 7777
ip_address = 192.168.0.10
number = 0
name = green.i-pharm.org
cluster = ocfs2
node:
ip_port = 7777
ip_address = 192.168.0.20
number = 1
name = green2.i-pharm.org
cluster = ocfs2
여기서 node: 에서 name 은 hostname 이다.
nade: 에서 cluster는 cluster: 에서 지정한 name과 같다.
host green과 green2 동일하게 설정한다.
OCFS2 시작
chkconfig o2cb on && chkconfig ocfs2 on
etc/init.d/o2cb start && /etc/init.d/ocfs2 start
OCFS2 로 포멧
mkfs.ocfs2 -L “KVM” /dev/drbd0
mkdir /opt/storage
mount -t ocfs2 -o noauto,noatime /dev/drbd0 /opt/storage
echo “/dev/drbd0 /opt/storage ocfs2 noauto,noatime 0 0” >> /etc/fstab
KVM 설치
1. 패키지 설치
yum install kvm virt-manager libvirt libvirt-python python-virtinst qemu bridge-utils
reboot
2. Bridge network 설정
#configure bridge:
vi /etc/sysconfig/network-scripts/ifcfg-br0
#I used these values:
BOOTPROTO=dhcp
DEVICE=br0
TYPE=Bridge
BROADCAST=192.168.1.255
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
vi /etc/sysconfig/network-scripts/ifcfg-eth0
#I used these values:DEVICE=eth0
HWADDR=00:1F:D0:D7:48:F2
ONBOOT=yes
BRIDGE=br0
NM_CONTROLLED=no
#then restart with:
/etc/init.d/network restart
기본으로 설정되는 NAT 네트워크(virbr0) 중지
virsh net-autostart default –disable
virsh net-destroy default
참고자료
Clustered Filesystem+with DRBD and OCFS2 on CentOS 5.5
http://wiki.virtastic.com/display/howto/Clustered+Filesystem+with+DRBD+and+OCFS2+on+CentOS+5.5
Dual-primary DRBD with OCFS2
http://rackerhacker.com/2011/02/13/dual-primary-drbd-with-ocfs2/
Centos5: OCFS2 cluster FS on dual primary DRBD: part 2 ? setup dual primary DRBD
http://server-support.co/blog/uncategorized/centos5-ocfs2-cluster-fs-on-dual-primary-drbd-part-2-setup-dual-primary-drbd/
Keep web servers in sync with DRBD and OCFS2
http://www.building43.com/blogs/2010/12/10/keep-web-servers-in-sync-with-drbd-and-ocfs2/
ocfs2 + drbd에서 활성 – 활성 클러스터 구성
http://ogawashingo.com/?p=253
Storage on Cluster DRBD and OCFS2
http://www.piemontewireless.net/Storage_on_Cluster_DRBD_and_OCFS2
Active-active DRBD with OCFS2
http://en.gentoo-wiki.com/wiki/Active-active_DRBD_with_OCFS2
Dual Primary DRBD + OCFS2
http://www.clusterlabs.org/wiki/Dual_Primary_DRBD_%2B_OCFS2
http://j2k.naver.com/j2k_frame.php/korean/yasu-2.blogspot.com/2010/03/ubuntu-804-ltsdrbd.html
http://j2k.naver.com/j2k_frame.php/korean/ycsparse.blog95.fc2.com/blog-entry-21.html
http://j2k.naver.com/j2k_frame.php/korean/jfut.integ.jp/2008/07/09/drbd%E3%81%A8%E3%82%AF%E3%83%A9%E3%82%B9%E3%82%BF%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0%E3%81%AE%E3%83%86%E3%82%B9%E3%83%88%E3%81%A7%E6%89%8B%E8%A9%B0%E3%81%BE/
http://j2k.naver.com/j2k_frame.php/korean/e-garakuta.net/techinfo/doku.php/linux/drbd
http://j2k.naver.com/j2k_frame.php/korean/info.ts-wg.com/Category/oss/ocfs2
원본 : http://blog.naver.com/PostView.nhn?blogId=junix&logNo=80125649478
Reading your article helped me a lot and I agree with you. But I still have some doubts, can you clarify for me? I’ll keep an eye out for your answers.
Reading your article helped me a lot and I agree with you. But I still have some doubts, can you clarify for me? I’ll keep an eye out for your answers.
Your article gave me a lot of inspiration, I hope you can explain your point of view in more detail, because I have some doubts, thank you.