分析 AEM 索引問題
本文提供在Adobe Experience Manager中分析緩慢查詢、重新索引非同步索引和疑難排解索引問題的指引。
說明 description
環境
Adobe Experience Manager
問題/症狀
如何疑難排解所有常見的索引問題?
解決方法 resolution
分析緩慢查詢
移至 工具 >
作業 >
儀表板 >
診斷 >
查詢效能 將顯示緩慢查詢清單。
請參閱此檔案,以取得有關分析緩慢查詢的詳細資料。
在非生產環境中,可以安裝Adobe Consulting Services (ACS) AEM工具套件,以提供說明查詢工具以進行進一步的偵錯。
重新索引非同步索引
注意: 重新索引通常不能解決查詢問題,例如查詢沒有傳回正確的結果。 此外,重新索引可能需要很長時間除非此處列出的原因涵蓋,否則應避免重新索引。
如何重新索引非同步索引
-
登入您的 AEM 執行個體
-
開啟http://aemhost:port/crx/de/index.jsp
-
瀏覽至/oak:index下的索引定義
-
在索引上設定布林值屬性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
-
如果重新索引未完成並進入回圈,請參閱標題為分析失敗的重新索引的以下章節。
-
可以透過在下列位置上的文本查詢工具在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
偵錯層級:
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及更高版本中)
分析失敗的重新索引
-
當非同步索引失敗時,若檢查非同步索引器統計資料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還是其他問題。