Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Al Burns 49 posts 149 karma points
    Sep 26, 2018 @ 10:25
    Al Burns
    0

    Load Balanced Environment - Published Content Not Replicating To Web Servers

    Hi.

    I am having an issue with published content not replicating across to web servers in a load balanced environment and wondered if anyone can assist.

    We are on Umbraco version 7.10.2. I have 1 x CMS server and 2 x web servers sitting behind a load balancer.

    I am using flexible load balancing as described in this documentation and have implemented the recommended master/slave server configuration from this document.

    The problem I am seeing is that the CMS is correctly updating the umbracoCacheInstruction table when a publish is done but the web servers are not picking this up and refreshing their content so I have to manually delete umbraco.config and recycle the app pool in IIS to get it to show up.

    The implementation of the master server registrar class is:

    public class MasterServerRegistrar : IServerRegistrar2
    {
        public IEnumerable<IServerAddress> Registrations => Enumerable.Empty<IServerAddress>();
    
        public ServerRole GetCurrentServerRole()
        {
            return ServerRole.Master;
        }
    
        public string GetCurrentServerUmbracoApplicationUrl()
        {
            var currentServerUrl = ConfigurationManager.AppSettings[GeneralKeys.CurrentServerUrl];
    
            return !string.IsNullOrWhiteSpace(currentServerUrl) ? currentServerUrl : null;
        }
    }
    

    and the slave server class:

    public class FrontEndReadOnlyServerRegistrar : IServerRegistrar2
    {
        public IEnumerable<IServerAddress> Registrations => Enumerable.Empty<IServerAddress>();
    
        public ServerRole GetCurrentServerRole()
        {
            return ServerRole.Slave;
        }
    
        public string GetCurrentServerUmbracoApplicationUrl()
        {
            var currentServerUrl = ConfigurationManager.AppSettings[GeneralKeys.CurrentServerUrl];
    
            return !string.IsNullOrWhiteSpace(currentServerUrl) ? currentServerUrl : null;
        }
    }
    

    Where the current server URL value is the full URL to the /umbraco path for each server. When testing this we've noticed that the umbracoServer table does not update with the registered server details, which I assume is how the CMS server knows about the web servers to be able to notify them to refresh their content.

    One thing I wasn't sure about is the Registrations property return an empty list of IServerAddress objects. Should this be the actual address of each server (IP or URL)? What should we return for this?

    I would be grateful for any assistance. Thanks.

  • Al Burns 49 posts 149 karma points
    Sep 28, 2018 @ 14:23
    Al Burns
    0

    Anyone able to offer any advice on this as we are tearing our hair out!

  • ssougnez 85 posts 289 karma points c-trib
    Oct 22, 2018 @ 09:43
    ssougnez
    0

    Hi,

    I'm currently starting to have some fun with this... I don't know exactly if it will fix your issue but you should read this.

    I think the interesting part is: "The next step is to tell Umbraco about the other nodes in the cluster. Like a lot of Umbraco config we need to look in, 'umbracoSettings.config'. You can find this file within your website's webroot 'Config' folder. In here you should find a distributedCall element set to false, you will need to set it to true. In the distributedCall section, you will need to add URLs, or the IP address to reach each node. One key part of this process is ensuring each node has a unique hostnames or IP address to access, e.g. something like node1.website.com, node2.website.com The server names need to be unique names that reference each node, you can't just use the main website URL, or, IP as that will route it through the load balancer and mean the cache might not invalidate. If you are running in a shared environment, you also need to make sure that each server is set to use its own local cache and not a shared one. In your web.config there’s an option called, umbracoContentXMLUseLocalTemp, set this to false."

    Meaning that you need to defines the servers of your cluster to allow your master one to poke the other to tell them to update their cache.

Please Sign in or register to post replies

Write your reply to:

Draft