New user sign up using AWS Builder ID
New user sign up using AWS Builder ID is currently unavailable on re:Post. To sign up, please use the AWS Management Console instead.
如何對嘗試從 S3 還原 ElastiCache 叢集時發生的「建立失敗」或「權限被拒絕」錯誤進行疑難排解?
我想對嘗試從 Amazon Simple Storage Service (Amazon S3) 還原 Amazon ElastiCache 叢集時發生的「建立失敗」或「權限被拒絕」錯誤進行疑難排解。
簡短說明
以下是從 Amazon S3 還原 ElastiCache 備份失敗的常見原因:
- 您嘗試超越備份限制來還原備份。
- ElastiCache 無法從 Amazon S3 擷取檔案。
- ElastiCache 備份檔位於其他 AWS 區域的 Amazon S3 儲存貯體中。
- 您可以將包含多個資料庫的 rdb 檔案還原至已開啟叢集模式的 ElastiCache 叢集。
解決方法
您嘗試超越備份限制來還原備份
在還原 ElastiCache for Redis 備份時,確保您了解備份限制:
- 您無法從使用開啟了叢集模式之 Redis 叢集的備份還原至關閉了叢集模式的 Redis 叢集。
- 從已開啟叢集模式的 ElastiCache 叢集還原備份時,無法在 ElastiCache 主控台中關閉叢集模式。僅開啟叢集模式的選項可用。
- 將已開啟叢集模式的 ElastiCache 叢集備份匯出至 Amazon S3 時,會建立多個 rdb 檔案。如果您使用一個備份 rdb 檔案從 Amazon S3 移植備份,只會將單個碎片的金鑰內建至叢集中。如果您嘗試使用萬用字元 *rdb 檔案解決此問題,則會出現下列錯誤。
"Error: Object or bucket does not exist for S3 object: examplebucket/cluster-mode-enabled-*.rdb." - 您無法從使用資料分層的叢集還原備份。例如,您無法將 r6gd 節點還原到不使用資料分層的叢集。
- 無法將資料分層備份匯出至 Amazon S3。此外,您也無法從 Amazon S3 還原 ElastiCache 資料分層備份。如需詳細資訊,請參閱限制。
- 對於具有多個資料庫的 rdb 檔案,您無法從 Redis (已關閉叢集模式) 叢集還原到 Redis (已開啟叢集模式) 叢集。嘗試執行此操作時,會出現下列錯誤:
"Error: To restore a snapshot in cluster mode, all keys in the RDB file should reside in DB 0."
ElastiCache 無法從 Amazon S3 擷取檔案
如果 ElastiCache 沒有存取儲存於 Amazon S3 儲存貯體中的 ElastiCache 備份所需的權限,則會出現下列錯誤:
"Restore from snapshot failed for node group 0001 in replication group test.Failed to retrieve file from S3."
若要確認權限問題,請檢閱 ElastiCache 事件。在識別錯誤的原因時,請檢查您的區域是否為下列其中一個:
對於選擇加入區域,您必須具有允許 ElastiCache 從 Amazon S3 擷取備份檔案的儲存貯體政策。
如果您的 Amazon S3 儲存貯體位於下列其中一個區域,您必須允許 ElastiCache 服務存取 S3 中的備份檔案:
- 中國 (北京) 和中國 (寧夏)
- AWS GovCloud (美國西部)
- 預設區域
**注意:**中國 (北京)、中國 (寧夏) 和 AWS GovCloud (美國西部) 區域的標準 ID 與預設 AWS 區域不同:
- 中國 (北京) 和中國 (寧夏) - b14d6a125bdf69854ed8ef2e71d8a20b7c490f252229b806e514966e490b8d83
- AWS GovCloud (美國西部) - 40fa568277ad703bd160f66ae4f83fc9dfdfd06c2f1b5060ca22442ac3ef8be6
- AWS 預設區域 - 540804c33a284a299d2547575ce1010f2312ef3da9b3a053c8bc45bf233e4353
使用標準 ID 或儲存貯體政策授予 ElastiCache 對 rdb 備份物件的存取權限時,還原 Redis 叢集。
ElastiCache 備份檔位於其他區域的 Amazon S3 儲存貯體中
如果嘗試還原位於其他區域的 Amazon S3 儲存貯體中的 ElastiCache 備份,則會出現下列錯誤:
"Permission denied to access S3 object.Please use the S3 object in the same region."
若要解決此錯誤,請完成下列步驟:
**注意:**如果您在執行 AWS Command Line Interface (AWS CLI) 命令時收到錯誤,請參閱 AWS CLI 錯誤疑難排解。此外,請確定您使用的是最新的 AWS CLI 版本。
-
使用下列命令從 Amazon S3 儲存貯體複製 rdb 備份檔案。確定儲存貯體包含的備份位於正在還原 Redis 叢集的區域中。如需詳細資訊,請參閱移轉 ElastiCache for Redis 叢集的最佳做法是什麼?
注意: 將 example-source-bucket、example-destination-bucket、example-backup、example-source-region 和 example destination-region 取代為適當的名稱值。
aws s3 cp s3://example-source-bucket/example-backup.rdb s3://example-destination-bucket/example-backup.rdb --acl bucket-owner-full-control --source-region example-source-region --region example-destination-region
-
確認已為 rdb 備份檔案指派正確的權限 (標準 ID 或儲存貯體政策)。
-
繼續還原叢集。
您可以將包含多個資料庫的 rdb 檔案還原至已開啟叢集模式的 ElastiCache 叢集
如果您將包含多個資料庫的 rdb 檔案還原至已開啟叢集模式的 ElastiCache 叢集,則會出現下列錯誤:
"Restore from snapshot failed for node group 0001 in replication group test.To restore a snapshot in cluster mode, all keys in the RDB file should reside in DB 0.Snapshot ID: arn:aws:s3:::example-bucket/multidb.rdb"
若要檢查還原失敗的原因,請檢閱 ElastiCache 事件。
若要解決此錯誤,請完成下列步驟:
- 確定所有金鑰都移轉到單一資料庫。如需詳細資訊,請參閱 Redis 網站上的移轉。
**注意:**如果來源資料庫位於 ElastiCache Redis 上,則不支援移轉命令。若要解決這個問題,請使用其他 Redis 工具,例如 RIOT。如需更多資訊,請參閱 Redis 網站上的 riot。 - 建立 Redis 資料庫的本機備份。
- 將備份上傳到 Amazon S3。
- 繼續還原至 ElastiCache (已開啟叢集模式) 叢集。

相關內容
- 已提問 6 個月前lg...
- 已提問 8 個月前lg...
- AWS 官方已更新 9 個月前
- AWS 官方已更新 9 個月前
- AWS 官方已更新 7 個月前
- AWS 官方已更新 9 個月前