第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

  1. Create an LVM-activate resource.

    # pcs resource create my_lvm ocf:heartbeat:LVM-activate vgname=my_vg vg_access_mode=system_id --group apachegroup
  2. Create a Filesystem resource.

    # pcs resource create my_fs Filesystem device="/dev/my_vg/my_lv" directory="/var/www" fstype="xfs" --group apachegroup
  3. Create an IPaddr2 resource.

    # pcs resource create VirtualIP IPaddr2 ip=198.51.100.3 cidr_netmask=24 --group apachegroup
  4. Create an Apache resource.

    # pcs resource create Website apache configfile="/etc/httpd/conf/httpd.conf" statusurl="http://127.0.0.1/server-status" --group apachegroup
  5. Display the pcs commands 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 Website
  6. Display the pcs command you can use to re-create only the IPaddr2 resource. 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
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2026 Red Hat
トップに戻る