Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

3.5. 클러스터 리소스 설정

다음 부분에서는 아래와 같은 용도로 클러스터 리소스를 설정하는 절차가 설명됩니다.

참고

pcs resource create를 사용해서 클러스터 리소스를 생성하면 그 리소스가 아직 실행중인지 확인하기 위해 즉시 pcs status 명령을 실행하는 것이 권장됩니다. 사용자의 클러스터를 위한 차단 장치를 1.3절. “차단 장치 설정”에 나와 있는 것처럼 설정하지 않았다면 기본값으로 리소스가 시작되지 않습니다.
사용자가 설정한 리소스가 실행되고 있지 않다면, 그 리소스의 설정을 테스트하기 위해 pcs resource debug-start resource 명령을 실행할 수 있습니다. 이렇게 하면 클러스터의 제어와 인식 밖에서 서비스가 시작됩니다. 설정된 리소스가 다시 실행되는 시점에 pcs cluster cleanup resource 를 실행해서 클러스터가 업데이트에 대해 알고 있도록 합니다. pcs resource debug-start 명령에 대한 자세한 내용은 High Availability Add-On Reference 설명을 참조하십시오.
다음의 절차에 따라 시스템 리소스를 설정합니다. 이 리소스가 모두 같은 노드에서 실행되도록 하기 위해 nfsgroup 리소스 그룹의 일부로 설정됩니다. 사용자가 리소스를 그룹에 추가한 순서대로 리소스가 시작되며, 그룹에 추가된 역순으로 중지됩니다. 클러스터의 단 하나의 노드에서만 이 절차를 실행합니다.
  1. 다음의 명령을 사용해서 my_lvm이라는 이름의 LVM 리소스를 생성합니다. 오직 클러스터만이 LVM 논리 볼륨을 활성화할 수 있도록 하기 위해 이 명령은 exclusive=true 매개 변수를 지정합니다. 아직 nfsgroup 리소스 그룹이 존재하지 않으므로 이 명령은 리소스 그룹을 생성합니다.
    [root@z1 ~]# pcs resource create my_lvm LVM volgrpname=my_vg \
    exclusive=true --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):   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
  2. 클러스터를 위한 Filesystem 리소스를 설정합니다.

    참고

    options=options 매개 변수를 가지고 있는 Filesystem 리소스를 위한 리소스 설정의 일부로써 마운트 옵션을 지정할 수 있습니다. 전체 설정 옵션을 표시하려면 pcs resource describe Filesystem 명령을 실행합니다.
    다음의 명령을 사용해서 nfsgroup 리소스 그룹의 일부로써 nfsshare라는 이름의 ext4 Filesystem 리소스를 설정합니다. 이 파일 시스템은 사용자가 3.2절. “ext4 파일 시스템이 있는 LVM 볼륨 설정”에서 생성한 LVM 볼륨 그룹과 ext4 파일 시스템을 사용하며 사용자가 3.3절. “NFS 공유 설정”에서 생성한 /nfsshare 디렉토리에 마운트됩니다.
    [root@z1 ~]# pcs resource create nfsshare Filesystem \
    device=/dev/my_vg/my_lv directory=/nfsshare \
    fstype=ext4 --group nfsgroup
    my_lvmnfsshare 리소스가 실행중인지 확인합니다.
    [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):   Started z1.example.com
         nfsshare   (ocf::heartbeat:Filesystem):    Started z1.example.com
    ...
  3. nfsgroup 리소스 그룹의 일부로써 nfs-daemon이라는 이름의 nfsserver 리소스를 생성합니다.
    [root@z1 ~]# pcs resource create nfs-daemon nfsserver \
    nfs_shared_infodir=/nfsshare/nfsinfo nfs_no_notify=true \
    --group nfsgroup
    [root@z1 ~]# pcs status
    ...
  4. /nfsshare/exports 디렉토리를 내보내기 위해 exportfs 리소스를 추가합니다. 이 리소스는 nfsgroup 리소스 그룹의 일부입니다. 이것은 NFSv4 클라이언트를 위한 가상 디렉토리를 구축합니다. NFSv3 클라이언트도 이렇게 내보낸 디렉토리에 액세스할 수 있습니다.
    [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
  5. nfs 클라이언트가 nfs 공유에 액세스하기 위해 사용할 부동 IP 주소를 추가합니다. 사용자가 지정하는 부동 IP 주소는 DNS 역방향 검색이 요구되거나 또는 클러스터에 있는 모든 노드의 /etc/hosts에 지정되어 있어야 합니다. 이 리소스는 nfsgroup 리소스 그룹의 일부입니다. 다음의 배포 예시에서는 192.168.122.200을 부동 IP 주소로 사용하고 있습니다.
    [root@z1 ~]# pcs resource create nfs_ip IPaddr2 \
    ip=192.168.122.200 cidr_netmask=24 --group nfsgroup
  6. 전체 NFS 배포가 초기화된 후 NFSv3 재부팅 알림을 보내기 위한 nfsnotify 리소스를 추가합니다.

    참고

    NFS 알림이 올바르게 처리되려면 부동 IP 주소와 연결된 호스트명이 반드시 있어야 하며, 이 호스트명은 nfs 서버와 nfs 클라이언트 모두에서 일관되어야 합니다.
    [root@z1 ~]# pcs resource create nfs-notify nfsnotify \
    source_host=192.168.122.200
리소스와 리소스 제한을 생성한 후 클러스터의 상태를 확인할 수 있습니다. 모든 리소스가 동일한 노드에서 실행중인 것을 확인합니다.
[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):   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
...