leonchen83 / redis-rdb-cli

Redis rdb CLI : A CLI tool that can parse, filter, split, merge rdb and analyze memory usage offline. It can also sync 2 redis data and allow user define their own sink service to migrate redis data to somewhere.
Apache License 2.0
423 stars 85 forks source link

single redis sync to redis cluster #84

Closed PhilosophyYuan closed 1 month ago

PhilosophyYuan commented 1 month ago

Ask a question rst sync single redis to redis cluster only support db0?

Describe the bug ./rst -s redis://127.0.0.1:6379?authPassword=xx -m redis://128.0.0.1:6379?authPassword=xx -r -d 1

leonchen83 commented 1 month ago

Yes, syncing to a Redis cluster only supports db0 because the cluster has only db0. Therefore, if you want to sync data from other databases to the cluster, you will need to use other methods.

# backup source redis to db0
rdt -b redis://srouce-ip:6379 -o /path/to/dump.rdb --goal 0
# restore to target redis
rmt -s /path/to/dump.rdb -m redis://cluster-ip:6379 -r
leonchen83 commented 1 month ago

if it doesn't work, could you reproduce your steps?

PhilosophyYuan commented 1 month ago

I tried with rdb, but dest cluster no data rdt -b redis://srouce-ip:6379 -o /path/to/dump.rdb --goal 1 rmt -s /path/to/dump.rdb -m redis://cluster-ip:6379 -r

leonchen83 commented 1 month ago

rdt -b redis://srouce-ip:6379 -o /path/to/dump.rdb --goal 0 that must be --goal 0 means convert all source data to db0

PhilosophyYuan commented 1 month ago

ok i'll try again. thanks

leonchen83 commented 1 month ago

more details refer to #23 and #78

PhilosophyYuan commented 1 month ago

i want migrate source redis db1 data. I tried rdb again, but there is still no data in the target cluster. The command I entered is as follows:

./rdt -b redis://source-single-redis:6379?authPassword=xx -o ./dump.rdb --goal 2

./rmt -s dump.rdb -m redis://dst-cluster-master:6379?authPassword=xx -r

dest cluster no data

PhilosophyYuan commented 1 month ago

I've solved it, thanks

leonchen83 commented 1 month ago

migrate db1 to db0 should ./rdt -b redis://source-single-redis:6379?authPassword=xx -d 1 -o ./dump.rdb --goal 0