分析 AEM 索引问题
本文提供了有关在Adobe Experience Manager中分析慢查询、重新索引异步索引和解决索引问题的指导。
描述 description
环境
Adobe Experience Manager
问题/症状
如何解决所有常见的索引问题?
解决方法 resolution
分析慢查询
转到 工具 >
操作 >
仪表板 >
诊断 >
查询性能 将显示慢查询列表。
有关分析慢查询的详细信息,请参阅此文档。
在非生产环境中,可以安装Adobe Consulting Services (ACS) AEM工具包,提供解释查询工具,以便进一步调试。
重新索引异步索引
注意: 重新索引通常不能解决查询问题,例如查询没有返回正确的结果。 此外,重新索引可能需要很长时间除非此处列出的原因涵盖,否则应避免重新索引。
如何重新索引异步索引
-
登录您的 AEM 实例
-
打开http://aemhost:port/crx/de/index.jsp
-
浏览到/oak:index下的索引定义
-
在索引上设置Boolean属性reindex=true以重新索引,然后保存。 当索引开始时,您将看到如下日志消息:
code language-none 23.06.2015 14:26:23.070 *INFO* [ FelixStartLevel] org.apache.jackrabbit.oak.plugins.index.IndexUpdate Reindexing will be performed for following indexes: [ /oak:index/cqAcUUID, /oak:index/nodetype, /oak:index/deviceIdentificationMode, /oak:index/campaignpath, /oak:index/active, /oak:index/jcrFrozenMixinTypes]
-
在重新索引过程中,IndexStatsMBean的 状态 属性将具有值 正在运行。
code language-none 23.06.2015 14:26:23.517 *INFO* [ FelixStartLevel] org.apache.jackrabbit.oak.plugins.index.IndexUpdate Reindexing Traversed #10000 /jcr:system/jcr:versionStorage/c8/5f... 23.06.2015 14:28:51.999 *INFO* [ pool-8-thread-1] org.apache.jackrabbit.oak.plugins.index.IndexUpdate Indexing report - /oak:index/counter (708) - /oak:index/authorizables (159) - /oak:index/cqPageLucene (1913) - /oak:index/ntBaseLucene (444) - /oak:index/cqTagLucene (512) - /oak:index/workflowDataLucene*(116)
-
您可以通过检查索引定义节点来确认索引已完成,属性reindexCount应该递增,并且重新索引布尔值应该设置为 false。
在日志文件中,如果索引成功完成,将显示以下条目:
code language-none 23.06.2015 14:28:52.009 *INFO* [ pool-8-thread-1] org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate Reindexing (async) completed for indexes: [ /oak:index/counter*(708), /oak:index/authorizables*(159), /oak:index/cqPageLucene*(1913), /oak:index/ntBaseLucene*(444), /oak:index/cqTagLucene*(512), /oak:index/workflowDataLucene*(116)] in 30.36 s
-
如果重新索引未完成并进入循环,请查看下面标题为“分析失败的重新索引”的部分。
-
可以通过在下列位置进行grepping,从而在INFO级别识别异步索引活动:
code language-none org.apache.jackrabbit.plugins.index.IndexUpdate, and org.apache.jackrabbit.plugins.index.AsyncIndexUpdate
异步索引性能问题
-
启用日志记录以验证时间:
TRACE 级别(仅在 Oak 1.0.17 或更高版本中):
code language-none org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorContext.perf
DEBUG 级别:
code language-none org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate org.apache.jackrabbit.oak.plugins.index.IndexUpdate org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditor org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorContext org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier
将生成这样的日志,显示索引的时间:
code language-none 09.07.2015 08:13:38.401 *TRACE* [ 192.168.193.1 [ 1436444018387] POST /content/dam/site/test.createasset.html HTTP/1.1] org.apache.jackrabbit.oak.jcr.operations.writes [ session-101777] Adding node [ /content/dam/site/test/jackrabbit-oak7.png] 09.07.2015 08:13:38.583 *TRACE* [ 192.168.193.1 [ 1436444018387] POST /content/dam/site/test.createasset.html HTTP/1.1] org.apache.jackrabbit.oak.jcr.operations.writes [ session-101777] save 09.07.2015 08:13:42.823 *DEBUG* [ pool-9-thread-1] org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate Running background index task async 09.07.2015 08:13:42.963 *TRACE* [ pool-9-thread-1] org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditor [ /oak:index/lucene] Indexed document for /content/dam/site/test/jackrabbit-oak7.png/jcr:content/related is Document<stored,indexed,omitNorms,indexOptions=DOCS_ONLY<:path:/content/dam/site/test/jackrabbit-oak7.png/jcr:content/related> indexed,tokenized<:fulltext:related>> 09.07.2015 08:13:43.579 *DEBUG* [ pool-9-thread-1] org.apache.jackrabbit.oak.plugins.index.IndexUpdate Indexing report - /oak:index/siteDamIndex(2) - /oak:index/lucene(15) 09.07.2015 08:13:43.779 *TRACE* [ oak-lucene-0] org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker.perf [ /oak:index/siteDamIndex] Index found to be updated. Reopening the IndexNode [ took 150ms] 09.07.2015 08:13:45.248 *TRACE* [ oak-lucene-0] org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier.perf [ /oak:index/lucene] Copied 0 files totaling 0 B [ took 1465ms] 09.07.2015 08:13:45.248 *TRACE* [ oak-lucene-0] org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier [ /oak:index/lucene] opening remote only file segments.gen 09.07.2015 08:13:45.361 *TRACE* [ oak-lucene-0] org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker.perf [ /oak:index/lucene] Index found to be updated. Reopening the IndexNode [ took 1581ms]
-
进行一系列线程转储并在栈栈中搜索包含AsyncIndexUpdate的线程,查看大部分索引时间花费在哪里,或者索引是否在其他一些线程上等待。 要进行线程转储,请参阅本文。
-
设置Boolean属性saveDirectoryListing=true(仅当使用Oak 1.0.16时,如果更高版本则不需要),并在/oak:index/lucene OOTB索引上设置属性excludedPaths=
[
/var、/etc/workflow/instances、/jcr:system]
以对其进行优化。 -
单击 全部保存。
-
创建自定义Lucene属性索引时,如果使用Oak 1.0.16,请确保设置saveDirectoryListing=true (布尔值),并设置includedPaths (String
[
]
)属性来限制您的索引仅索引某些路径。 -
转到此URL
/system/console/configMgr/org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProviderService
读取时复制、写入时复制(仅可在Oak 1.0.18及更高版本中安全使用)和“预取索引文件”(仅在Oak 1.0.18及更高版本中)
分析失败的重新索引
-
当异步索引失败,而您检查Async Indexer统计数据JMX UI(链接如下)时,您会看到LastIndexedTime是旧日期和时间:
http://localhost:4502/system/console/jmx/org.apache.jackrabbit.oak%3Aid%3D11%2Cname%3D"async"%2Ctype%3D"IndexStats"
-
当重新索引失败时,它会进入如下循环:
code language-none 08.01.2015 01:22:04.474 *INFO* [ pool-9-thread-2] org.apache.jackrabbit.oak.plugins.index.IndexUpdate Reindexing will be performed for following indexes [ /oak:index/damFileSize, /oak:index/lucene, /oak:index/cqLastModified] 08.01.2015 01:52:08.365 *INFO* [ pool-9-thread-5] org.apache.jackrabbit.oak.plugins.index.IndexUpdate Reindexing will be performed for following indexes [ /oak:index/damFileSize, /oak:index/lucene, /oak:index/cqLastModified] 08.01.2015 09:33:23.306 *INFO* [ pool-9-thread-5] org.apache.jackrabbit.oak.plugins.index.IndexUpdate Reindexing will be performed for following indexes [ /oak:index/damFileSize, /oak:index/lucene, /oak:index/cqLastModified]
-
如果您看到这种情况,则应启用
org.apache.jackrabbit.oak.plugins.index
的调试级别日志记录 -
下次索引在上面的调试日志消息上方循环使用日志消息时,它将提供有关索引失败原因的更多详细信息。然后您可以解决该问题,无论问题为节点损坏、缺少blob还是其他问题。