使用Commerce CLI同步摘要

magento/saas-export封裝中的saas:resync命令可讓您管理Adobe Commerce SaaS服務的資料同步處理。

NOTE
saas:resync命令也適用於Adobe Commerce Optimizer Connector摘要,例如productscategoriespriceBooks。 如需聯結器摘要和索引器名稱的完整清單,請參閱支援的摘要

Adobe不建議定期使用saas:resync命令。 使用指令的典型情況如下:

  • 初始同步
  • 變更SaaS資料空間ID後,將資料同步處理至新的資料空間
  • 疑難排解

監視var/log/saas-export.log檔案中的同步作業。

初始同步

NOTE
啟用「即時搜尋」或「產品推薦」時,初始同步會自動執行。 不需要手動指令。
對於Adobe Commerce Optimizer Connector部署,aco:config:init命令會透過讓所有聯結器摘要索引器失效來排程初始完整同步。 請參閱啟用 Commerce Optimizer 整合管理與 Commerce Optimizer的同步處理。

當您從命令列觸發saas:resync時,視您的目錄大小而定,可能需要幾分鐘到幾小時的時間才會更新資料。

摘要同步可以任何順序執行 — 它們之間沒有硬性相依性。 下列順序會先從範圍資料開始,這是邏輯起點,因為範圍會定義其他摘要參考的存放區檢視。

bin/magento saas:resync --feed scopesWebsite
bin/magento saas:resync --feed scopesCustomerGroup
bin/magento saas:resync --feed productAttributes
bin/magento saas:resync --feed categories
bin/magento saas:resync --feed products
bin/magento saas:resync --feed prices
bin/magento saas:resync --feed variants
bin/magento saas:resync --feed productoverrides
NOTE
您的環境可能不包括此序列中的每個摘要。 如需完整摘要清單、CLI摘要名稱以及模組需求,請參閱支援的摘要

命令選項

saas:resync命令支援各種同步作業:

  • 透過SKU進行部分同步
  • 繼續已中斷的同步
  • 驗證資料而不同步

檢視所有命令選項和旗標:

bin/magento saas:resync --help

如需選項說明及範例,請參閱下列章節。

NOTE
如需管理匯出處理的進階選項,請參閱自訂匯出處理

--feed

必填。 指定要重新同步的摘要實體。

bin/magento saas:resync --help檔案命令選項和旗標。 它不會列出您環境中可用的每個摘要。 如需包含CLI摘要名稱、索引器ID和摘要表格的完整摘要清單,請參閱支援的摘要

NOTE
已安裝的模組會決定您可以重新同步哪些摘要。 例如,productOverrides需要雲端、內部部署或Commerce as a Cloud Service上的Adobe Commerce,而orders需要銷售訂單模組。

範例:

bin/magento saas:resync --feed products

--by-ids

依其ID部分重新同步特定實體。 支援productsproductAttributesproductOverridesinventoryStockStatuspricesvariantscategoryPermissions摘要。

依預設,當您使用--by-ids選項時,您會使用產品SKU值來指定值。 若要改用產品ID,請新增--id-type=productId選項。

範例:

bin/magento saas:resync --feed products --by-ids='ADB102,ADB111,ADB112'

bin/magento saas:resync --feed products --by-ids='1,2,3' --id-type='productId'

--cleanup-feed

在重新索引並將資料傳送到SaaS之前,請清理摘要索引器表格。 僅支援productsproductAttributesproductOverridesinventoryStockStatuspricesvariantscategoryPermissions

如果與--dry-run選項搭配使用,該作業會針對所有專案執行試執行重新同步作業。

WARNING
使用包含cleanup-feed選項的resync命令會清除本機摘要匯出狀態,並可能導致不完整的同步。 例如,Adobe Commerce中的實體刪除可能不會反映在連線的Commerce Services中,或即使在Adobe Commerce中刪除或更新,過時的實體仍可能保留在遠端Commerce Services索引中。 此選項僅適用於完整環境重建,例如SaaS資料空間清理後。

範例:

bin/magento saas:resync --feed products --cleanup-feed

--continue-resync

繼續執行中斷的重新同步作業。 僅支援productsproductAttributesproductOverrides摘要。

範例:

bin/magento saas:resync --feed productAttributes --continue-resync

--dry-run

執行摘要重新索引程式,而不將摘要提交至SaaS且不儲存至摘要表格。 此選項對於識別資料集的任何問題很有用。

新增EXPORTER_EXTENDED_LOG=1環境變數以將裝載儲存至var/log/saas-export.log

範例:

EXPORTER_EXTENDED_LOG=1 bin/magento saas:resync --feed products --dry-run

測試特定摘要專案

--by-ids選項與擴充的記錄集合一起新增,以測試特定的摘要專案,在var/log/saas-export.log檔案中檢視產生的裝載。

範例:

EXPORTER_EXTENDED_LOG=1 bin/magento saas:resync --feed products --dry-run --by-ids='ADB102,ADB111,ADB112'

測試所有摘要專案

依預設,在resync --dry-run作業期間提交的摘要僅包含新專案,或先前無法匯出的專案。 若要在要處理的摘要中包含所有專案,請使用--cleanup-feed選項。

範例:

bin/magento saas:resync --feed products --dry-run --cleanup-feed

--no-reindex

重新提交現有的目錄資料至Commerce Services,而不重新索引。 不支援產品相關摘要。

行為因匯出模式而異:

  • 舊版模式:重新提交所有資料而不截斷。
  • 立即模式:忽略選項,僅同步更新/失敗。

範例:

bin/magento saas:resync --feed productAttributes --no-reindex
recommendation-more-help
commerce-help-data-export