Rump迁移RedisDB至DB0

发布时间 2023-07-14 15:00:53作者: kongshuo

下载Rump

# wget下载包
[root@ceshi-redis6 ~]# wget https://github.com/stickermule/rump/releases/download/0.0.3/rump-0.0.3-linux-amd64
--2023-07-14 14:34:20--  https://github.com/stickermule/rump/releases/download/0.0.3/rump-0.0.3-linux-amd64
Resolving github.com (github.com)... 20.205.243.166
Connecting to github.com (github.com)|20.205.243.166|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/74695306/c345121c-fed7-11e6-890a-8f84b7820512?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230714%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230714T063420Z&X-Amz-Expires=300&X-Amz-Signature=e1cdc2008a546d2e36e39500fb3a652fd85d026c042759264e9be85fade76fed&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=74695306&response-content-disposition=attachment%3B%20filename%3Drump-0.0.3-linux-amd64&response-content-type=application%2Foctet-stream [following]
--2023-07-14 14:34:20--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/74695306/c345121c-fed7-11e6-890a-8f84b7820512?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230714%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230714T063420Z&X-Amz-Expires=300&X-Amz-Signature=e1cdc2008a546d2e36e39500fb3a652fd85d026c042759264e9be85fade76fed&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=74695306&response-content-disposition=attachment%3B%20filename%3Drump-0.0.3-linux-amd64&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.111.133, 185.199.110.133, 185.199.108.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4543675 (4.3M) [application/octet-stream]
Saving to: ‘rump-0.0.3-linux-amd64’

100%[===================================================================================================>] 4,543,675   14.9MB/s   in 0.3s   

2023-07-14 14:34:21 (14.9 MB/s) - ‘rump-0.0.3-linux-amd64’ saved [4543675/4543675]

# 解压缩后,添加可执行权限。
[root@ceshi-redis6 ~]# ls
rump-0.0.3-linux-amd64
[root@ceshi-redis6 ~]# mv rump-0.0.3-linux-amd64 rump
[root@ceshi-redis6 ~]# chmod +x rump 
# 移至/usr/bin目录下变成可执行命令
[root@ceshi-redis6 ~]# mv rump /usr/bin

切换数据库写入数据(这里是实验就随便写)

使用Rump迁移

[root@ceshi-redis6 ~]# rump -from redis://Huawei12@127.0.0.1:6379/5 -to redis://Huawei12@127.0.0.1:6379/0
.Sync done

rump -from {source_redis_address} -to {target_redis_address}

{source_redis_address}
源Redis实例地址,格式为:redis://[user:password@]host:port/db,中括号部分为可选项,实例设置了密码访问时需要填写密码,格式遵循RFC 3986规范。注意用户名可为空,但冒号不能省略,例如redis://:mypassword@192.168.0.45:6379/1。db为数据库编号,不传则默认为0。
{target_redis_address}
目标Redis实例地址,格式与from相同。

验证数据是否迁移成功