15장. 리소스 제약 조건을 pcs 명령으로 내보내기
명령의 pcs constraint--output-format=cmd 옵션을 사용하여 다른 시스템에서 구성된 리소스 제약 조건을 다시 생성하는 데 사용할 수 있는 pcs 명령을 표시할 수 있습니다.
다음 예제에서는 두 개의 리소스를 생성하고, 세 개의 리소스 제약 조건을 구성하고, 다른 시스템에서 제약 조건을 다시 만드는 데 사용할 수 있는 xi의pcs 명령을 표시합니다.
절차
VirtualIP라는IPaddr2리소스를 생성합니다.# pcs resource create VirtualIP IPaddr2 ip=198.51.100.3 cidr_netmask=24Assumed agent name 'ocf:heartbeat:IPaddr2' (deduced from 'IPaddr2')website라는apache리소스를 생성합니다.# pcs resource create Website apache configfile="/etc/httpd/conf/httpd.conf" statusurl="http://127.0.0.1/server-status"Assumed agent name 'ocf:heartbeat:apache' (deduced from 'apache')website 리소스에 대한 위치 제한 조건
을구성합니다.# pcs constraint location Website avoids node1website및VirtualIP리소스에 대한 공동 배치 제약 조건을 구성합니다.# pcs constraint colocation add Website with VirtualIPwebsite및VirtualIP리소스에 대한 주문 제한 조건을 구성합니다.# pcs constraint order VirtualIP then WebsiteAdding VirtualIP Website (kind: Mandatory) (Options: first-action=start then-action=start)다른 시스템에서 제약 조건을 다시 생성하는 데 사용할 수 있는
pcs명령을 표시합니다.# pcs constraint --output-format=cmdpcs -- constraint location add location-Website-node1--INFINITY resource%Website node1 -INFINITY; pcs -- constraint colocation add Website with VirtualIP INFINITY \ id=colocation-Website-VirtualIP-INFINITY; pcs -- constraint order start VirtualIP then start Website \ id=order-VirtualIP-Website-mandatory