第17章 Managing cluster resources
There are a variety of commands you can use to display, modify, and administer cluster resources.
17.1. Exporting cluster resources as pcs commands リンクのコピーリンクがクリップボードにコピーされました!
You can display the pcs commands that can be used to re-create configured cluster resources on a different system using the --output-format=cmd option of the pcs resource config command.
The following example procedure creates four resources for an active/passive Apache HTTP server in a Red Hat high availability cluster and then displays the pcs commands you can use to recreate those resources.
Procedure
Create an
LVM-activateresource.# pcs resource create my_lvm ocf:heartbeat:LVM-activate vgname=my_vg vg_access_mode=system_id --group apachegroupCreate a
Filesystemresource.# pcs resource create my_fs Filesystem device="/dev/my_vg/my_lv" directory="/var/www" fstype="xfs" --group apachegroupCreate an
IPaddr2resource.# pcs resource create VirtualIP IPaddr2 ip=198.51.100.3 cidr_netmask=24 --group apachegroupCreate an
Apacheresource.# pcs resource create Website apache configfile="/etc/httpd/conf/httpd.conf" statusurl="http://127.0.0.1/server-status" --group apachegroupDisplay the
pcscommands you can use to re-create the four resources you created on a different system.# pcs resource config --output-format=cmd pcs resource create --no-default-ops --force -- my_lvm ocf:heartbeat:LVM-activate \ vg_access_mode=system_id vgname=my_vg \ op \ monitor interval=30s id=my_lvm-monitor-interval-30s timeout=90s \ start interval=0s id=my_lvm-start-interval-0s timeout=90s \ stop interval=0s id=my_lvm-stop-interval-0s timeout=90s; pcs resource create --no-default-ops --force -- my_fs ocf:heartbeat:Filesystem \ device=/dev/my_vg/my_lv directory=/var/www fstype=xfs \ op \ monitor interval=20s id=my_fs-monitor-interval-20s timeout=40s \ start interval=0s id=my_fs-start-interval-0s timeout=60s \ stop interval=0s id=my_fs-stop-interval-0s timeout=60s; pcs resource create --no-default-ops --force -- VirtualIP ocf:heartbeat:IPaddr2 \ cidr_netmask=24 ip=198.51.100.3 \ op \ monitor interval=10s id=VirtualIP-monitor-interval-10s timeout=20s \ start interval=0s id=VirtualIP-start-interval-0s timeout=20s \ stop interval=0s id=VirtualIP-stop-interval-0s timeout=20s; pcs resource create --no-default-ops --force -- Website ocf:heartbeat:apache \ configfile=/etc/httpd/conf/httpd.conf statusurl=http://127.0.0.1/server-status \ op \ monitor interval=10s id=Website-monitor-interval-10s timeout=20s \ start interval=0s id=Website-start-interval-0s timeout=40s \ stop interval=0s id=Website-stop-interval-0s timeout=60s; pcs resource group add apachegroup \ my_lvm my_fs VirtualIP WebsiteDisplay the
pcscommand you can use to re-create only theIPaddr2resource. To display only one configured resource, specify the resource ID for that resource.# pcs resource config VirtualIP --output-format=cmd pcs resource create --no-default-ops --force -- VirtualIP ocf:heartbeat:IPaddr2 \ cidr_netmask=24 ip=198.51.100.3 \ op \ monitor interval=10s id=VirtualIP-monitor-interval-10s timeout=20s \ start interval=0s id=VirtualIP-start-interval-0s timeout=20s \ stop interval=0s id=VirtualIP-stop-interval-0s timeout=20s