Ideas and stories around Linux-HA (heartbeat) and Linux general.

16.4.08

Reload vs. Restart a Resource

On the mailinglist there was a nice discussion today: "Is it possible to reload a resource instead to restarting it every time?"

If you change the attribute of a resource heartbeat normally restarts the resource. You can also invoke this manually stopping and starting the resource again. But sometimes it is desirable only to reload the resource i.e. to tell the daemon to reread the latest configuration file. Restarting might take some time and reloading is much faster. So is it possible to reload the resource from heartbeat?

Yes! The basics are already included in the Dummy RA. If you want to add this feature to your RA follow this hint:
1) Add an attribute to the resource agent:


<parameter name="reload_trigger" unique="0">
<longdesc lang="en">
Random parameter that, when changed, causes a reload instead of a restart
</longdesc>
<shortdesc lang="en">Reload trigger</shortdesc>
<content type="string" default="" />
</parameter>



Beware: The parameter has to have the attribute unique="0"!

2) Add a reload action to the RA:

<name="reload" timeout="90"/>

Now restart the node. Andrew wrote on the list, that this is necessary to clear the cache of the meta_attributes.

Now every time you change the value this attribute the resource is reloaded instead of a complete restart of the resource. Nice?

No comments: