pacemaker를_사용하여_nfs_ha_​​구성

Pacemaker를 사용하여 NFS HA ​​구성

원본출처 : https://www.unixarena.com/2016/08/configuring-nfs-ha-using-redhat-cluster-pacemaker-rhel-7.html

이 문서는 Redhat Enterprise Linux 7의 Pacemaker를 사용하여 고 가용성 NFS 서버를 설정하는 데 도움이 될 것입니다. 처음부터 패키지 설치, HA 자원 구성, 펜싱 (fencing) 등의 페이스 메이커 블록을 빌드 할 것입니다. NFS 공유는 홈 디렉토리를 공유하고 여러 서버에서 동일한 컨텐츠를 공유 할 수 있습니다. NFS HA는 NAS 스토리지를 구입할 여유가없는 고객에게 적합합니다. 이전에 Failover KVM VM 및 GFS를 설치 한 사례 가 있었습니다. 해당 내용을 읽어보지 않았다면 그것을 통해 pacemaker의 다양한 구성 요소와 작동 원리를 이해하십시오. 본 내용에서는 해당 부분은 심층적으로 다루지 않을 것입니다.

  • RHEL 7.x와 함께 설치된 두 개의 서버 (Hosts-UA-HA1 / UA-HA2)
  • Redhat Repository 또는 Local Repository에 액세스하여 패키지를 설치합니다.
  • SELINUX & Firewalld는 끌 수 있습니다.

1. 루트 사용자로 각 노드에 로그인하고 패키지를 설치하십시오.

# yum install pcs fence-agents-all

2. 두 노드 모두에서 SELINUX를 비활성화하십시오.

# setenforce 0
setenforce: SELinux is disabled
# cat /etc/selinux/config |grep SELINUX |grep -v "#"
SELINUX=disabled
SELINUXTYPE=targeted

3. 호스트에서 firewalld를 사용하지 않도록 설정합니다.

UA-HA# systemctl stop firewalld.service
UA-HA# systemctl disable firewalld.service
UA-HA# iptables --flush
UA-HA#

4. 노드에서 서비스를 활성화하고 시작하십시오.

# systemctl start pcsd.service
# systemctl enable pcsd.service
# systemctl status pcsd.service

5. 각 노드에서 hauser의 암호를 설정하십시오.

# passwd hacluster
Changing password for user hacluster.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

6. 클러스터 노드 중 하나에 로그인하여 hacluster사용자를 인증하십시오.

# pcs cluster auth UA-HA1 UA-HA2

7. pcs 명령을 사용하여 새 클러스터를 만듭니다. 클러스터 이름은 UACLS입니다.

# pcs cluster setup --name UACLS UA-HA1 UA-HA2

8. pcs 명령을 사용하여 클러스터를 시작하십시오. -all은 구성된 모든 노드에서 클러스터를 시작합니다.

# pcs cluster start –all

9. corosync 통신 상태를 확인하십시오.이 명령 출력에는 heartbeat에 사용 된 IP가 표시되어야합니다. (참고:configure-redundant-corosync)

# corosync-cfgtool –s

10-1. 자원을 구성하는 동안 문제를 피하려면 STONITH를 사용 불가능하게 하십시오. 클러스터 설정이 완료되면 펜싱을 다시 사용할 수있게됩니다.

# pcs property set stonith-enabled=false
# pcs property show stonith-enabled

10-2. ipmilan을 사용하여 펜싱(STONITH)을 구성하십시오.

# pcs stonith create UA-HA1_fen fence_ipmilan pcmk_host_list="UA-HA1" ipaddr=192.168.10.24 login=root  passwd=test123 lanplus=1 cipher=1 op monitor interval=60s
# pcs stonith create UA-HA2_fen fence_ipmilan pcmk_host_list="UA-HA2" ipaddr=192.168.10.25 login=root  passwd=test123 lanplus=1 cipher=1 op monitor interval=60s

이러한 IP는 펜싱에 사용되는 IDRAC 콘솔 IP입니다.

11. 클러스터 구성을 확인하십시오.

# crm_verify -L –V

12-1. 볼륨 그룹 및 논리 볼륨을 구성하십시오.

# vgcreate UAVG1 /dev/disk_name1
# vgcreate UAVG2 /dev/disk_#name2
# lvcreate -L sizeM -n /dev/UAVG1/UAVOL1
# lvcreate -L sizeM -n /dev/UAVG2/UAVOL2

12-2. 파일 시스템을 만듭니다. (이번 예제에서는 xfs로 생성합니다.)

# mkfs.xfs /dev/UAVG1/UAVOL1
# mkfs.xfs /dev/UAVG2/UAVOL2

13. 아래와 비슷한 LVM 구성을 수정하십시오. 모든 볼륨 그룹이 클러스터에서 사용된다고 가정합니다. root vg를 사용하는 경우 자동 가져 오기를 위해 lvm.conf에 지정해야합니다.

# grep use_lvmetad /etc/lvm/lvm.conf |grep -v "#"
use_lvmetad = 0

14. 대칭 클러스터 특성을 구성하고 상태를 점검하십시오.

# pcs property set symmetric-cluster=true
[root@UA-HA1 tmp]# pcs status
Cluster name: UACLS
Stack: corosync
Current DC: UA-HA2 (2) - partition with quorum
2 Nodes configured
2 Resources configured
Online: [ UA-HA1 UA-HA2 ]
Full list of resources:
UA-HA1_fen   (stonith:fence_ipmilan):        Started UA-HA2
UA-HA2_fen   (stonith:fence_ipmilan):        Started UA-HA1
PCSD Status:
UA-HA1: Online
UA-HA2: Online
Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled
[root@UA-HA1 tmp]# pcs stonith show
UA-HA1_fen   (stonith:fence_ipmilan):        Started
UA-HA2_fen   (stonith:fence_ipmilan):        Started
[root@UA-HA1 tmp]#

15.VG & Mount 리소스를 구성합니다.

# pcs resource create UAVG1_res LVM volgrpname="UAVG1" exclusive=true  --group UANFSHA
# pcs resource create UAVOL1_res Filesystem  device="/dev/UAVG1/UAVOL1" directory="/cm/shared" fstype="xfs" --group UANFSHA
# pcs resource create UAVG2_res LVM volgrpname="UAVG2" exclusive=true --group  UANFSHA
# pcs resource create UAVOL2_res Filesystem  device="/dev/UAVG2/UAVOL2" directory="/global/home" fstype="xfs" --group UANFSHA

16. NFS 공유를위한 VIP를 구성하십시오. 이 IP는 NFS 클라이언트에서 공유를 마운트하는 데 사용됩니다.

# pcs resource create ClusterIP ocf:heartbeat:IPaddr2 ip=192.168.2.90  nic="eth0" cidr_netmask=24 op monitor interval=30s --group UANFSHA

17. NFS 서버 자원을 구성하십시오.

[root@UA-HA1 ~]# pcs resource create NFS-D nfsserver nfs_shared_infodir=/global/nfsinfo nfs_ip=192.168.2.90  --group UANFSHA

18. 클러스터 상태를 확인하십시오.

[root@UA-HA1 ~]# pcs status
Cluster name: UACLS
Last updated: Tue Aug 16 12:39:22 2016
Last change: Tue Aug 16 12:39:19 2016 via cibadmin on UA-HA1
Stack: corosync
Current DC: UA-HA1 (1) - partition with quorum
Version: 1.1.10-29.el7-368c726
2 Nodes configured
8 Resources configured
Online: [ UA-HA1 UA-HA2 ]
Full list of resources:
UA-HA1_fen   (stonith:fence_ipmilan):        Started UA-HA1
UA-HA2_fen   (stonith:fence_ipmilan):        Started UA-HA1
Resource Group: UANFSHA
UAVG1_res  (ocf::heartbeat:LVM):   Started UA-HA1
UAVG2_res  (ocf::heartbeat:LVM):   Started UA-HA1
UAVOL1_res  (ocf::heartbeat:Filesystem):    Started UA-HA1
UAVOL2_res  (ocf::heartbeat:Filesystem):    Started UA-HA1
ClusterIP  (ocf::heartbeat:IPaddr2):       Started UA-HA1
NFS-D      (ocf::heartbeat:nfsserver):     Started UA-HA1 

19. HA NFS 공유를 구성하십시오.

[root@UA-HA1 ~]# pcs resource create nfs-cm-shared exportfs clientspec=192.168.2.0/255.255.255.0 options=rw,sync,no_root_squash directory=/SAP_SOFT fsid=0 --group UANFSHA
[root@UA-HA1 ~]# pcs resource create nfs-global-home  exportfs clientspec=10.248.102.0/255.255.255.0 options=rw,sync,no_root_squash directory=/users1/home fsid=1 --group UANFSHA

20. 최종 클러스터 상태는 다음과 유사합니다.

[root@UA-HA1 ~]# pcs status
Cluster name: UACLS
Last updated: Tue Aug 16 12:52:43 2016
Last change: Tue Aug 16 12:51:56 2016 via cibadmin on UA-HA1
Stack: corosync
Current DC: UA-HA1 (1) - partition with quorum
Version: 1.1.10-29.el7-368c726
2 Nodes configured
10 Resources configured
Online: [ UA-HA1 UA-HA2 ]
Full list of resources:
UA-HA1_fen   (stonith:fence_ipmilan):        Started UA-HA1
UA-HA2_fen   (stonith:fence_ipmilan):        Started UA-HA1
Resource Group: UANFSHA
UAVG1_res  (ocf::heartbeat:LVM):   Started UA-HA1
UAVG2_res  (ocf::heartbeat:LVM):   Started UA-HA1
UAVOL1_res  (ocf::heartbeat:Filesystem):    Started UA-HA1
UAVOL2_res  (ocf::heartbeat:Filesystem):    Started UA-HA1
ClusterIP  (ocf::heartbeat:IPaddr2):       Started UA-HA1
NFS-D      (ocf::heartbeat:nfsserver):     Started UA-HA1
nfs-cm-shared      (ocf::heartbeat:exportfs):      Started UA-HA1
nfs-global-home    (ocf::heartbeat:exportfs):      Started UA-HA1

21. 자원 종속성을 구성하십시오.

[root@UA-HA1 ~]# pcs constraint order start UAVG1_res then UAVOL1_res
[root@UA-HA1 ~]# pcs constraint order start UAVG2_res then UAVOL2_res
[root@UA-HA1 ~]# pcs constraint order start UAVOL1_res then ClusterIP
[root@UA-HA1 ~]# pcs constraint order start UAVOL2_res then ClusterIP 
[root@UA-HA1 ~]# pcs constraint order start ClusterIP then NFS-D
[root@UA-HA1 ~]# pcs  constraint order start NFS-D then nfs-cm-shared
[root@UA-HA1 ~]# pcs  constraint order start NFS-D then nfs-global-home
[root@UA-HA1 ~]# pcs constraint
Location Constraints:
Resource: UANFSHA
Enabled on: UA-HA1 (role: Started)
Ordering Constraints:
start UAVG1_res then start UAVOL1_res
start UAVG2_res then start UAVOL2_res
start UAVOL1_res then start ClusterIP
start UAVOL2_res then start ClusterIP
start ClusterIP then start NFS-D
start NFS-D then start nfs-cm-shared
start NFS-D then start nfs-global-home
Colocation Constraints:
[root@UA-HA1 ~]#

22. 다음 명령을 사용하여 NFS 공유를 확인할 수도 있습니다. (리소스가 현재 실행중인 위치를 실행해야 함)

[root@UA-HA1 ~]# showmount -e 192.168.2.90
Export list for 192.168.2.90:
/SAP_SOFT   192.168.2.0/255.255.255.0
/users1/home 192.168.2.0/255.255.255.0
[root@UA-HA1 ~]#
[root@UA-HA1 ~]# ifconfig eth0
ib0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 2044
inet 192.168.2.90  netmask 255.255.255.0  broadcast 0.0.0.0
inet6 fe80::7efe:9003:a7:851  prefixlen 64  scopeid 0x20

23. STONITH를 활성화하십시오.

# pcs property set stonith-enabled=true
# pcs property show stonith-enabled

24. NFS 클라이언트에 로그인하고 공유를 마운트하십시오.

# mkdir /users1/home 
# mkdir /SAP_SOFT
# mount -t nfs -o vers=4 192.168.2.90:/SAP_SOFT  /SAP_SOFT
# mount -t nfs -o vers=4 192.168.2.90:/users1/home  /users1/home

Redhat Enterprise Linux 7.x에서 pacemaker cluster suite를 사용하여 고 가용성 NFS 서버 v4를 성공적으로 설정했습니다.

리소스에 문제가있는 경우 다음 명령을 사용하여 상태를 지웁니다. 자원이 두 번 이상 오류가 발생하면 자원이 자동으로 금지 될 수 있습니다.

[root@UA-HA1 init.d]# pcs resource clear UANFSHA
로그인하면 댓글을 남길 수 있습니다.
  • pacemaker를_사용하여_nfs_ha_​​구성.txt
  • 마지막으로 수정됨: 2018/09/11 05:43
  • 저자 koov