clustering windows task scheduler
-
יום חמישי 08 מרץ 2012 13:45
hi all,
we are working on a software that actually creates scheduled tasks by running schtasks.exe against a server and it's able to show you the tasks that you have scheduled on this server. the question that came up is what if this server was to go down for one reason or another, what will happen to the tasks that were scheduled on it?
of course at this point we started talking about hi availability and how can this be accomplished. I figured we might be able to cluster 2 servers and have a disk cluster resource for those 2 servers, and make the software target the cluster virtual name when running schtasks.exe. the problem that surfaced is how are we going to make those 2 servers store the data related to tasks they create on the clustered disk?
now if it's possible to make the active node creates the tasks database and the logs on the clustered disk, then this theory should work, right? I am not sure, but I think the default location for the tasks is C:\Windows\Tasks, but I am not sure how to change this and make it stores in say T:\Tasks, which will be the clustered disk.
is this a good idea, and is it possible?
if so how do i change this path?
Thanks
Mohsen Almassud
כל התגובות
-
יום חמישי 08 מרץ 2012 16:58מנחה דיון
Task Scheduler is not cluster aware ! However, there are different views/approaches though
Scheduled Task
Hey, Scripting Guy! How Can I Script the use of Scheduled Task on a Windows 2008 Cluster
http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/8a658474-df20-4b5c-bbeb-bdb48e90e6a7
2003 Cluster-enabled scheduled tasks
http://waynes-world-it.blogspot.in/2008/04/2003-cluster-enabled-scheduled-tasks.html
This posting is provided "AS IS" with no warranties or guarantees and confers no rights.
Most of the downtime's are caused because of SysAdmin's curiosity ! - Santosh- נערך על-ידי Santosh BhandarkarMicrosoft Community Contributor, Moderator יום חמישי 08 מרץ 2012 16:58
-
יום חמישי 08 מרץ 2012 18:15
Santosh,
Thanks for your response. I went through the three links and I don't see any of them have the same view as mine where I just want to use the built-in task scheduler with the database of the tasks being stored on a SAN disk so that both nodes can access when active.
I think the only piece that's not clear here is that, is it possible to move the tasks folder from C:\windows\tasks to some UNC share?
Mohsen Almassud
-
יום חמישי 08 מרץ 2012 19:02מנחה דיון
I think the only piece that's not clear here is that, is it possible to move the tasks folder from C:\windows\tasks to some UNC share?
Mohsen Almassud
Tasks folder location can be changed by editing following registry key
HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ SchedulingAgent \ TasksFolder
Default value of the TasksFolder key is %SystemRoot%\Tasks ; you can replace that with Z:\Tasks (or any drive letter of your choice)
Once you edit the registry, make sure to restart the Task scheduler service using following command
NET STOP SCHEDULE && NET START SCHEDULE
Also verify that, Tasks folder has moved to the new drive; test it by creating a dummy task.
If you are planning for 2 node cluster, make sure to edit the registry on both the nodes so that they point to same Drive letter.
I haven't actually tried that on a cluster, so I wont be able to comment whether that would work on cluster or not and also any unforeseen impact on the cluster services.
This posting is provided "AS IS" with no warranties or guarantees and confers no rights.
Most of the downtime's are caused because of SysAdmin's curiosity ! - Santosh- נערך על-ידי Santosh BhandarkarMicrosoft Community Contributor, Moderator יום חמישי 08 מרץ 2012 19:07
-
יום שישי 09 מרץ 2012 03:35
Santosh, Thanks for responding to my post and helping me out.
I edited the registry and changed the path to the E: drive and I wasn't able to restart the service with net stop and net start, beucase of some access denied and I even couldn't do it from the services.msc, so I had to reboot the server. the server is back and it seems to have moved the tasks folder to the E: drive. so I went ahead and created a task to see if it gets created in the new location, but I don't think it got created there nor in the old location.
I was even able to rename the old folder on the windows directory, because I changed the path for the data and the logs as well, and they are both showing in the new location. I am not sure how to confirm that the task got created in the new location though.
any ideas?
Mohsen Almassud
-
יום שישי 09 מרץ 2012 07:28מנחה דיון
Mohsen,
I tested this on my WS 2003 Test Server and worked very well for me !
Here is what I had done, I edited the registry as I mentioned in my previous post, changed the default location of Tasks folder and Log file to C:\Tasks instead of %systemroot%\Tasks, restarted task scheduler service. I even created a dummy job and it immediately reflected in the new Tasks folder.
Perhaps, WS 2008 has some dependencies which might be causing issues !
This posting is provided "AS IS" with no warranties or guarantees and confers no rights.
Most of the downtime's are caused because of SysAdmin's curiosity ! - Santosh -
שבת 10 מרץ 2012 02:02
I'll try this again with the 2008 R2 server and see if I get the same result you got.
Thanks a lot for your help.
Mohsen Almassud
-
יום שני 12 מרץ 2012 11:53
one thing I noticed and thought it might worth mentioning is that even before I move the tasks folder to another drive, I am not seeing any jobs in the tasks folder when I create a new task, which leads me to believe that windows server 2008 R2 stores that actual tasks elsewhere.
wouldn't you think?
Mohsen Almassud
-
יום שלישי 13 מרץ 2012 12:21I just found out from one of the developers that windows server 2008 R2 stores its tasks in the C:\Windows\System32\Tasks, but I wasn't able to find anything in the registry to change to make it store on another disk or network share.
Mohsen Almassud
-
יום שלישי 13 מרץ 2012 22:25מנחה דיוןIn Windows Server "8" you will be able to use the Register-ClusteredScheduledTask Powershell cmdlet to schedule Cluster-wide tasks. This would make what you're trying to do much simpler.
-
יום רביעי 14 מרץ 2012 00:14
Subhasish, Thanks for taking the time to responding to my question.
I am not sure this will accomplish what I need, because here's the situation:
an application that is used for that we use to schedule tasks. this app can target a computer name in a way similar to schtasks.exe. now this app could you use a single server to schedule all the tasks on it, but then if this server was to go down for whatever reason, this all the scheduled tasks will not run.
so the idea here is that we cluster 2 servers and have the app that schedule that tasks target the cluster name, which will make it schedule the task to the active node. the only piece that's missing here is that both servers need to have access to the same tasks and tasks database, so that in the event of a fail-over, the other node can access and run all the tasks.
a better way of doing this is having 2 servers with NLB accessing the same tasks and tasks database, but only one of them would run the tasks, but I am guessing this would require a lot more to do than just clustering.
wouldn't you think so?
Thanks
MJ
Mohsen Almassud
-
יום רביעי 14 מרץ 2012 01:14מנחה דיון
Right. The option we provide you is to schedule your tasks - cluster-wide, to run on any node in the cluster or on a node owning a resource. So if your app schedules the task to be run on *any node in the cluster* the task scheduler cluster resource will ensure that the task is run on an active node. What this buys you is that the task scheduler resource maintains the consistency of the tasks and enables/disables them based on the state of the node. Would that help?
- סומן כתשובה על-ידי Mohsen Almassud יום רביעי 14 מרץ 2012 02:02
-
יום רביעי 14 מרץ 2012 01:34
this sounds fantasic and it sure a solution for the problem I am dealing with.
could you please give me some additional information on how to implement it besides the powershell command your provided?
MJ
Mohsen Almassud
-
יום רביעי 14 מרץ 2012 04:54מנחה דיון
I just found out from one of the developers that windows server 2008 R2 stores its tasks in the C:\Windows\System32\Tasks, but I wasn't able to find anything in the registry to change to make it store on another disk or network share.
Mohsen Almassud
That's correct. I also tried to search corresponding registry key but in vain.
Sorry, I was on vacation hence, couldn't respond on time.
However, its good to know that WS 8 will have Clustered Task Scheduler.
This posting is provided "AS IS" with no warranties or guarantees and confers no rights.
Most of the downtime's are caused because of SysAdmin's curiosity ! - Santosh -
יום רביעי 14 מרץ 2012 15:46מנחה דיון
Hi Mohsen,
All your app needs to do is configure the scheduled task using Powershell. The task scheduler cluster resource is hidden and the cluster service handles everything else behind the scenes.Here's how your application can configure the clustered task
On any cluster node:
•Register-ClusteredScheduledTask
–Action $action
–Trigger $trigger
–Cluster “MyCluster”
–AnyNode
–TaskName “MyTask”For a cluster resource:
•Register-ClusteredScheduledTask
–Action $action
–Trigger $trigger
–Cluster “MyCluster”
–Resource “Cluster Disk 1”
–TaskName “MyTask”Cluster wide:
•Register-ClusteredScheduledTask
–Action $action
–Trigger $trigger
–Cluster “MyCluster”
–ClusterWide
–TaskName “MyTask”Some examples:
§$action = New-ScheduledTaskAction –Exec Calc.exe§$trigger = New-ScheduledTaskTrigger –At 15:01 –Daily§$r = Register-ClusteredScheduledTaskYou also have corresponding cmdlets to list and register clustered tasks.
Do let me know if you need more information. In the next few weeks, we'll be posting more on this and other Server "8" features on the cluster blog.
Best,
Subhasish
-
יום חמישי 15 מרץ 2012 02:56
I hope you enoyed your time off.
you have no idea how much I appreciate your help with this :)
so here's what I assume I'll need to do:
- have 2 server running windows server 2008 R2 enterprise 64 bit.
- install fail-over cluster administrator.
- do all normal clustering stuff.
then start powershelling for there.
Right?
I'll lookup some additional info and see if I can find examples with steps that might help in this case, but you have absulutely helped me very much.
Thanks a lot for your help.
Mohsen
Mohsen Almassud
-
יום חמישי 15 מרץ 2012 08:37מנחה דיון
so here's what I assume I'll need to do:
- have 2 server running windows server 2008 R2 enterprise 64 bit.
- install fail-over cluster administrator.
- do all normal clustering stuff.
then start powershelling for there.
Right?
Mohsen,
It seems there are some gaps in understanding.
Here is what Subhasish mentioned in his reply.
<<In Windows Server "8" you will be able to use the Register-ClusteredScheduledTask Powershell cmdlet to schedule Cluster-wide tasks. >>
Powershell cmdlet mentioned above will be a part of Windows Server 8 (NOT WS 2008 or WS 2008 R2), I don't think that is currently available for WS 2008 or WS 2008 R2 !
This posting is provided "AS IS" with no warranties or guarantees and confers no rights.
Most of the downtime's are caused because of SysAdmin's curiosity ! - Santosh -
יום חמישי 15 מרץ 2012 10:38
Thanks for clarifying this Santosh, because I was not able to find anything related to this setup for windows server 2008 :(
I'll see if windowserver 8 is available for download as an eval and try it and see if I can do this setup with it.
Thanks again.
Mohsen Almassud
-
יום חמישי 15 מרץ 2012 16:55מנחה דיון
Here's more Windows Server "8" Beta evaluation: http://technet.microsoft.com/en-us/evalcenter/hh708766
-
יום שישי 16 מרץ 2012 00:10
Perfect.
I'll go ahead and download it tomorrow and try the powershell commands with it.
Thanks a lot for all the help you guys provided.
Mohsen
Mohsen Almassud