cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to set the priority of nodes in a cluster group

jobinpbabu
Explorer
0 Kudos
346

I have 2 nodes in a cluster group (for example the group name is adminnodegroup). I wanted to set node2 as the first priority so that when a cron job runs, it will try to execute on node2 first.

former_member620692
Active Contributor
0 Kudos

You can set a node to the CronJob using the following screen (Server information):

jobinpbabu
Explorer
0 Kudos

Thanks for the reply, but my question is different. I don't want to mention explicitly on any jobs to run on a node. on the cronjob I will be mentioning the cluster group name. but I need to have a node priority to be set within the cluster group.

View Entire Topic
andyfletcher
Active Contributor
0 Kudos

I think you'd have to extend DefaultCronJobService and write your own implementation of boolean canRunOnThisNode(CronJobModel) and void startOnDiffererentNodeViaTask(CronJobModel)

You'd need to have some way of retrieving the node priorities for a cronjob and the simplest way to do this would be to add a new attribute to cronjob that listed the node ids in order. Obviously this wouldn't work for autodiscovery generated node ids!

You haven't really specified when you would use a different node though. What would make it not use the first one in the list? Is the node available, is the node cpu time over a threshold? Either way you're going to have to write some sort of healthcheck to see if the node that you want to run on is able to process the task. I'm also not sure how you'd convert a node id into an instance address for you to check the health. ClusterService doesn't look like it provides anything. If you're using TCP jgroups clustering then the CLNodeInfos table will help you, but if you're using UDP multicast then I'd imagine that there is no way of looking up what you need due to the way that UDP is a fire and forget notification. There's no need for it know the cluster members.