利用工具RedisSharke
实战
- 下载安装
wget <https://github.com/tair-opensource/RedisShake/archive/refs/tags/v4.0.5.tar.gz
>- 修改配置文件shake.toml
function = "" [sync_reader] cluster = true # set to true if source is a redis cluster address = "172.22.4.223: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 = false # 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 # [scan_reader] # 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 # ksn = false # set to true to enabled Redis keyspace notifications (KSN) subscription # tls = false # dbs = [] # set you want to scan dbs such as [1,5,7], if you don't want to scan all # prefer_replica = true # set to true if you want to sync from replica node # [rdb_reader] # filepath = "/tmp/dump.rdb" # [aof_reader] # filepath = "/tmp/.aof" # timestamp = 0 # subsecond [redis_writer] cluster = true # set to true if target is a redis cluster address = "r-bp11w15hedzgmm33l5.redis.rds.aliyuncs.com:6379" # when cluster is true, set address to one of the cluster node username = "r-bp11w15hedzgmm33l5" # keep empty if not using ACL password = "lotusad4@HMI" # keep empty if no authentication is required tls = false off_reply = false # ture off the server reply [advanced] dir = "data" ncpu = 0 # runtime.GOMAXPROCS, 0 means use runtime.NumCPU() cpu cores pprof_port = 0 # pprof port, 0 means disable status_port = 0 # status port, 0 means disable # log log_file = "shake.log" log_level = "info" # debug, info or warn log_interval = 5 # in seconds # 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 = "panic" # panic, rewrite or skip # redis-shake uses pipeline to improve sending performance. # This item limits the maximum number of commands in a pipeline. pipeline_count_limit = 1024 # Client query buffers accumulate new commands. They are limited to a fixed # amount by default. This amount is normally 1gb. target_redis_client_max_querybuf_len = 1024_000_000 # In the Redis protocol, bulk requests, that are, elements representing single # strings, are normally limited to 512 mb. target_redis_proto_max_bulk_len = 512_000_000 # If the source is Elasticache or MemoryDB, you can set this item. aws_psync = "" # example: aws_psync = "10.0.0.1:6379@nmfu2sl5osync,10.0.0.1:6379@xhma21xfkssync" # destination will delete itself entire database before fetching files # from source during full synchronization. # This option is similar redis replicas RDB diskless load option: # repl-diskless-load on-empty-db empty_db_before_sync = false [module] # The data format for BF.LOADCHUNK is not compatible in different versions. v2.6.3 <=> 20603 target_mbbloom_version = 20603
- 生成可执行脚本
./build.sh
- 执行生成的脚本
上一步执行后在bin目录下会生成脚本redis-shake和shake.toml, 执行脚本
./redis-shake shake.tom
完成