Product SiteDocumentation Site

Cap. 8. Reguli

Cuprins

8.1. Node Attribute Expressions
8.2. Time/Date Based Expressions
8.2.1. Date Specifications
8.2.2. Durations
8.3. Exemple de Expresii Bazate pe Timp
8.4. Using Rules to Determine Resource Location
8.4.1. Folosind score-attribute în loc de score
8.5. Folosind Reguli pentru a Controla Opţiunile Resurselor
8.6. Using Rules to Control Cluster Options
8.7. Asigurarea că Regulile Bazate pe Timp Iau Efect
Regulile pot fi folosite pentru a face configuraţia voastră mai dinamică. Un exemplu comun este de a seta o valoare pentru resource-stickiness în timpul orelor de program, pentru a împiedica resursele de a fi mutate înapoi la locaţia cea mai preferată a acestora, iar altă valoare în weekend-uri când nu este nimeni în preajmă să detecteze o întrerupere a serviciului.
O altă utilizare a regulilor ar putea fi pentru a asigna maşini la grupuri de procesare diferite (folosind un atribut de nod) bazat pe timp şi mai apoi să folosească acel atribut pentru a crea o restricţie de locaţie.
Each rule can contain a number of expressions, date-expressions and even other rules. The results of the expressions are combined based on the rule’s boolean-op field to determine if the rule ultimately evaluates to true or false. What happens next depends on the context in which the rule is being used.

Tabel 8.1. Proprietăţile unei Reguli

Câmp Descriere
role
Limits the rule to apply only when the resource is in that role. Allowed values: Started, Slave, and Master. NOTE: A rule with role="Master" can not determine the initial location of a clone instance. It will only affect which of the active instances will be promoted.
score
The score to apply if the rule evaluates to true. Limited to use in rules that are part of location constraints.
score-attribute
The node attribute to look up and use as a score if the rule evaluates to true. Limited to use in rules that are part of location constraints.
boolean-op
How to combine the result of multiple expression objects. Allowed values: and and or.

8.1. Node Attribute Expressions

Obiectele de expresie sunt folosite pentru a controla o resursă pe baza atributelor definite de un nod sau de mai multe noduri. Adiţional la orice atribute adăugate de administrator, fiecare nod are un atribut de nod predefinit numit #uname care poate fi folosit de asemenea.

Tabel 8.2. Proprietăţile unei Expresii

Câmp Descriere
value
User supplied value for comparison
attribute
The node attribute to test
type
Determines how the value(s) should be tested. Allowed values: string, integer, version
operation
Comparaţia pe care să o efectueze. Valori permise:
* lt - True if the node attribute’s value is less than value
* gt - True if the node attribute’s value is greater than value
* lte - True if the node attribute’s value is less than or equal to value
* gte - True if the node attribute’s value is greater than or equal to value
* eq - True if the node attribute’s value is equal to value
* ne - True if the node attribute’s value is not equal to value
* defined - True if the node has the named attribute
* not_defined - True if the node does not have the named attribute