How to trigger a restart of the clone service

Hi Guys,

Have a cluster of multiple nodes, which has a primitive resource, say ‘R’ and a clone resource ‘C’ (which should be running on all nodes).
Now the requirement is that whenever resource ‘R’ fails, ‘C’ should restart on the node where ‘R’ was running. Even if ‘R’ restarts on the same node, ‘C’ should have been restarted on the same node. But if ‘R’ gets migrated due to migration-threshold achieved, ‘C’ may not be restarted on target node.

My both resources ‘R’ and ‘C’ are systemd services. I am not able to find a way to achieve the above. Can somebody help ?

Thanks

[QUOTE=mnshsnghl;58255]Hi Guys,

Have a cluster of multiple nodes, which has a primitive resource, say ‘R’ and a clone resource ‘C’ (which should be running on all nodes).
Now the requirement is that whenever resource ‘R’ fails, ‘C’ should restart on the node where ‘R’ was running. Even if ‘R’ restarts on the same node, ‘C’ should have been restarted on the same node. But if ‘R’ gets migrated due to migration-threshold achieved, ‘C’ may not be restarted on target node.

My both resources ‘R’ and ‘C’ are systemd services. I am not able to find a way to achieve the above. Can somebody help ?

Thanks[/QUOTE]

So you have 2 services ‘R’ & ‘C’.
Then you need first to clone ‘C’.
As ‘C’ depends on ‘R’ ,you want ‘C-clone’ to be restarted when ‘R’ restarts, right ?

This looks like the dlm & clvmd dependency but one of them is regular resource.

You have to:

  1. Create a clone for ‘C’
  2. Set 2 order constraints (1 → C starts after R, 2 → C stops before R) that C is started after R. When R get migrated ‘C-clone’ will be stopped first, then R is started, then C-clone is started
    You can use ‘crm help’ to check the syntax.
  3. Test properly !

[QUOTE=hunter86_bg;58295]So you have 2 services ‘R’ & ‘C’.
Then you need first to clone ‘C’.
As ‘C’ depends on ‘R’ ,you want ‘C-clone’ to be restarted when ‘R’ restarts, right ?

This looks like the dlm & clvmd dependency but one of them is regular resource.

You have to:

  1. Create a clone for ‘C’
  2. Set 2 order constraints (1 → C starts after R, 2 → C stops before R) that C is started after R. When R get migrated ‘C-clone’ will be stopped first, then R is started, then C-clone is started
    You can use ‘crm help’ to check the syntax.
  3. Test properly ![/QUOTE]

When you create the order rules , use C-clone instead of resource C.