天天看點

【Azure Redis 緩存】Azure Cache for Redis 服務的導出RDB檔案無法在自建的Redis服務中導入

問題描述

使用微軟雲的Redis服務,導出它的RDB檔案後,想把資料恢複到本地自建的Redis服務中,發現出現如下錯誤:

15000:S 21 Jun 08:14:11.199 * Retrying with SYNC...
15000:S 21 Jun 08:14:11.201 # MASTER aborted replication with an error: ERR Command disallowed
15000:S 21 Jun 08:14:12.190 * Connecting to MASTER 40.139.62.182:6379
15000:S 21 Jun 08:14:12.190 * MASTER <-> SLAVE sync started
15000:S 21 Jun 08:14:12.193 * Non blocking connect for SYNC fired the event.
15000:S 21 Jun 08:14:12.196 * Master replied to PING, replication can continue...
15000:S 21 Jun 08:14:12.199 * (Non critical) Master does not understand REPLCONF listening-port: -ERR Command disallowed
15000:S 21 Jun 08:14:12.201 * (Non critical) Master does not understand REPLCONF capa: -ERR Command disallowed
15000:S 21 Jun 08:14:12.201 * Partial resynchronization not possible (no cached master)
15000:S 21 Jun 08:14:12.203 * Master does not support PSYNC or is in error state (reply: -ERR Command disallowed)
15000:S 21 Jun 08:14:12.203 * Retrying with SYNC...
15000:S 21 Jun 08:14:12.205 # MASTER aborted replication with an error: ERR Command disallowed
15000:S 21 Jun 08:14:13.193 - 0 clients connected (0 slaves), 721768 bytes in use
15000:S 21 Jun 08:14:13.193 * Connecting to MASTER 40.139.62.182:6379
15000:S 21 Jun 08:14:13.193 * MASTER <-> SLAVE sync started
15000:S 21 Jun 08:14:13.196 * Non blocking connect for SYNC fired the event.
15000:S 21 Jun 08:14:13.199 * Master replied to PING, replication can continue...
15000:S 21 Jun 08:14:13.203 * (Non critical) Master does not understand REPLCONF listening-port: -ERR Command disallowed
15000:S 21 Jun 08:14:13.204 * (Non critical) Master does not understand REPLCONF capa: -ERR Command disallowed
15000:S 21 Jun 08:14:13.204 * Partial resynchronization not possible (no cached master)
15000:S 21 Jun 08:14:13.206 * Master does not support PSYNC or is in error state (reply: -ERR Command disallowed)
15000:S 21 Jun 08:14:13.206 * Retrying with SYNC...
15000:S 21 Jun 08:14:13.208 # MASTER aborted replication with an error: ERR Command disallowed
       

問題解答 

自建或從其他未經過特殊處理的Redis RDB檔案,可以導入到Azure Redis服務中。但Azure Redis 導出的RDB檔案會經過一些特殊處理,如适配Windows版Redis,導緻它并不能直接導入本地的Redis中。是以遇見了以上錯誤。

如要進行轉移資料,可以通過程式從Azure中讀取所有的Redis Key 然後寫入到本地自建的Redis服務中。

參考資料

以程式設計方式遷移:https://docs.azure.cn/zh-cn/azure-cache-for-redis/cache-migration-guide#migrate-programmatically

當在複雜的環境中面臨問題,格物之道需:濁而靜之徐清,安以動之徐生。 雲中,恰是如此!

繼續閱讀