使用微软云的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