6.3. 클러스터에서 NFS 서버의 리소스 및 리소스 그룹 구성
다음 절차에 따라 클러스터에서 NFS 서버에 대한 클러스터 리소스를 구성합니다.
클러스터의 펜싱 장치를 구성하지 않은 경우 기본적으로 리소스가 시작되지 않습니다.
구성한 리소스가 실행 중이 아닌지 확인하면 pcs resource debug-start resource
명령을 실행하여 리소스 구성을 테스트할 수 있습니다. 그러면 클러스터의 제어 및 지식 외부에서 서비스가 시작됩니다. 구성된 리소스가 다시 실행 중인 시점에서 pcs resourcecleanup 리소스
를 실행하여 클러스터에서 업데이트를 인식할 수 있도록 합니다.
절차
다음 절차에서는 시스템 리소스를 구성합니다. 이러한 리소스가 모두 동일한 노드에서 실행되도록 하려면 리소스 그룹 nfsgroup
의 일부로 구성됩니다. 리소스는 그룹에 추가하는 순서대로 시작하고 그룹에 추가된 반대 순서로 중지됩니다. 클러스터의 노드 중 하나에서만 이 절차를 실행합니다.
my_lvm
이라는 LVM 활성화 리소스를 만듭니다. 리소스 그룹nfsgroup
이 아직 존재하지 않기 때문에 이 명령은 리소스 그룹을 생성합니다.주의활성/수동 HA 구성에서 동일한
LVM 볼륨 그룹을 사용하는 LVM 활성화
리소스를 두 개 이상 구성하지 마십시오. 이러한 위험으로 데이터 손상이 발생할 수 있습니다. 또한 활성/수동 HA 구성에서LVM 활성화
리소스를 복제 리소스로 구성하지 마십시오.[root@z1 ~]# pcs resource create my_lvm ocf:heartbeat:LVM-activate vgname=my_vg vg_access_mode=system_id --group nfsgroup
클러스터 상태를 확인하여 리소스가 실행 중인지 확인합니다.
root@z1 ~]# pcs status Cluster name: my_cluster Last updated: Thu Jan 8 11:13:17 2015 Last change: Thu Jan 8 11:13:08 2015 Stack: corosync Current DC: z2.example.com (2) - partition with quorum Version: 1.1.12-a14efad 2 Nodes configured 3 Resources configured Online: [ z1.example.com z2.example.com ] Full list of resources: myapc (stonith:fence_apc_snmp): Started z1.example.com Resource Group: nfsgroup my_lvm (ocf::heartbeat:LVM-activate): Started z1.example.com PCSD Status: z1.example.com: Online z2.example.com: Online Daemon Status: corosync: active/enabled pacemaker: active/enabled pcsd: active/enabled
클러스터의
Filesystem
리소스를 구성합니다.다음 명령은
nfsgroup
리소스 그룹의 일부로nfsshare
라는 XFSFilesystem
리소스를 구성합니다. 이 파일 시스템은 XFS 파일 시스템으로 LVM 볼륨 구성에서 생성한 LVM 볼륨 그룹과 XFS 파일 시스템을 사용하며, NFS 공유 구성에서 생성한/nfsshare
디렉터리에 마운트됩니다.[root@z1 ~]# pcs resource create nfsshare Filesystem device=/dev/my_vg/my_lv directory=/nfsshare fstype=xfs --group nfsgroup
options
= 매개 변수를 사용하여
. 전체 구성 옵션에 대해Filesystem
리소스의 리소스 구성의 일부로 마운트 옵션을 지정할 수있습니다pcs resource describe Filesystem
명령을 실행합니다.my_lvm
및 tekton리소스가 실행
중인지 확인합니다.[root@z1 ~]# pcs status ... Full list of resources: myapc (stonith:fence_apc_snmp): Started z1.example.com Resource Group: nfsgroup my_lvm (ocf::heartbeat:LVM-activate): Started z1.example.com nfsshare (ocf::heartbeat:Filesystem): Started z1.example.com ...
리소스 그룹
nfsgroup
의 일부로nfs-daemon
이라는nfsserver
리소스를 생성합니다.참고nfsserver
리소스를 사용하면 NFS 서버에서 NFS 관련 상태 정보를 저장하는 데 사용하는 디렉터리인nfs_shared_infodir
매개변수를 지정할 수 있습니다.이 속성은 이 내보내기 컬렉션에서 생성한
Filesystem
리소스 중 하나의 하위 디렉터리로 설정하는 것이 좋습니다. 이렇게 하면 이 리소스 그룹을 재배치해야 하는 경우 NFS 서버에서 다른 노드에서 사용할 수 있게 되는 장치에 상태 저장 정보를 저장합니다. 예에서는 다음을 수행합니다.-
/octets는
Filesystem
리소스에서 관리하는 shared-storage 디렉터리입니다. -
/tekton/exports/export1
및/tekton/exports/export2
는 내보내기 디렉토리입니다. -
/octets/nfsinfo
는nfsserver
리소스의 shared-octets 디렉터리입니다.
[root@z1 ~]# pcs resource create nfs-daemon nfsserver nfs_shared_infodir=/nfsshare/nfsinfo nfs_no_notify=true --group nfsgroup [root@z1 ~]# pcs status ...
-
exportfs
리소스를 추가하여/tekton/exports
디렉터리를 내보냅니다. 이러한 리소스는 리소스 그룹nfsgroup
의 일부입니다. 이렇게 하면 NFSv4 클라이언트용 가상 디렉터리가 빌드됩니다. NFSv3 클라이언트는 이러한 내보내기에도 액세스할 수 있습니다.참고fsid=0
옵션은 NFSv4 클라이언트에 대한 가상 디렉터리를 생성하려는 경우에만 필요합니다. 자세한 내용은 NFS 서버의 /etc/exports 파일에서 fsid 옵션을 구성하는 방법을 참조하십시오.[root@z1 ~]# pcs resource create nfs-root exportfs clientspec=192.168.122.0/255.255.255.0 options=rw,sync,no_root_squash directory=/nfsshare/exports fsid=0 --group nfsgroup [root@z1 ~]# pcs resource create nfs-export1 exportfs clientspec=192.168.122.0/255.255.255.0 options=rw,sync,no_root_squash directory=/nfsshare/exports/export1 fsid=1 --group nfsgroup [root@z1 ~]# pcs resource create nfs-export2 exportfs clientspec=192.168.122.0/255.255.255.0 options=rw,sync,no_root_squash directory=/nfsshare/exports/export2 fsid=2 --group nfsgroup
NFS 클라이언트가 NFS 공유에 액세스하는 데 사용할 유동 IP 주소 리소스를 추가합니다. 이 리소스는 리소스 그룹
nfsgroup
의 일부입니다. 이 예제 배포 예에서는 유동 IP 주소로 192.168.122.200을 사용하고 있습니다.[root@z1 ~]# pcs resource create nfs_ip IPaddr2 ip=192.168.122.200 cidr_netmask=24 --group nfsgroup
전체 NFS 배포가 초기화되면 NFSv3 재부팅 알림을 전송하기 위한
nfsnotify
리소스를 추가합니다. 이 리소스는 리소스 그룹nfsgroup
의 일부입니다.참고NFS 알림을 올바르게 처리하려면 유동 IP 주소에 NFS 서버와 NFS 클라이언트에서 일관성 있는 호스트 이름이 연결되어 있어야 합니다.
[root@z1 ~]# pcs resource create nfs-notify nfsnotify source_host=192.168.122.200 --group nfsgroup
리소스 및 리소스 제약 조건을 생성한 후 클러스터 상태를 확인할 수 있습니다. 모든 리소스가 동일한 노드에서 실행되고 있습니다.
[root@z1 ~]# pcs status ... Full list of resources: myapc (stonith:fence_apc_snmp): Started z1.example.com Resource Group: nfsgroup my_lvm (ocf::heartbeat:LVM-activate): Started z1.example.com nfsshare (ocf::heartbeat:Filesystem): Started z1.example.com nfs-daemon (ocf::heartbeat:nfsserver): Started z1.example.com nfs-root (ocf::heartbeat:exportfs): Started z1.example.com nfs-export1 (ocf::heartbeat:exportfs): Started z1.example.com nfs-export2 (ocf::heartbeat:exportfs): Started z1.example.com nfs_ip (ocf::heartbeat:IPaddr2): Started z1.example.com nfs-notify (ocf::heartbeat:nfsnotify): Started z1.example.com ...