9.3.1. Intervenţie Manuală
There are primarily two occasions when you would want to move a resource from it’s current location: when the whole node is under maintenance, and when a single resource needs to be moved.
În cazul în care totul trebuie mutat, din moment ce totul ajunge eventual să ţină de un scor, aţi putea crea restricţii pentru fiecare resursă pe care o aveţi împiedicând-o din a mai rula pe acel nod. În timp ce configuraţia poate părea complicată în anumite momente, nici chiar noi nu am solicita acest lucru de la administratori.
Instead one can set a special node attribute which tells the cluster "don’t let anything run here". There is even a helpful tool to help query and set it, called crm_standby
. To check the standby status of the current machine, simply run:
# crm_standby --get-value
O valoarea de true
indică faptul că nodul NU poate găzdui nici un fel de resurse, în timp ce o valoare de false
spune că acesta POATE.
You can also check the status of other nodes in the cluster by specifying the --node-uname
option:
# crm_standby --get-value --node-uname sles-2
To change the current node’s standby status, use --attr-value
instead of --get-value
.
# crm_standby --attr-value
Again, you can change another host’s value by supplying a host name with --node-uname
.
When only one resource is required to move, we do this by creating location constraints. However, once again we provide a user friendly shortcut as part of the crm_resource
command, which creates and modifies the extra constraints for you. If Email
was running on sles-1
and you wanted it moved to a specific location, the command would look something like:
# crm_resource -M -r Email -H sles-2
În culise, utilitarul va crea următoarea restricţie de locaţie:
<rsc_location rsc="Email" node="sles-2" score="INFINITY"/>
It is important to note that subsequent invocations of crm_resource -M
are not cumulative. So, if you ran these commands
# crm_resource -M -r Email -H sles-2
# crm_resource -M -r Email -H sles-3
atunci ar fi ca şi când nu aţi fi efectuat niciodată prima comandă.
Pentru a permite resursei să se mute înapoi, folosiţi:
# crm_resource -U -r Email
Note the use of the word allow. The resource can move back to its original location but, depending on resource-stickiness
, it might stay where it is. To be absolutely certain that it moves back to sles-1
, move it there before issuing the call to crm_resource -U
:
# crm_resource -M -r Email -H sles-1
# crm_resource -U -r Email
Ca alternativă, dacă vă pasă doar că resursa ar trebui să fie mutată din locaţia ei curentă, încercaţi
# crm_resource -M -r Email`
Care va crea în schimb o restricţie negativă, precum
<rsc_location rsc="Email" node="sles-1" score="-INFINITY"/>
This will achieve the desired effect, but will also have long-term consequences. As the tool will warn you, the creation of a -INFINITY
constraint will prevent the resource from running on that node until crm_resource -U
is used. This includes the situation where every other cluster node is no longer available!
În anumite cazuri, precum cel în care
resource-stickiness
este setată la
INFINITY
, este posibil să ajungeţi la problema descrisă în
Secțiune 6.2.4, „Dacă Două Noduri Au Acelaşi Scor”. Utilitarul poate detecta unele din aceste cazuri şi le tratează prin crearea atât de restricţii pozitive cât şi negative. Ex.
Email
preferă sles-1
cu un scor de -INFINITY
Email
preferă sles-2
cu un scor de INFINITY
care are aceleaşi consecinţe pe termen lung precum am discutat anterior.