Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 14. Exporting resource constraints as pcs commands
You can display the pcs commands that can be used to re-create configured resource constraints on a different system using the --output-format=cmd option of the pcs constraint command.
The following example procecures creates two resources, configures three resource constraints, and displays the xi`pcs` commands you can use to re-create the constraints on a different system.
Procedure
Create an
IPaddr2resource namedVirtualIP.# pcs resource create VirtualIP IPaddr2 ip=198.51.100.3 cidr_netmask=24 Assumed agent name 'ocf:heartbeat:IPaddr2' (deduced from 'IPaddr2')Create an
apacheresource namedWebsite.# 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')Configure a location constraint for the
Websiteresource.# pcs constraint location Website avoids node1Configure a colocation constraint for the
WebsiteandVirtualIPresources.# pcs constraint colocation add Website with VirtualIPConfigure an order constraint for the
WebsiteandVirtualIPresources.# pcs constraint order VirtualIP then Website Adding VirtualIP Website (kind: Mandatory) (Options: first-action=start then-action=start)Display the
pcscommands you can use to re-create the constraints on a different system.# pcs constraint --output-format=cmd pcs -- 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