0

I have been currently asked to setup Pacemaker Corosync and this is entirely new for me. I currently have a 2 node cluster. And what I want to do is to reassign the IP to the other node if active node fails.

So it seems like the way to do it is to create a resource agent. I've read some tutorials about creating an OCF resource. I've read OCF resource and it seems like there these things called actions. What I don't understand about actions is when and who calls these actions?

And if the resource is running on the primary node and then when the primary node goes down, what happens to the resource? Does it automatically run on the other node?

Also since i will need to do some steps in case an action is called, how can i check which action is called in my script, is there a variable?

2 Answers 2

2

There is a package called resource-agents that contains a bunch of commonly used resource agents for Pacemaker. IPaddr2 is one of them that is used to move a virtual IP around in a cluster. For configuration details you can issue the command: pcs resource describe ocf:heartbeat:IPaddr2

If you do need to write your own resource agent (a subject far too deep to describe in a single StackExchange answer) there is an OCF RA Development Guide you should read first in the resource-agents github: https://github.com/ClusterLabs/resource-agents/blob/master/doc/dev-guides/ra-dev-guide.asc

0

What you want to know is that pacemaker is not a "Node failover" solution where the backup node takes the configuration of the failed node, but a "resource failover" solution, where individual failed resources are moved to a backup node.

So you don't configure a host address, but a service address (also named floating address or dynamic address). One resource agent (RA) to handle such addresses is IPaddr2. (In general you can get a description for any RA using a command like crm ra info, i.e.: crm ra info IPaddr2).

Then you have to configure your actual (network) resources to use that dynamic address. Doing that you have to make sure that your resource runs on the same node as your IP address (called colocation). Also your resource should be started after the IP address (called ordering).

A resource group can help to ensure colocation and ordering for simple configurations where no resources are shared (e.g.: when multiple services use the same IP address).

Now for the actions: One node (domain controller or designated coordinator (DC)) runs the cluster resource manager (crm) which in turn uses the local resource manager on a node to execute actions. Typically those are start to start a resource, monitor to check the status of a resource (sometimes also named probe), and stop to stop a resource (there are a few more, but these are the basics). If a resource fails to stop, crm tries to fence (Shoot The Other Node In the Head (STONITH)) the node to make sure nothing continues to run on that node. After STONITH was successful, then the resource (and actually all others that were affected by STONITH of the node) is started on another node.

There's more to say, but that should be enough for a quick introduction. Maybe start with Clusters from Scratch.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .