5.3. 클러스터에서 NFS 서버의 리소스 및 리소스 그룹 구성
클러스터에서 NFS 서버의 클러스터 리소스를 구성할 수 있습니다.
클러스터의 펜싱 장치를 구성하지 않은 경우 기본적으로 리소스가 시작되지 않습니다.
구성한 리소스가 실행되고 있지 않은 경우 pcs resource debug-start resource 명령을 실행하여 리소스 구성을 테스트할 수 있습니다. 이렇게 하면 클러스터의 제어 및 지식 외부에서 서비스가 시작됩니다. 구성된 리소스가 다시 실행 중인 시점에 pcs resourcecleanup 리소스 를 실행하여 클러스터에 업데이트를 알립니다.
다음 절차에서는 시스템 리소스를 구성합니다. 이러한 리소스가 모두 동일한 노드에서 실행되도록 리소스 그룹 nfsgroup 의 일부로 구성됩니다. 리소스는 그룹에 추가하는 순서대로 시작되고 그룹에 추가된 역순으로 중지합니다. 클러스터의 한 노드에서만 이 절차를 실행합니다.
프로세스
my_lvm이라는 LVM-activate 리소스를 만듭니다. 리소스 그룹nfsgroup이 아직 존재하지 않기 때문에 이 명령은 리소스 그룹을 생성합니다.주의이 위험이 데이터 손상될 수 있으므로 활성/수동 HA 구성에서 동일한 LVM 볼륨 그룹을 사용하는 두 개 이상의 LVM
활성화리소스를 구성하지 마십시오. 또한LVM-activate리소스를 활성/수동 HA 구성에 복제 리소스로 구성하지 마십시오.[root@z1 ~]# pcs resource create my_lvm ocf:heartbeat:LVM-activate vgname=my_vg vg_access_mode=system_id --group nfsgroup클러스터 상태를 확인하여 리소스가 실행 중인지 확인합니다.
root@z1 ~]# pcs statusCluster 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리소스를 구성합니다.다음 명령은
nfsshare라는 XFSFilesystem리소스를nfsgroup리소스 그룹의 일부로 구성합니다. 이 파일 시스템은 클러스터의 XFS 파일 시스템으로 LVM 볼륨 구성에서 생성한 LVM 볼륨 그룹과 XFS 파일 시스템을 사용하며, NFS 공유 구성에서 생성한/nfsshare디렉터리에 마운트됩니다.[root@z1 ~]# pcs resource create nfsshare Filesystem device=/dev/my_vg/my_lv directory=/nfsshare fstype=xfs --group nfsgroupoptions= options매개변수를 사용하여Filesystem리소스의 리소스 구성의 일부로 마운트 옵션을 지정할 수있습니다. 전체 구성 옵션에 대해pcs resource describe Filesystem명령을 실행합니다.my_lvm및nfsshare리소스가 실행 중인지 확인합니다.[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 서버에서 다른 노드에서 사용할 수 있게 되는 장치에 상태 저장 정보를 저장하고 있습니다. 이 예에서는; In this example;-
/nfsshare는Filesystem리소스에서 관리하는 shared-storage 디렉터리입니다. -
/nfsshare/exports/export1및/nfsshare/exports/export2는 내보내기 디렉터리입니다. -
/nfsshare/nfsinfo는nfsserver리소스의 shared-information 디렉터리입니다.
[root@z1 ~]# pcs resource create nfs-daemon nfsserver nfs_shared_infodir=/nfsshare/nfsinfo nfs_no_notify=true --group nfsgroup [root@z1 ~]# pcs status ...-
exportfs리소스를 추가하여/nfsshare/exports디렉터리를 내보냅니다. 이러한 리소스는 리소스 그룹nfsgroup의 일부입니다. 그러면 NFSv4 클라이언트용 가상 디렉터리가 빌드됩니다. NFSv3 클라이언트는 이러한 내보내기에도 액세스할 수 있습니다.참고fsid=0옵션은 NFSv4 클라이언트용 가상 디렉터리를 생성하려는 경우에만 필요합니다. 자세한 내용은 Red Hat Knowledgebase 솔루션에서 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 nfsgroupNFS 클라이언트가 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 ...