gpt4 book ai didi

load-balancing - Umbraco 检查文件锁定 Azure 应用服务

转载 作者:行者123 更新时间:2023-12-03 08:48:24 28 4
gpt4 key购买 nike

我们正在一系列负载平衡的 Azure 应用服务中运行 Umbraco 8.1.5 网站,并且在其中一个实例中遇到了检查/Lucene 文件锁定问题。我们已尝试将Examine升级到1.0.2,但这仍然没有帮助。

据我所知,我们已遵循所有文档来设置 Umbraco 以在 Azure 应用服务负载平衡环境中运行。

有人在可缩放/自动缩放的 Azure 应用服务中使用 Umbraco 8 实现负载平衡吗?

应用服务

管理 - 一个实例,无自动缩放前端 - 扩展到两个实例

在其中一台前端服务器上,我们访问外部索引的搜索 Controller 正在工作,但在另一个实例上,它错误地指出索引文件已锁定。下面提供了错误消息。

如果我们将前端扩展到单个实例,则搜索始终有效。

设置

服务器角色

管理 web.config 应用设置

<add key="UmbracoServerRegistrar" value="master" />

前端 web.config 应用设置

<add key="UmbracoServerRegistrar" value="slave" />

这是在以下 Composer 中选取的

public class ServerRegistrarComposer : IUserComposer
{
public void Compose(Composition composition)
{
var config = System.Configuration.ConfigurationManager.AppSettings["UmbracoServerRegistrar"];
if (config != null && config.Equals("slave", StringComparison.InvariantCultureIgnoreCase))
{
composition.SetServerRegistrar(new FrontEndReadOnlyServerRegistrar());
}
else
{
composition.SetServerRegistrar(new MasterServerRegistrar());
}
}
}

注册商

public class FrontEndReadOnlyServerRegistrar : IServerRegistrar
{
public IEnumerable<IServerAddress> Registrations
{
get { return Enumerable.Empty<IServerAddress>(); }
}
public ServerRole GetCurrentServerRole()
{
return ServerRole.Replica;
}
public string GetCurrentServerUmbracoApplicationUrl()
{
return null;
}
}
public class MasterServerRegistrar : IServerRegistrar
{
public IEnumerable<IServerAddress> Registrations
{
get { return Enumerable.Empty<IServerAddress>(); }
}
public ServerRole GetCurrentServerRole()
{
return ServerRole.Master;
}
public string GetCurrentServerUmbracoApplicationUrl()
{
return null;
}
}

Lucene 应用程序设置

<add key="WEBSITE_DISABLE_OVERLAPPED_RECYCLING" value="1" />
<add key="umbracoLocalTempStorage" value="EnvironmentTemp" />
<add key="Umbraco.Core.LocalTempStorage" value="EnvironmentTemp" />
<add key="Umbraco.Examine.LuceneDirectoryFactory" value="Examine.LuceneEngine.Directories.SyncTempEnvDirectoryFactory, Examine" />

错误消息

错误1

Cannot index queue items, the index is currently locked

错误2

System.ApplicationException: Could not create an index searcher with the supplied lucene directory ---> Lucene.Net.Index.CorruptIndexException: doc counts differ for segment _x6: fieldsReader shows 40 but segmentInfo shows 41

错误3

Lucene.Net.Store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@D:\home\site\wwwroot\App_Data\TEMP\ExamineIndexes\External\write.lock

提前致谢

安迪

最佳答案

需要在 Azure 门户的配置页面中设置 WEBSITE_DISABLE_OVERLAPPED_RECYCLING 设置。将其放在 web.config 中不会对您有帮助。

我认为 8.4 中的锁定问题有很多改进,因此请尝试至少升级到 8.4.x。

关于load-balancing - Umbraco 检查文件锁定 Azure 应用服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60451194/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com