Skip to content

常见报错

suxb201 edited this page Mar 13, 2023 · 5 revisions

error=[ERR syntax error]

一般是使用的 Redis 版本较旧,在 Redis 5.0 之前不支持 ABSTTL 参数:

  • Starting with Redis version 3.0.0: Added the REPLACE modifier.
  • Starting with Redis version 5.0.0: Added the ABSTTL modifier.
  • Starting with Redis version 5.0.0: Added the IDLETIME and FREQ options.

推荐使用 5.0 及以上的版本。

参照 issue:

error=[ERR Bad data format]

需要确认目的端版本是否小于源端版本,一般 Redis 新版本会新增数据解决,旧版无法解析。

参照 issue:

error=[ERR SELECT is not allowed in cluster mode]

常见于从单机实例迁移到集群实例,Redis 的单机实例是支持多 database 的,而集群实例不支持,所以会报这个错误。

解决方法:编辑 swap_db.lua,过滤掉非 db0 的数据或者将其他 db 的数据合并到 db0。

参照 issue:

PNC dial tcp x.x.x.x:x i/o timeout

  1. 请排查当前机器与 x.x.x.x:x 网络是否可通
  2. 使用 redis-cli 连接 x.x.x.x:x,确认 redis 协议可通

PNC EOF

看下调用栈,类似:

2023-03-06 11:50:24 PNC EOF
2023-03-06 11:50:24 INF AOFWriter close file. filename=[42074605743.aof], filesize=[4007]
panic: EOF

goroutine 50 [running]:
github.com/rs/zerolog.(*Logger).Panic.func1({0xc00023e2e7, 0x0})
	github.com/rs/zerolog@v1.28.0/log.go:375 +0x2d
github.com/rs/zerolog.(*Event).msg(0xc000098540, {0xc00023e2e7, 0x3})
	github.com/rs/zerolog@v1.28.0/event.go:156 +0x2b8
github.com/rs/zerolog.(*Event).Msgf(0xc000098540, {0x79a4ac, 0x2c7}, {0x0, 0x79a3e6, 0x3})
	github.com/rs/zerolog@v1.28.0/event.go:129 +0x4e
github.com/alibaba/RedisShake/internal/log.Panicf({0x79a4ac, 0x3}, {0x0, 0x0, 0x0})
	github.com/alibaba/RedisShake/internal/log/func.go:32 +0xef
github.com/alibaba/RedisShake/internal/log.PanicError({0x8167a0, 0xc0000a6060})
	github.com/alibaba/RedisShake/internal/log/func.go:36 +0x33
github.com/alibaba/RedisShake/internal/reader.(*psyncReader).saveAOF(0xc00009a640, {0x816540, 0xc000098780})
	github.com/alibaba/RedisShake/internal/reader/psync.go:202 +0x166
created by github.com/alibaba/RedisShake/internal/reader.(*psyncReader).StartRead.func1
	github.com/alibaba/RedisShake/internal/reader/psync.go:48 +0xef

一般是源端 output buffer 爆掉了,可以进一步查看源端对应时刻的日志确认,看日志中是否有因为 buffer 过高而断掉连接的情况。

如果是这样的原因,可以调高源端 buffer 限制,一般 512MB 足够用:

config set client-output-buffer-limit "slave 536870912 536870912 0"

ERR wrong number of arguments for 'restore' command

是目的版本不支持 restore 的一些参数,需要准确填写 RedisShake 配置文件中的 version 字段. image

panic: RDB restore command behavior is rewrite, but target redis version is 2.800000, not support REPLACE modifier

因为 Redis 2.8 版本不支持 restore 带有 REPLACE 参数,所以需要改下 RedisShake 中的 rdb_restore_command_behavior 配置项,值不能是 rewrite

# redis-shake gets key and value from rdb file, and uses RESTORE command to
# create the key in target redis. Redis RESTORE will return a "Target key name
# is busy" error when key already exists. You can use this configuration item
# to change the default behavior of restore:
# panic:   redis-shake will stop when meet "Target key name is busy" error.
# rewrite: redis-shake will replace the key with new value.
# ignore:  redis-shake will skip restore the key when meet "Target key name is busy" error.
rdb_restore_command_behavior = "rewrite" # panic, rewrite or skip