hank_gao

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
统计
 

tags: redis

redis集群迁移

安装依赖包

yum -y install automake libtool autoconf bzip2 unzip

下载和安装redis-migrate-tool

unzip redis-migrate-tool-master.zip
cd redis-migrate-tool-master
autoreconf -fvi
./configure 
make
vim /etc/profile.d/redis.sh
export PATH=$PATH:/ane/redis-migrate-tool-master/src
chmod +x /etc/profile.d/redis.sh 
source /etc/profile.d/redis.sh

修改redis-migrate-tool配置文件

vim rmt.conf
[source]
type: redis cluster
servers :
-192.168.7.131:6379
-192.168.7.131:6380
-192.168.7.131:6381
-192.168.7.131:6382
-192.168.7.131:6383
-192.168.7.131:6384
[target]
type: rdb file

[common]
listen: 0.0.0.0:8888

导出

redis-migrate-tool -c redis-migrate-tool-master/rmt.conf -o log.txt -d
tail -500f log.txt 

将rdb文件拷贝到另一台服务器并在另一台服务器上安装redis-migrate-tool

导入

vim redis-migrate-tool-master/rmt.conf
[source]
type: rdb file
servers :
-node192.168.7.131_6379-1490243998172613-20257.rdb
-node192.168.7.131_6380-1490243998848505-20257.rdb
-node192.168.7.131_6381-1490243999960457-20257.rdb
[target]
type: redis cluster
servers:
-192.168.2.101:6379

[common]
listen: 0.0.0.0:8888
redis-migrate-tool -c redis-migrate-tool-master/rmt.conf -o log.txt -d
tail -500f log.txt 

数据校验

$src/redis-migrate-tool -c rmt.conf -o log -C redis_check
Check job is running...

Checked keys: 1000
Inconsistent value keys: 0
Inconsistent expire keys : 0
Other check error keys: 0
Checked OK keys: 1000

All keys checked OK!
Check job finished, used 1.041s

*从redis cluster集群迁移数据到另外一个cluster集群

[source]
type: redis cluster
servers:
- 127.0.0.1:8379

[target]
type: redis cluster
servers:
- 127.0.0.1:7379

[common]
listen: 0.0.0.0:8888

*通过redis-cli连接redis-migrate-tool监控的端口,运行info命令

$redis-cli -h 127.0.0.1 -p 8888
127.0.0.1:8888> info
# Server
version:0.1.0
os:Linux 2.6.32-573.12.1.el6.x86_64 x86_64
multiplexing_api:epoll
gcc_version:4.4.7
process_id:9199
tcp_port:8888
uptime_in_seconds:1662
uptime_in_days:0
config_file:/ect/rmt.conf

# Clients
connected_clients:1
max_clients_limit:100
total_connections_received:3

# Memory
mem_allocator:jemalloc-4.0.4

# Group
source_nodes_count:32
target_nodes_count:48

# Stats
all_rdb_received:1
all_rdb_parsed:1
rdb_received_count:32
rdb_parsed_count:32
total_msgs_recv:7753587
total_msgs_sent:7753587
total_net_input_bytes:234636318
total_net_output_bytes:255384129
total_net_input_bytes_human:223.77M
total_net_output_bytes_human:243.55M
total_mbufs_inqueue:0
total_msgs_outqueue:0
127.0.0.1:8888>
posted on   hank_gao  阅读(331)  评论(0编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
 
点击右上角即可分享
微信分享提示