Skip to content

Commit

Permalink
docs: add more docs (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
suxb201 authored May 22, 2024
1 parent cd735a3 commit b3c3352
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/.vitepress/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function sidebar(): DefaultTheme.SidebarItem[] {
items: [
{ text: 'Redis Modules', link: '/zh/others/modules' },
{ text: '如何判断数据一致', link: '/zh/others/consistent' },
{ text: '跨版本迁移', link: '/zh/others/version' },
]
},
]
Expand Down
7 changes: 5 additions & 2 deletions docs/src/zh/guide/mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,16 @@ outline: deep

在不支持 PSync 协议的场景下,可以使用 `scan_reader`。需要注意的是,`scan_reader` 会对源库造成较大的压力。

### AWS ElastiCache and MemoryDB
### AWS ElastiCache

优选 `sync_reader`, AWS ElastiCache and MemoryDB 默认情况下没有开启 PSync 协议,但是可以通过提交工单的方式请求开启 PSync 协议。AWS 会在工单中给出一份重命名的 PSync 命令,比如 `xhma21yfkssync``nmfu2bl5osync`。此命令效果等同于 `psync` 命令,只是名字不一样。
优选 `sync_reader`, AWS ElastiCache 默认情况下没有开启 PSync 协议,但是可以通过提交工单的方式请求开启 PSync 协议。AWS 会在工单中给出一份重命名的 PSync 命令,比如 `xhma21yfkssync``nmfu2bl5osync`。此命令效果等同于 `psync` 命令,只是名字不一样。
用户修改 RedisShake 配置文件中的 `aws_psync` 配置项即可。对于单实例只写一对 `ip:port@cmd` 即可,对于集群实例,需要写上所有的 `ip:port@cmd`,以逗号分隔。

不方便提交工单时,可以使用 `scan_reader`。需要注意的是,`scan_reader` 会对源库造成较大的压力。

### AWS MemoryDB

AWS MemoryDB 不提供 PSync 权限,可使用 `scan_reader``rdb_reader`



Expand Down
2 changes: 1 addition & 1 deletion docs/src/zh/others/consistent.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
1. 因为过期算法限制,源端中可能存在一些 Key 已经过期但实际上没有被删除,这批 Key 在目的端可能会被删除,导致目的端 Key 数量少于源端。
2. 源端和目的端独立运行,各自的过期算法独立运行,过期算法具有随机性,会导致源端和目的端删除的 Key 不一致,导致 Key 数量不一致。

在实践中,带有过期时间的 Key 一般认为是允许不一致的,不会影响业务,所以可以仅校验不带有过期时间的 Key 数量是否一致。如下所示,应当分别计算源端和目的端的 `$keys-$expires` 的值是否一样。[795](https://github.com/tair-opensource/RedisShake/issues/795) [791](https://github.com/tair-opensource/RedisShake/issues/791)
在实践中,带有过期时间的 Key 一般认为是允许不一致的,不会影响业务,所以可以仅校验不带有过期时间的 Key 数量是否一致。如下所示,应当分别计算源端和目的端的 `$keys-$expires` 的值是否一样。[[795]](https://github.com/tair-opensource/RedisShake/issues/795) [[791]](https://github.com/tair-opensource/RedisShake/issues/791)
```
127.0.0.1:6379> info keyspace
# Keyspace
Expand Down
13 changes: 13 additions & 0 deletions docs/src/zh/others/version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 跨版本迁移

常见 Redis-like 数据库都是向后兼容的,低版本实例迁移至高版本时,不会存在兼容问题。
但是,高版本实例迁移至低版本时,可能会存在不兼容问题,例如:Redis 7.0 的数据导入至 Redis 4.0。
建议尽量避免此类场景,因为会存在多种不兼容场景 [[794]](https://github.com/tair-opensource/RedisShake/issues/794) [[699]](https://github.com/tair-opensource/RedisShake/issues/699)
1. 二进制数据编码不兼容
2. 命令不支持,见于 SYNC 的增量阶段


如果无法避免迁移至低版本,可以通过以下方式解决:
1. 对于二进制数据编码不兼容,可以考虑修改 `target_redis_proto_max_bulk_len` 参数,将其设置为 0。
`target_redis_proto_max_bulk_len` 本意是为了处理超大 Key,RedisShake 会在同步过程中将大于 `target_redis_proto_max_bulk_len` 的二进制数据转换为 RESP 命令。比如元素非常多的 list 结构,RedisShake 会将其转换为多个 `RPUSH` 命令。在降低版本场景中,可以将其设置为 0,让 RedisShake 将所有二进制数据转换为 RESP 命令,以此避免二进制数据编码不兼容问题。
2. 对于命令不支持问题,建议直接过滤掉不支持的命令。

0 comments on commit b3c3352

Please sign in to comment.