Product SiteDocumentation Site

Cap. 10. Tipuri Avansate de Resurse

Cuprins

10.1. Groups - A Syntactic Shortcut
10.1.1. Group Properties
10.1.2. Group Options
10.1.3. Group Instance Attributes
10.1.4. Group Contents
10.1.5. Group Constraints
10.1.6. Group Stickiness
10.2. Clones - Resources That Get Active on Multiple Hosts
10.2.1. Clone Properties
10.2.2. Clone Options
10.2.3. Clone Instance Attributes
10.2.4. Clone Contents
10.2.5. Clone Constraints
10.2.6. Clone Stickiness
10.2.7. Clone Resource Agent Requirements
10.3. Multi-state - Resources That Have Multiple Modes
10.3.1. Multi-state Properties
10.3.2. Multi-state Options
10.3.3. Multi-state Instance Attributes
10.3.4. Multi-state Contents
10.3.5. Monitorizarea Resurselor Multi-State
10.3.6. Multi-state Constraints
10.3.7. Multi-state Stickiness
10.3.8. Care Instanţă a Resursei este Promovată
10.3.9. Multi-state Resource Agent Requirements
10.3.10. Multi-state Notifications
10.3.11. Multi-state - Proper Interpretation of Notification Environment Variables

10.1. Groups - A Syntactic Shortcut

Unul dintre cele mai comune elemente ale unui cluster este un set de resurse care trebuie plasate împreună, pornesc secvenţial şi se opres în ordine inversă. Pentru a simplifica această configuraţie suportăm conceptul de grupuri.

Exemplu 10.1. Un exemplu de grup

<group id="shortcut">
   <primitive id="Public-IP" class="ocf" type="IPaddr" provider="heartbeat">
    <instance_attributes id="params-public-ip">
       <nvpair id="public-ip-addr" name="ip" value="1.2.3.4"/>
    </instance_attributes>
   </primitive>
   <primitive id="Email" class="lsb" type="exim"/>
  </group>

Deşi exemplul de mai sus conţine doar două resurse, nu este nici o limită asupra numărului de resurse pe care le poate conţine un grup. Exemplul este de asemenea suficient pentru a explica proprietăţile fundamentale ale unui grup:
  • Resursele sunt pornite în ordinea în care apar (întâi Public-IP, apoi Email)
  • Resursele sunt oprite în ordine inversă faţă de cea în care apar (întâi Email, apoi Public-IP)
If a resource in the group can’t run anywhere, then nothing after that is allowed to run, too.
  • If Public-IP can’t run anywhere, neither can Email;
  • but if Email can’t run anywhere, this does not affect Public-IP in any way
Grupul de deasupra este echivalent logic cu a scrie:

Exemplu 10.2. Cum vede clusterul un grup de resurse

<configuration>
   <resources>
    <primitive id="Public-IP" class="ocf" type="IPaddr" provider="heartbeat">
     <instance_attributes id="params-public-ip">
        <nvpair id="public-ip-addr" name="ip" value="1.2.3.4"/>
     </instance_attributes>
    </primitive>
    <primitive id="Email" class="lsb" type="exim"/>
   </resources>
   <constraints>
      <rsc_colocation id="xxx" rsc="Email" with-rsc="Public-IP" score="INFINITY"/>
      <rsc_order id="yyy" first="Public-IP" then="Email"/>
   </constraints>
</configuration>

În mod evident pe măsură ce grupul creşte, efortul de configurare redus poate deveni semnificativ.
Un alt exemplu (tipi) al unui grup este un volum DBRD, un mount de sistem de fișiere, o adresă IP și o aplicație care le folosește.

10.1.1. Group Properties

Tabel 10.1. Proprietăţile unui Grup de Resurse

Câmp Descriere
id
Your name for the group

10.1.2. Group Options

Options inherited from primitive resources: priority, target-role, is-managed

10.1.3. Group Instance Attributes

Groups have no instance attributes, however any that are set here will be inherited by the group’s children.

10.1.4. Group Contents

Groups may only contain a collection of Secțiune 5.3, „Resource Properties” cluster resources. To refer to the child of a group resource, just use the child’s id instead of the group’s.

10.1.5. Group Constraints

Although it is possible to reference the group’s children in constraints, it is usually preferable to use the group’s name instead.

Exemplu 10.3. Exemple de restricţii care implică grupuri

<constraints>
    <rsc_location id="group-prefers-node1" rsc="shortcut" node="node1" score="500"/>
    <rsc_colocation id="webserver-with-group" rsc="Webserver" with-rsc="shortcut"/>
    <rsc_order id="start-group-then-webserver" first="Webserver" then="shortcut"/>
</constraints>

10.1.6. Group Stickiness

Stickiness, the measure of how much a resource wants to stay where it is, is additive in groups. Every active resource of the group will contribute its stickiness value to the group’s total. So if the default resource-stickiness is 100, and a group has seven members, five of which are active, then the group as a whole will prefer its current location with a score of 500.