Scheduled tasks not working in load balanced environment
Hi
I have a load balanced setup having 2 servers running Umbraco 7.1.9
Master : editors work on this server and have a url for accessing this server like editor.mydomain.com Slave : not editor work will be done on this server
My domain www.mydomain.com will go through a load balancer and load will be distributed between master and slave.
<distributedCall enable="true">
<!-- the id of the user who's making the calls -->
<!-- needed for security, umbraco will automatically look up correct login and passwords -->
<user>1</user>
<servers>
<server serverName="Master">internaldomain1.com</server>
<server serverName="Slave1">internaldomain2.com</server> </servers>
</distributedCall>
The domains used here are internal domains that only work behind the loadbalancer. This setup works fine. When a user publishes something on the Master server the cache of the Slave server get's updated.
We have noticed that scheduled tasks are not running for some reason. So scheduled publishing of content does not work.
<scheduledTasks baseUrl="internaldomain1.com/umbraco"> <!-- add tasks that should be called with an interval (seconds) -->
<!-- <task log="true" alias="test60" interval="60" url="http://localhost/umbraco/test.aspx"/>-->
</scheduledTasks>
I also tried setting the baseUrl to editor.mydomain.com/umbraco but that also didn't have any effect.
There are also no entries in the log for the task scheduler (searched for Umbraco.Web.Scheduling.Scheduler , Umbraco.Web.Scheduling.ScheduledTasks)
If I run the same application in a non load balanced setup everything works as it should.
So in this file (https://github.com/umbraco/Umbraco-CMS/blob/7.1.9/src/Umbraco.Core/NetworkHelper.cs) we see that the machine name or dns hostname is used to determine if a instance is the master instance.
After updating the serverName attribute to match the machine name scheduled publishing started working.
I made a pull request to update the documentation.
Scheduled tasks not working in load balanced environment
Hi
I have a load balanced setup having 2 servers running Umbraco 7.1.9
Master : editors work on this server and have a url for accessing this server like editor.mydomain.com
Slave : not editor work will be done on this server
My domain www.mydomain.com will go through a load balancer and load will be distributed between master and slave.
We have set up load balancing according to this : https://our.umbraco.org/documentation/Installation/load-balancing#Correctconfigforscheduledpublishing&tasks
This is myconfig :
The domains used here are internal domains that only work behind the loadbalancer. This setup works fine. When a user publishes something on the Master server the cache of the Slave server get's updated.
We have noticed that scheduled tasks are not running for some reason. So scheduled publishing of content does not work.
We tried adding a baseUrl for the scheduled taks as described here : https://our.umbraco.org/documentation/Using-Umbraco/Config-files/umbracoSettings/#ScheduledTasks
But that didn't have any effect.
I also tried setting the baseUrl to editor.mydomain.com/umbraco but that also didn't have any effect.
There are also no entries in the log for the task scheduler (searched for Umbraco.Web.Scheduling.Scheduler , Umbraco.Web.Scheduling.ScheduledTasks)
If I run the same application in a non load balanced setup everything works as it should.
Anybody got an idea what i'm missing here ?
Dave
Still need some help on this. All help is appreciated.
Dave
Bumping this up again.
Dave
After some more digging throug the logs I found this :
With this information I went on search throught the Umbraco source.
If the server is detected as Slave instance than it will not start the scheduled tasks :
https://github.com/umbraco/Umbraco-CMS/blob/7.1.9/src/Umbraco.Web/Scheduling/Scheduler.cs
So in this file (https://github.com/umbraco/Umbraco-CMS/blob/7.1.9/src/Umbraco.Core/NetworkHelper.cs) we see that the machine name or dns hostname is used to determine if a instance is the master instance.
After updating the serverName attribute to match the machine name scheduled publishing started working.
I made a pull request to update the documentation.
Dave
Awesome - I've been having this issue with a load balanced version of 7.2.2 - this fixed things up nicely! Thanks heaps, Dave :)
is working on a reply...