Pacemaker / corosync 기반의 클러스터 구축 및 VIP 설정
사전 정보
OS : CentOS7.9 _x86_64
119.194.142.179 pcs-01
119.194.142.162 pcs-02
119.194.142.171 VIP
install pkg
yum -y install epel-release
yum -y install pcs pacemaker
hosts 설정 추가
119.194.142.179 pcs-01
119.194.142.162 pcs-02
119.194.142.171 pcs-cluster
pacemaker start & enable
systemctl start pcsd
systemctl enable pcsd
PCS 설치 후 생성된 hacluster 계정에 대한 패스워드 설정
passwd hacluster
이후 설정은 하나의 노드에서만 진행
Cluster 인증
pcs cluster auth pcs-01 pcs-02
pcs cluster setup
pcs cluster setup --start --name pcs-cluster pcs-01 pcs-02
Set VIP
pcs resource create PCS_VIP ocf:heartbeat:IPaddr2 ip=119.194.142.171 cidr_netmask=32 nic=eth0 iflabel=0 op monitor interval=30s --group pcs-cluster
change VIP
pcs resource update PCS_VIP ip=119.194.142.172 nic=eth0 -> 기존의 171 번 VIP가 172번으로 실시간 변경 됨
delete VIP
pcs delete update PCS_VIP -> VIP삭제
Resource add monitor
pcs resource create app_name systemd:systemd-app op monitor timeout=3s interval=5s on-fail=standby --group pcs-cluster
* systemd-app : systemd에 등록되어 있는 데몬명을 입력 / app_name : 리소스 모니터 등록 명
* --group pcs-cluster 두가지 이상의 리소스를(VIP or app) 동시에 처리하기 위해서 그룹을 동일하게 설정한다.
Resource delete monitor
pcs resource delete app_name -> 모니터 리소스 삭제
Ser property
pcs property set stonith-enabled=false ( VIP 생성을 위한 설정 )
pcs property set no-quorum-policy=ignore
Cluster Enable
pcs cluster enable --all
* 장애 시 standby 로 빠진 서버는 장애 처리 후에 cluster에서 stop - start 필요
* failback 되지 않음.
pcs cluster stop pcs-01
pcs cluster start pcs-01
몇가지 상태 확인 방법
pcs status
pcs config
pcs cluster status
pcs resource show
corosync-cfgtool -s
corosync-cmapctl | grep members