10. Configuring DRBD (both)
vi /etc/drbd.conf
(빨간색 ip 정보는 각자 환경에 맞게 수정)
global {
usage-count no;
}
common {
syncer { rate 100M; }
protocol C;
}
resource postgres {
startup {
wfc-timeout 30;
outdated-wfc-timeout 20;
degr-wfc-timeout 30;
}
disk { on-io-error detach; }
on cos1.local {
device /dev/drbd0;
disk /dev/sdb;
address 10.0.0.139:7791;
meta-disk internal;
}
on cos2.local {
device /dev/drbd0;
disk /dev/sdb;
address 10.0.0.140:7791;
meta-disk internal;
}
}
10.1 iptables 수정
vi /etc/sysconfig/iptables
아래 내용 추가
-A INPUT -m state --state NEW -m udp -p udp --dport 5404 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 5405 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5444 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 7791 -j ACCEPT
service iptables restart
11. VM 이라면 hdd 추가하기 (both)
: /dev/sdb 로 잡힐 하드디스크 추가하기
fdisk -l 로 보이는지 확인
12. meta data 생성 (both)
앞서 선언한 resource인 postgres라는 이름으로 meta data를 생성한다.
drbdadm create-md postgres
drbdadm up postgres
-> 한쪽 노드는 아래 에러 나옴
postgres: Failure: (102) Local address(port) already in use.
Command 'drbdsetup-84 connect postgres ipv4:10.0.0.139:7791 ipv4:10.0.0.140:7791 --protocol=C' terminated with exit code 10
node1:
drbdadm -- --overwrite-data-of-peer primary postgres
* To check the progress of the sync, and status of DRBD resource, look at /proc/drbd (both)
cat /proc/drbd
100% 될때까지 기다린다.
완료되면 node 1, node 2 에서는 각각 cat /proc/drbd 했을 때 출력이 다음과 같아야 한다.
node 1:
[root@cos1 ppas]# cat /proc/drbd
version: 8.4.6 (api:1/proto:86-101)
GIT-hash: 833d830e0152d1e457fa7856e71e11248ccf3f70 build by phil@Build64R6, 2015-04-09 14:35:00
0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----
ns:3145596 nr:0 dw:0 dr:3146268 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
node 2:
[root@cos2 ~]# cat /proc/drbd
version: 8.4.6 (api:1/proto:86-101)
GIT-hash: 833d830e0152d1e457fa7856e71e11248ccf3f70 build by phil@Build64R6, 2015-04-09 14:35:00
0: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r-----
ns:0 nr:3145596 dw:3145596 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
13. Format the DRBD device (node1)
mkfs.ext4 /dev/drbd0
* mount (node1)
mount -t ext4 /dev/drbd0 /var/lib/ppas
or
mount -t ext4 /dev/drbd0 /var/lib/pgsql
* chown (node1)
chown -R enterprisedb:enterprisedb /var/lib/ppas
or
chown -R enterprisedb:enterprisedb /var/lib/pgsql
댓글 없음:
댓글 쓰기