This site best when viewed with a modern standards-compliant browser. We recommend Firefox Get Firefox!.

Linux-HA project logo
Providing Open Source High-Availability Software for Linux and other OSes since 1999.

USA Flag UK Flag

Japanese Flag

ホームページ

サイトについて

コンタクト情報

使用条件

協力方法

セキュリティ

2008.6.30
パッケージ追加
追加パッケージ集にパッケージを追加しました

2008.3.17
RHEL用rpm更新
更新情報はこちらから

2007.12.21
Heartbeat 2.1.3
リリース!
Downloadはこちらから

2007.11.13
Linux-ha-japan日本語ML移植しました

2007.10.5
日本語サイトOPEN
日本語MLも開設しました

2007.10.5
OSC2007 Tokyo/Fall で Heartbeat紹介
発表資料を公開しました

Last site update:
2008-07-04 17:34:29

Contents

  1. Introduction
  2. Example
  3. Location Constraints for Resource Groups
  4. Ordering Constraints and Resource Groups
  5. Co-locational Constraints and Resource Groups

Introduction

Resource groups are essentially a shortcut for creating a set of resources that need to:

  • be started on the same node, and
  • started and stopped sequentially

They effectively correspond to one line from a version 1 haresources file.

Example

In the example below we have defined an IP address, a database and an Apache instance. All three resources will be placed on the same machine, and will be started in the order listed, ie.

  1. WebServerIP

  2. WebServerDatabase

  3. WebServerApache

and stopped in the reverse order.

  • <group id="MyCorpWWW">
      <primitive id="WebServerIP" class="ocf" type="IPaddr" provider="heartbeat">
        <instance_attributes>
          <attributes>
            <nvpair name="ip" value="127.0.0.26"/>
          </attributes>
        </instance_attributes>
      </primitive>
      <primitive id="WebServerDatabase" class="lsb" type="oracle" provider="heartbeat">
        <instance_attributes>
          <attributes>
            <nvpair name="SID" value="webserver_db"/>
          </attributes>
        </instance_attributes>
      </primitive>
      <primitive id="WebServerApache" class="ocf" type="Apache" provider="heartbeat">
        <instance_attributes>
          <attributes>
            <nvpair name="apache_config" value="/home/www.mycorp.com/conf/apache.conf"/>
          </attributes>
        </instance_attributes>
      </primitive>
    </group>
     

The group will implicitly define rules equivalent to:

  • <constraints>
        <rsc_colocation id="ip_and_database" 
            from="WebServerDatabase" to="WebServerIP" score="INFINITY"/>
        <rsc_order id="ip_before_database" 
            from="WebServerIP" action="start" type="before" to="WebServerDatabase" symmetrical="TRUE"/>
        <rsc_colocation id="database_and_apache" 
            from="WebServerApache" to="WebServerDatabase" score="INFINITY"/>
        <rsc_order id="database_before_apache" 
            from="WebServerDatabase" action="start" type="before" to="WebServerApache" symmetrical="TRUE"/>
    </constraints>
     

Location Constraints for Resource Groups

Using constraints for the resource group as a whole is no different to a native resource... you just use the id of the group.

  • <rsc_location id="run_MyCorpWWW" rsc="MyCorpWWW">
        <rule id="pref_run_WebServerIP" score="100">
            <expression attribute="#uname" operation="eq" value="c001n01"/>
        </rule>
    </rsc_location>
     

Easy! :)

Ordering Constraints and Resource Groups

If we defined two more resources and had one start before MyCorpWWW and one after, the results are pretty much what you would expect.

  • Example:
    <primitive id="Named" class="lsb" type="named"/>
    <primitive id="WwwStats" class="lsb" type="apache_stats"/>
    
    <rsc_order id="order_named_www" from="MyCorpWWW" action="start" type="after" to="Named"/>
    <rsc_order id="order_www_stats" from="MyCorpWWW" action="start" type="before" to="WwwStats"/>
     

Since the ordering constraints are symmetrical by default, this is the equivalent of

  • <primitive id="Named" class="lsb" type="named"/>
    <primitive id="WwwStats" class="lsb" type="apache_stats"/>
    
    <rsc_order id="start_order_named_www" from="MyCorpWWW" action="start" type="after" to="Named" symmetrical="false" />
    <rsc_order id="start_order_www_stats" from="MyCorpWWW" action="start" type="before" to="WwwStats" symmetrical="false" />
    <rsc_order id="stop_order_named_www" from="MyCorpWWW" action="stop" type="before" to="Named" symmetrical="false" />
    <rsc_order id="stop_order_www_stats" from="MyCorpWWW" action="stop" type="after" to="WwwStats" symmetrical="false" />
    

If nothing was yet started, the order would be like this:

  1. Start Named

  2. Start WebServerIP

  3. Start WebServerDatabase

  4. Start WebServerApache

  5. Start WwwStats

and likewise, the shutdown order would be:

  1. Stop WwwStats

  2. Stop WebServerApache

  3. Stop WebServerDatabase

  4. Stop WebServerIP

  5. Stop Named

Co-locational Constraints and Resource Groups

Ensuring that the WwwStats resource runs on the same machine as Apache is no different than before... we just use the id of the group.

  • <rsc_colocation id="same_stats" from="MyCorpWWW" to="WwwStats" score="INFINITY"/>