Skip to content

Commit

Permalink
docs: refine documentation (#831)
Browse files Browse the repository at this point in the history
  • Loading branch information
suxb201 committed Jun 17, 2024
1 parent 5456398 commit 5e5133d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [中文文档](https://tair-opensource.github.io/RedisShake/)
- [English Documentation](https://tair-opensource.github.io/RedisShake/en/)

![](./docs/demo.gif)
## Overview

RedisShake is a tool designed for processing and migrating Redis data. It offers the following features:
Expand Down
19 changes: 16 additions & 3 deletions cmd/redis-shake/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,20 @@ Loop:
func waitShutdown(cancel context.CancelFunc) {
quitCh := make(chan os.Signal, 1)
signal.Notify(quitCh, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
sig := <-quitCh
log.Infof("Got signal: %s to exit.", sig)
cancel()
sigTimes := 0
for {
sig := <-quitCh
sigTimes++
if sig != syscall.SIGINT {
log.Infof("Got signal: %s.", sig)
} else {
log.Infof("Got signal: %s to exit. Press Ctrl+C again to force exit.", sig)
if sigTimes >= 2 {
os.Exit(0)
}
cancel()
}

}

}
Binary file added docs/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/src/zh/reader/scan_reader.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Scan Reader 有 SCAN 和 KSN 两个阶段,SCAN 阶段是全量同步,KSN 阶

`ksn` 使用 [Redis keyspace notifications](https://redis.io/docs/manual/keyspace-notifications/)
能力来订阅 Key 的变化。具体来说,RedisShake 会使用 `psubscribe` 命令订阅 `__keyevent@*__:*`,当 Key 发生变化时,RedisShake 会收到发生修改的 Key,之后使用 `DUMP``RESTORE` 命令来从源端读取 Key 的内容,并写入目标端。
1. Redis 在默认情况下不会开启 `notify-keyspace-events` 配置,需要手动开启,保证值中含有 `E`
1. Redis 在默认情况下不会开启 `notify-keyspace-events` 配置,需要手动开启,保证值中含有 `AE`
2. 如果在 KSN 阶段出现源端将连接断开,考虑适当调高 `client-output-buffer-limit pubsub` 的值。[802](https://github.com/tair-opensource/RedisShake/issues/802)
3. `Redis keyspace notifications` 不会感知到 `FLUSHALL``FLUSHDB` 命令,因此在使用 `ksn` 参数时,需要确保源端数据库不会执行这两个命令。

Expand Down
3 changes: 3 additions & 0 deletions internal/client/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ func getReplicaAddr(info string) RedisReplicaInfo {
replicas = append(replicas, replica)
}
}
if len(replicas) == 0 {
log.Panicf("no replica found, should not set `prefer_replica` to true")
}
best := replicas[0]
for _, replica := range replicas {
if replica.Offset > best.Offset {
Expand Down
12 changes: 6 additions & 6 deletions shake.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ cluster = false # set to true if source is a redis cluster
address = "127.0.0.1:6379" # when cluster is true, set address to one of the cluster node
username = "" # keep empty if not using ACL
password = "" # keep empty if no authentication is required
tls = false
sync_rdb = true # set to false if you don't want to sync rdb
sync_aof = true # set to false if you don't want to sync aof
prefer_replica = true # set to true if you want to sync from replica node
try_diskless = false # set to true if you want to sync by socket and source repl-diskless-sync=yes
tls = false #
sync_rdb = true # set to false if you don't want to sync rdb
sync_aof = true # set to false if you don't want to sync aof
prefer_replica = false # set to true if you want to sync from replica node
try_diskless = false # set to true if you want to sync by socket and source repl-diskless-sync=yes

#[scan_reader]
#cluster = false # set to true if source is a redis cluster
Expand Down Expand Up @@ -38,7 +38,7 @@ address = "127.0.0.1:6380" # when cluster is true, set address to one of the clu
username = "" # keep empty if not using ACL
password = "" # keep empty if no authentication is required
tls = false
off_reply = false # ture off the server reply
off_reply = false # ture off the server reply

[advanced]
dir = "data"
Expand Down

0 comments on commit 5e5133d

Please sign in to comment.