您可以透過記錄排解 Apigee 混合式安裝作業的問題。詳情請參閱「記錄」。
同步處理工具記錄項目
下表說明您在 Synchronizer 記錄檔中會看到的欄位。
| 欄位 | 意義 | 
|---|---|
| org: | 機構名稱 | 
| env: | 環境名稱 | 
| target: | 記錄項目所代表的實體路徑 | 
| action: | 動作 SYNC=上游同步處理動作 REPLICATE=複製/下載動作 | 
| context-id: | 適用的合約版本 | 
例如:
2019-02-05 00:00:59,098 org:hybrid env:test target: action:SYNC context-id: mode: Apigee-Timer-5 INFO CONFIG-CHANGE - SyncContext.syncUpStream() : Upstream sync started with https://apigee.googleapis.com
瞭解同步處理工具記錄
如要排解 Synchronizer 的問題,請查看記錄檔。下表可協助您排解可能在同步器記錄中看到的錯誤。另請參閱記錄。
| 記錄項目 | 代表意義 | 
|---|---|
| org:test env:dev target: action:SYNC context-id: mode:
Apigee-Timer-0 INFO CONFIG-CHANGE - SyncContext.syncUpStream() :
Upstream sync
started with http://localhost:8080 | 已針對機構和環境啟動上游輪詢,並提供管理層網址 | 
| 2019-01-21 16:58:02,275 org:test env:qa target:
action:SYNC context-id: mode: Apigee-Timer-1 INFO CONFIG-CHANGE -
ManagementServerBasedReplicationContext.getContract() :
Upstream contract poll returned 200 | 已成功收到合約 | 
| 2019-01-21 16:58:02,536 org:test env:dev target:
action:SYNC context-id: mode: Apigee-Timer-0 INFO CONFIG-CHANGE -
ManagementServerBasedReplicationContext.getContract() :
Received a new
contract version 20190121.090851.339 | 已收到合約版本 | 
| 2019-01-21 17:58:56,530 org:test env:qa
target:/organizations/test/environments/qa action:REPLICATE
context-id:20190121.090859.699 mode: Apigee-Timer-1 INFO
CONFIG-CHANGE - ConfigReplicator.startReplication() :
Replication
started | 表示複製作業開始。MDC 欄位會指出要複製的內容詳細資料 | 
| 2019-01-21 17:58:56,654 org:test env:qa
target:/organizations/test/environments/qa/resourcefiles/js/JavaScriptCallout.js
action:REPLICATE context-id:20190121.090859.699 mode:
Apigee-Timer-1 INFO CONFIG-CHANGE -
ConfigReplicator.startReplication() : Replication
complete | 表示複製作業已完成。MDC 欄位會指出要複製的內容詳細資料 | 
| 2019-01-21 17:58:56,654 org:test env:qa
target:/organizations/test/environments/qa action:REPLICATE
context-id:20190121.090859.699 mode: Apigee-Timer-1
ERROR
CONFIG-CHANGE - ConfigReplicator.startReplication() : Replication
failed | 表示複製錯誤 | 
| 2019-01-21 17:59:00,246 org:test env:qa target:
action:SYNC context-id: mode: Apigee-Timer-1 INFO CONFIG-CHANGE -
SyncContext.syncUpStream() : Upstream sync finished in 4
seconds | 表示同步處理週期結束,並提供同步處理所需的時間 | 
| 2019-01-21 18:00:00,249 org:test env:dev target:
action:SYNC context-id: mode: Apigee-Timer-1 INFO CONFIG-CHANGE -
ManagementServerBasedReplicationContext.getContract() :
Upstream contract
poll returned 304 | 表示無法使用較新的合約 | 
| 2019-01-21 18:21:39,128 org:test env:qa target:
action:SYNC context-id: mode: Apigee-Timer-1 ERROR CONFIG-CHANGE -
ManagementServerBasedReplicationContext.getContract() :
Upstream contract
poll returned error 0 | 表示無法連線至管理層 | 
| 2019-01-21 18:21:39,128 org:test env:qa target:
action:SYNC context-id: mode: Apigee-Timer-1 ERROR CONFIG-CHANGE -
ManagementServerBasedReplicationContext.getContract() :
Upstream contract
poll returned error 404 | 表示管理層回傳的合約 404 回應 | 
| 2019-01-21 18:22:39,217 org:test1 env:dev target:
action:SYNC context-id: mode: Apigee-Timer-2 ERROR CONFIG-CHANGE -
ManagementServerBasedReplicationContext.getContract() :
Upstream contract
poll returned error 403 | 表示所輪詢的環境未啟用混合式 | 
| 2019-01-21 18:22:39,217 org:test1 env:dev target:
action:SYNC context-id: mode: Apigee-Timer-2 ERROR CONFIG-CHANGE -
ManagementServerBasedReplicationContext.getContract() :
Upstream contract
poll returned error 401 | 您提供的憑證有些問題 | 
錯誤疑難排解
記錄檔是排解安裝問題的好方法。詳情請參閱「記錄」。
同步器無法啟動
以下是幾個錯誤和相應的修正方式。每個錯誤訊息的開頭都會是 ErrorCode,類型為 sync.xxxxx。以下是可能的錯誤代碼
sync.NullOrEmptyConfig
訊息:透過 com.apigee.sync.config 提供的設定為空值或空白
原因:如果未正確提供 Synchronizer 的設定屬性,就會顯示這則錯誤訊息。
解決方法:請確認所有設定屬性都填入適當的值。
sync.ConfigFileNotFound
原因:Synchronizer 已設為從檔案讀取設定屬性,但無法載入檔案
解決方法:請確認檔案在 Synchronizer 開機時可供使用且可存取
sync.IncorrectSettings
原因:同步器設定缺少一或多個必要的設定屬性,或是屬性值超出預期範圍。錯誤訊息應會提供更多詳細資料,說明導致問題的確切屬性。這些錯誤會內建在剖析器中,確保即使在服務啟動前,也能偵測到設定錯誤。
下表列出一些可能的 IncorrectSettings 錯誤:
| 錯誤 | 問題出在哪裡 | 
|---|---|
| configuration.json.IncorrectSettings:
[com.apigee.sync.config.json] Error:/controlPlane/retries numeric
instance is greater than the required maximum (maximum: 3, found:
20) | 傳送至 controlPlane 區段的 retries 欄位值超過允許值 | 
| configuration.json.IncorrectSettings:
[com.apigee.sync.config.json] Error:/controlPlane/connectionTimeout
numeric instance is lower than the required minimum (minimum: 10,
found: 1) | 在 controlPlane 區段中,提供給 connectionTimeout 欄位的值低於允許值 | 
| configuration.json.IncorrectSettings:
[com.apigee.sync.config.json] Error:/controlPlane object has
missing required properties
([\"contractProvider\"]) | 控制平面部分缺少必填欄位 contractProvider | 
| configuration.json.IncorrectSettings:
[com.apigee.sync.config.json] Error:/controlPlane/contractProvider
string \"http://\\uapi.apigee.com\" is not a valid
URI | 合約提供者 URI 無效 | 
| configuration.json.IncorrectSettings:
[com.apigee.sync.config.json] Error:/environments array is too
short: must have at least 1 elements but instance has 0
elements | 環境陣列至少須包含一個環境 | 
| configuration.json.IncorrectSettings:
[com.apigee.sync.config.json] Error:/environments/0 object has
missing required properties
([\"environmentName\"]) | 索引 0 的環境缺少環境名稱必填欄位 | 
| configuration.json.IncorrectSettings:
[com.apigee.sync.config.json] Error:/environments/0 object has
missing required properties
([\"organizationName\"]) | 索引 0 的環境缺少「organizationName」這個必填欄位 | 
| configuration.json.IncorrectSettings:
[com.apigee.sync.config.json] Error:/environments/0/pollInterval
numeric instance is lower than the required minimum (minimum: 60,
found: 6) | 索引 0 的環境有一個輪詢間隔,低於允許的 60 上限 | 
解決方法:修正設定,納入必要的區塊
sync.ReplicationRootDoesNotExist
原因:Synchronizer 提供的複製根目錄不存在
解決方法:確認提供的根資料夾是否存在且可寫入
sync.ReadOnlyReplicationRoot
原因:Synchronizer 提供的複製根目錄沒有寫入權限
解決方法:確認提供的根資料夾是否存在且可寫入
sync.ReplicationRootNotADir
原因:Synchronizer 已提供複製根目錄,可能是檔案
解決方法:確認提供的根資料夾是否存在且可寫入
sync.InvalidControlPlaneURL
原因:Synchronizer 收到的設定網址為空白
解決方法:確認提供的根資料夾是否存在且可寫入
sync.InvalidControlPlaneSubscriptionURL
原因:Synchronizer 收到的訂閱建立設定網址有誤、不完整或留空。
解決方法:將網址修正為有效的設定檔網址,以便建立 Pub/Sub 訂閱項目,處理控制平面傳送的信號。
sync.InvalidControlPlaneUnsubscriptionURL
原因:同步器收到的訂閱項目刪除設定網址不正確、不完整或留空。
解決方法:將網址修正為有效的設定網址,以便刪除 Pub/Sub 訂閱,並處理控制平面的信號。
sync.CannotCreateEnvironmentFolder
原因:Synchronizer 嘗試建立用於複製環境 QA 的資料夾,但無法建立必要的資料夾
解決方法:請確認複製根目錄中沒有與同名路徑相衝突的路徑,該路徑必須是檔案的唯讀路徑
sync.DuplicateEnvironmentEntries
原因:設定中多次新增相同的環境。
解決方法:每個環境只能指定一次。
sync.DiskExceedsAllowedCapacity
原因:所提供的儲存空間磁碟已達到透過設定屬性提供的閾值容量。
解決方法:確認磁碟空間是否足夠,或檢查儲存空間設定是否可調整,以便增加磁碟空間。
sync.OwnershipClaimFailed
原因:Synchronizer 嘗試宣告環境資料夾的擁有權,但失敗
解決方法:每個 Synchronizer 都會先嘗試確認自己是否為檔案系統的唯一寫入器。錯誤會指出路徑和失敗原因。解決根本原因
執行階段中的同步處理器錯誤
執行階段可能會發生下列 Synchronizer 錯誤。
sync.replicators.PollReturnedError
相關訊息會包含上游狀態。以下是錯誤狀態
狀態 0
原因:表示發生連線問題。無法連線至管理層
解決方法:請確認管理介面詳細資料正確無誤,且contracts API 可供存取
狀態 404
原因:伺服器上可能找不到 org/env 名稱
解決方法:請確認管理介面詳細資料正確無誤,且contracts API 可供存取
狀態 401
原因:您提供的憑證很可能沒有組織管理員權限。
解決方法:確認管理層憑證正確無誤,且可存取 contracts API
狀態 403
原因:表示所要輪詢的環境並未設為混合式環境
解決方法:確認機構已設有必要的旗標 "features.hybrid.enabled=true"
sync.OwnershipClaimedByOther
原因:在執行作業期間,Synchronizer 發現檔案根目錄正在由 Synchronizer 的另一個例項存取。(如果檔案系統在 Synchronizers 之間共用,就可能發生這種情況)。
解決方法:解決根本問題,確保沒有兩個 Synchronizer 例項共用相同的檔案系統。同步器會將自身標記為已關閉,並處於無法復原的位置。這麼做也能確保其他存取相同檔案根目錄的同步器會透過擁有權檔案收到通知
sync.DiskExceedsAllowedCapacity
原因:在執行作業期間,Synchronizer 發現磁碟使用量已超過允許的限制。
解決方法:此時,Synchronizer 會中斷所有下載作業,並嘗試執行過時檔案清理作業。不過,這可能會變成反覆發生的情況,而要完全復原的唯一方法,就是確保同步器有足夠的磁碟記憶體可供運作。
診斷合約下載失敗問題
如果您在錯誤訊息中看到「上游合約輪詢」,請嘗試呼叫合約 API 並查看詳細資料,其中使用者名稱是您的 Apigee 使用者名稱 (電子郵件地址)。合約代表 Synchronizer 從管理層下載的整個資料集合。
curl https://apigee.googleapis.com/v1/organizations/org/environments/env/contracts/1.0 -u username