Configure HA with DRBD on CentOS 7 #2 Pacemaker

고 가용성을 위한 DRBD 구성 가이드 2편 – Pacemaker 설치

DRBD 를 이용한 고 가용성 구성을 위해 Configure HA with DRBD on CentOS 7 #1 DRBD | Umount Blog 에서 DRBD 를 설치하고 구성하는 방법에 대해서 알아 보았습니다. 이번에는 Pacemaker 설치 및 구성에 대해서 알아보도록 하겠습니다.

Pacemaker 는 고 가용성을 위해 클러스터를 구성 및 관리를 할 수 있는 클러스터 리소스 관리자의 역활을 해주는 오픈소스 입니다. 예를 들어 마스터와 백업 서버가 하나의 클러스터로 묶여 있는 상태에서 마스터 노드에 장애 발생 시 백업 서버로 서비스를 넘겨주는 방식입니다.

이 서비스를 DRBD 와 함께 사용한다면 DRBD 는 데이터 복제를 담당하고 Pacemaker(이하 페이스메이커) 는 장애 인지 후 백업 서버로 서비스를 전환해 주는 역활을 담당하여 최소한의 다운타임으로 서비스 연속성을 유지할 수 있는 것입니다. 이 방법은 Active-Standby 방식이며, 페이스메이커에서는 Active-Active 방식도 지원 됩니다.

페이스메이커 구성

마스터 / 백업 서버 공통 작업

HOSTNAME 추가
: vi /etc/hosts

10.19.10.196 10-19-10-196
10.19.10.197 10-19-10-197

패키지 설치

[root@10-19-10-196 /]# yum install -y pacemaker corosync pcs

마스터 및 백업 서버 간 인증을 위한 비밀번호 설정
hacluster 계정은 페이스메이커 설치 시 자동 생성 됩니다.

[root@10-19-10-196 /]# passwd hacluster

서비스 실행 및 등록

[root@10-19-10-196 /]# systemctl start pcsd
[root@10-19-10-196 /]# systemctl enable pcsd
[root@10-19-10-196 /]# systemctl enable corosync
[root@10-19-10-196 /]# systemctl enable pacemaker

마스터 서버 작업

페이스메이커 인증 확인

위에서 설정한 hacluster 의 비밀번호 입력 해 주시면 됩니다.

[root@10-19-10-196 /]# pcs cluster auth 10-19-10-196 10-19-10-197

클러스터 구성

[root@10-19-10-196 /]# pcs cluster setup --start --name storage_cluster 10-19-10-196 10-19-10-197 --transport udpu
[root@10-19-10-196 /]# pcs property set stonith-enabled=false
[root@10-19-10-196 /]# pcs property set no-quorum-policy=ignore
[root@10-19-10-196 /]# pcs property set default-resource-stickiness=100

리소스 등록

Line 1 은 페이스메이커에서 사용되는 CIB(cluster Information Base) 형식의 RAW XML 을 sshfs_config 라는 이름으로 생성 하는 명령 입니다.

Line 2 ~ 8 는 VIP 를 넣어주는 등, 리소스를 만들고 서로 매핑 시켜줍니다.

Line 9 는 cib-push 를 이용하여 설정 사항을 업데이트 해줍니다.

[root@10-19-10-196 /]# pcs cluster cib sshfs_config
[root@10-19-10-196 /]# pcs -f sshfs_config resource create Storage_VIP ocf:heartbeat:IPaddr2 ip=10.19.10.195 cidr_netmask=32 nic=eth0 op monitor interval="5" timeout="10"
[root@10-19-10-196 /]# pcs -f sshfs_config resource create Storage_Resource ocf:linbit:drbd drbd_resource=file_storage op monitor timeout="30" interval="5" role="Master" op monitor timeout="30" interval="6" role="Slave"
[root@10-19-10-196 /]# pcs -f sshfs_config resource master DataSync Storage_Resource master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
[root@10-19-10-196 /]# pcs -f sshfs_config resource create Filesystem ocf:heartbeat:Filesystem device="/dev/drbd0" directory="/data" fstype="xfs" options="noatime"
[root@10-19-10-196 /]# pcs -f sshfs_config resource group add HA-GROUP Storage_VIP Filesystem
[root@10-19-10-196 /]# pcs -f sshfs_config constraint colocation add HA-GROUP DataSync INFINITY with-rsc-role=Master
[root@10-19-10-196 /]# pcs -f sshfs_config constraint order promote DataSync then start Filesystem
[root@10-19-10-196 /]# pcs cluster cib-push sshfs_config

클러스터 시작

[root@10-19-10-196 /]# pcs cluster start --all

클러스터 상태 확인

[root@10-19-10-196 /]# pcs cluster status
Cluster Status:
 Stack: corosync
 Current DC: 10-19-10-196 (version 1.1.20-5.el7_7.2-3c4c782f70) - partition with quorum
 Last updated: Mon Mar 30 12:05:03 2020
 Last change: Fri Mar 20 17:13:58 2020 by root via cibadmin on 10-19-10-196
 2 nodes configured
 4 resources configured

PCSD Status:
  10-19-10-197: Online
  10-19-10-196: Online
[root@10-19-10-196 /]# pcs status
Cluster name: storage_cluster
Stack: corosync
Current DC: 10-19-10-196 (version 1.1.20-5.el7_7.2-3c4c782f70) - partition with quorum
Last updated: Mon Mar 30 12:05:07 2020
Last change: Fri Mar 20 17:13:58 2020 by root via cibadmin on 10-19-10-196

2 nodes configured
4 resources configured

Online: [ 10-19-10-196 10-19-10-197 ]

Full list of resources:

 Master/Slave Set: DataSync [Storage_Resource]
     Masters: [ 10-19-10-196 ]
     Slaves: [ 10-19-10-197 ]
 Resource Group: HA-GROUP
     Storage_VIP	(ocf::heartbeat:IPaddr2):	Started 10-19-10-196
     Filesystem	(ocf::heartbeat:Filesystem):	Started 10-19-10-196

Daemon Status:
  corosync: active/disabled
  pacemaker: active/disabled
  pcsd: active/enabled

장애 조치

장애가 발생하면 해당 서버는 클러스터상에서 offline 으로 표시 됩니다. 장애 조치 완료 후 해당 서버를 다시 클러스터에 등록 해 주어야 online 으로 표시 됩니다. 아래는 다시 클러스터에 등록하는 방법입니다.

  1. drbdadm up [resouce_name] 또는 drbdadm up all 명령어를 이용하여 DRBD 에서 상태를 up 시켜 줍니다.
  2. 마스터 서버에서 pcs cluster status 명령어를 이용하여 모든 서버가 online 상태인지 확인 합니다.
  3. online 상태가 확인되었다면 마스터 서버에서 pcs cluster start –all 명령어를 이용하여 클러스터를 재시작 해 줍니다.
  4. pcs status 명령어를 이용하여 DC 및 VIP 등을 확인하고 등록된 노드들이 모두 online 인지 확인 해 줍니다.

You may also like...

Subscribe
Notify of
guest

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x