Copied to clipboard

Flag this post as spam?

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


  • Gabor Ferencz 36 posts 167 karma points
    Mar 04, 2022 @ 09:04
    Gabor Ferencz
    0

    Load Balanced Setup Content not being replicatd

    Hi,

    We've set up Umbraco on a Kubernetes instance, with our CMS instance running in a single pod, and our back-end service running on load balanced pods.

    We've an issue where content is not synced across the various pods. I feel like we've done all the required steps to ensure Load balancing works.

    We have all Media on Azure Blob storage, and that works.

    We want to have all examine indexes being built locally on each pod.

    We want all content to be synchronised and the cache to be stored locally on the temp folder.

    On both Admin and Web pods we have the following being added:

    <add xdt:Transform="Insert" key="Umbraco.Examine.LuceneDirectoryFactory" value="Examine.LuceneEngine.Directories.TempEnvDirectoryFactory, Examine" />
    <add xdt:Transform="Insert" key="Umbraco.Core.LocalTempStorage" value="EnvironmentTemp" />
    

    We have the following Master/Replica election going on:

    public class MasterReplicaElector : IUserComposer
    {
        public void Compose(Composition composition)
        {
            if (MofConfigurationManager.Current.IsFrontEndServer == "true")
            {
                composition.SetServerRegistrar(new FrontEndReadOnlyServerRegistrar());
            }
            else
            {
                composition.SetServerRegistrar(new MasterServerRegistrar());
            }
        }
    }
    
    public class MasterServerRegistrar : IServerRegistrar
    {
        public IEnumerable<IServerAddress> Registrations
        {
            get { return Enumerable.Empty<IServerAddress>(); }
        }
        public ServerRole GetCurrentServerRole()
        {
            return ServerRole.Master;
        }
        public string GetCurrentServerUmbracoApplicationUrl()
        {
            // NOTE: If you want to explicitly define the URL that your application is running on,
            // this will be used for the server to communicate with itself, you can return the
            // custom path here and it needs to be in this format:
            // http://www.mysite.com/umbraco
    
            return null;
        }
    }
    
    public class FrontEndReadOnlyServerRegistrar : IServerRegistrar
    {
        public IEnumerable<IServerAddress> Registrations
        {
            get { return Enumerable.Empty<IServerAddress>(); }
        }
        public ServerRole GetCurrentServerRole()
        {
            return ServerRole.Replica;
        }
        public string GetCurrentServerUmbracoApplicationUrl()
        {
            return null;
        }
    }
    

    The load balanced instances are set to front-end server=true

    In UmbracoConfig we have the following for the CMS instance:

    <web.routing   xdt:Transform="Replace" trySkipIisCustomErrors="true" internalRedirectPreservesTemplate="false" disableAlternativeTemplates="false" validateAlternativeTemplates="false" disableFindContentByIdPath="false"
                   umbracoApplicationUrl="%%MOF.BackEndUrl%%" >
    </web.routing>
    

    the front-end instances do not have their UmbracoApplicationUrl Set.

    <web.routing   xdt:Transform="Replace" trySkipIisCustomErrors="true" internalRedirectPreservesTemplate="false" disableAlternativeTemplates="false" validateAlternativeTemplates="false" disableFindContentByIdPath="false" urlProviderMode="Relative"
                   umbracoApplicationUrl="" >
    </web.routing>
    

    Am I missing something? Why would the content not be replicated correctly? I can see the content changing every time I refresh the page after a content change...

    Thank you! Gabor

  • Damian 61 posts 342 karma points
    Mar 04, 2022 @ 16:03
    Damian
    0

    Let me ask the silly question first and ensure that all umbraco instances are using the same database - correct?

  • Gabor Ferencz 36 posts 167 karma points
    Mar 05, 2022 @ 08:17
    Gabor Ferencz
    0

    No Question too silly - but yes, they are. We're using github actions to deploy to the instances. The weird thing is that some of the front-end instances get the updated content, and some don't, so it's not like cache isn't being propagated. I have a feeling it's to do with the UmbracoUrl not being set on the front-end instances, but in a kubernetes cluster, I don't know what the UmbracoUrl would be on which an instance can reach itself...

Please Sign in or register to post replies

Write your reply to:

Draft