Product SiteDocumentation Site

9.3. Spostare le risorse

9.3.1. Intervenire manualmente

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.
Since everything eventually comes down to a score, you could create constraints for every resource to prevent them from running on one node. While the configuration can seem convoluted at times, not even we would require this of administrators.
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
A value of true indicates that the node is NOT able to host any resources, while a value of false says that it CAN.
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
Dietro le quinte il comando creerà la seguente location constraint:
<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
allora risulterà come se il primo comando non fosse mai stato eseguito.
Per permettere ad una risorsa di essere nuovamente spostata è possibile utilizzare:
# 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
Alternativamente, se l'unica esigenza è quella di spostare la risorsa dalla posizione attuale si può provare con
# crm_resource -M -r Email`
Which will instead create a negative constraint, like
<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!
In some cases, such as when resource-stickiness is set to INFINITY, it is possible that you will end up with the problem described in Sezione 6.2.4, «What if Two Nodes Have the Same Score». The tool can detect some of these cases and deals with them by also creating both a positive and negative constraint. Eg.
Email prefers sles-1 with a score of -INFINITY
Email prefers sles-2 with a score of INFINITY
che ha lo stesso effetto a lungo termine discusso in precedenza.