Show Table of Contents
6.6. リソースの動作
リソースに健全性を維持させるためリソースの定義にモニタリングの動作を追加することができます。モニタリングの動作を指定しないと、
pcs コマンドはデフォルトでモニタリングの動作を作成します。モニタリングの間隔はリソースエージェントで確定されます。リソースエージェントでデフォルトのモニタリング間隔が提供されない場合は pcs コマンドにより 60 秒間隔のモニタリング動作が作成されます。
表6.4「動作のプロパティ」 にリソースのモニタリング動作のプロパティを示します。
表6.4 動作のプロパティ
次のコマンドでリソースを作成するとモニタリングの動作を設定することができます。
pcs resource create resource_id standard:provider:type|type [resource_options] [op operation_action operation_options [operation_type operation_options]...]
例えば、次のコマンドはモニタリング動作付きの
IPaddr2 リソースを作成します。新しいリソースには VirtualIP という名前が付けられ、eth2 で IP アドレス 192.168.0.99、ネットマスク 24 になります。モニタリング動作は 30 秒毎に実施されます。
# pcs resource create VirtualIP ocf:heartbeat:IPaddr2 ip=192.168.0.99 cidr_netmask=24 nic=eth2 op monitor interval=30s
また、次のコマンドで既存のリソースにモニタリング動作を追加することもできます。
pcs resource op add resource_id operation_action [operation_properties]
設定されているリソースの動作を削除する場合は次のコマンドを使用します。
pcs resource op remove resource_id operation_name operation_properties
注記
操作プロパティーを正しく指定して既存の操作を適切に削除する必要があります。
モニタリングオプションの値を変更には、リソースを更新します。たとえば、以下のコマンドで
VirtualIP を作成できます。
# pcs resource create VirtualIP ocf:heartbeat:IPaddr2 ip=192.168.0.99 cidr_netmask=24 nic=eth2
デフォルトでは次の動作を作成します。
Operations: start interval=0s timeout=20s (VirtualIP-start-timeout-20s)
stop interval=0s timeout=20s (VirtualIP-stop-timeout-20s)
monitor interval=10s timeout=20s (VirtualIP-monitor-interval-10s)
stop の timeout 操作を変更するには、以下のコマンドを実行します。
#pcs resource update VirtualIP stop interval=0s timeout=40s#pcs resource show VirtualIPResource: VirtualIP (class=ocf provider=heartbeat type=IPaddr2) Attributes: ip=192.168.0.99 cidr_netmask=24 nic=eth2 Operations: start interval=0s timeout=20s (VirtualIP-start-timeout-20s) monitor interval=10s timeout=20s (VirtualIP-monitor-interval-10s) stop interval=0s timeout=40s (VirtualIP-name-stop-interval-0s-timeout-40s)
モニタリング動作にグローバルのデフォルト値を設定する場合は次のコマンドを使用します。
pcs resource op defaults [options]
たとえば、以下のコマンドはすべてのモニタリング操作に対して
timeout 値のグローバルデフォルトを 240 秒に設定します。
# pcs resource op defaults timeout=240s
モニタリング操作の現在設定されているデフォルト値を表示するには、
pcs resource op defaults コマンドをオプションを指定せずに実行します。
たとえば、以下のコマンドはクラスターのモニタリング操作のデフォルト値を表示します。この例では
timeout 値は 240 秒に設定されています。
# pcs resource op defaults
timeout: 240s
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.