pacemaker 이중화 구성(Active-Standby) #1 - pacemaker 설치

Logic·2023년 8월 21일

pacemaker를 사용하여 이중화 구성(Active-Standby)를 구성하는 방법을 작성해본다.

resource 이중화와 함께 파일 시스템 동기화, db replication도 추후에 작성할 예정이다.

서버구성

  • 노드1
    hostname : host1
    OS : CentOS 7

  • 노드2
    hostname : host2
    OS : CentOS 7

1. 양쪽 노드 모두에 pacemaker를 설치한다.

# yum install -y pacemaker corosync pcs

2. 호스트 등록

/etc/hosts 파일에 다음과 같이 양쪽 노드의 hostname을 등록해준다.

<1번노드 ip> host1
<2번노드 ip> host2

3. 서비스 시작 / 등록

pcsd / pacemaker / corosync 서비스를 시작하고 부팅 시 자동으로 시작되도록 enable 시켜준다.

# systemctl start pcsd.service
# systemctl enable pcsd.service
# systemctl start pacemaker.service
# systemctl enable pacemaker.service
# systemctl start corosync.service
# systemctl enable corosync.service

4. hacluster 비밀번호 변경

pacemaker 설치시 자동으로 생성되는 hacluster 계정의 비밀번호를 변경해준다.

# passwd hacluster
hacluster 사용자의 비밀 번호 변경 중
새  암호:
새  암호 재입력:
passwd: 모든 인증 토큰이 성공적으로 업데이트 되었습니다.

5. cluster 설정

corosync를 설정해준다.

# pcs cluster auth host1 host2

corosync를 동기화해준다.

# pcs cluster setup --name hacluster host1 host2

6. cluster 시작 / 확인

cluster를 시작한다.

# pcs cluster start --all

cluster 및 구성을 확인한다.

# pcs status
Cluster name: hacluster
Stack: corosync
Current DC: host2 (version 1.1.23-1.el7_9.1-9acf116022) - partition with quorum
Last updated: Mon Aug 21 16:57:18 2023
Last change: Fri Aug 18 17:20:45 2023 by hacluster via crmd on host1

2 nodes and 0 resources configured

Online: [ host1 host2 ]

No resources

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

7. STONITH 비활성화

# pcs property set stonith-enabled=false
# crm_verify -L -V

다음 포스팅에서는 pacemaker의 resource agent를 등록하는 방법을 서술하도록 하겠다.

profile
평범한 개발자입니다.

0개의 댓글