我使用的是NServiceBus 5.2.16,我遇到了一个审计日志清理问题。在ServiceControl管理实用程序中,审核保留期设置为30天。但是,RavenDB数据库每天都在增长,并且在ServiceInsight中我可以看到超过30天的成功消息,因此我怀疑旧消息没有从数据库中删除。如何限制NServiceBus RavenDB数据库的大小?
发布于 2016-10-26 16:21:56
我设法解决了这个问题,方法是删除整个Raven数据库并重启ServiceControl。这会创建一个新数据库,然后ServiceControl会正确删除旧的审计条目。
我确实从特定的支持部门获得了一些有用的信息。您可以通过ServiceControl.exe.config文件中的设置来控制审核清理过程。特别是,ServiceControl/ExpirationProcessTimerInSeconds和ServiceControl/ExpirationProcessBatchSize设置非常有用,因为它们允许您更频繁地安排清理过程,或增加在每个批次中删除的最大项目数。您可以在NServiceBus documentation中找到有关这些设置的更多详细信息。
此外,您还可以在ServiceControl的日志文件中监视清理过程。但是,首先需要将日志记录的详细程度提高到至少Info。这可以使用ServiceControl.exe.config文件中的ServiceControl/LogLevel设置来完成。更改日志级别后,您应该会在ServiceControl的Logs目录中的文件中看到与下面类似的日志条目。
2016-10-26 09:49:06.2652|77|Info|ServiceControl.Infrastructure.RavenDB.Expiration.SagaHistoryCleaner|Batching deletion of 0-499 sagahistory documents completed.
2016-10-26 09:49:06.2808|77|Info|ServiceControl.Infrastructure.RavenDB.Expiration.SagaHistoryCleaner|Batching deletion of 500-715 sagahistory documents.
2016-10-26 09:49:06.4996|77|Info|ServiceControl.Infrastructure.RavenDB.Expiration.SagaHistoryCleaner|Batching deletion of 500-715 sagahistory documents completed.
2016-10-26 09:49:06.4996|77|Info|ServiceControl.Infrastructure.RavenDB.Expiration.SagaHistoryCleaner|Deleted 716 expired sagahistory documents. Batch execution took 11635ms
2016-10-26 09:49:06.4996|77|Info|ServiceControl.Infrastructure.RavenDB.Expiration.ErrorMessageCleaner|No expired error documents foundhttps://stackoverflow.com/questions/39742497
复制相似问题