Recommended items: the Spring Cloud, the Spring Security OAuth2 of RBAC rights management system welcome attention
problem
For various reasons the production environment, we need to migrate existing servers, including how the line is running redis cluster environment to do?
Related to the data source changes, the original data on how smooth migration to the new instance, which can achieve a seamless migration?
Program Summary
Based redis own RDB / AOF backup mechanism
- Execution
save\bgsave
trigger data persistenceRDB
file - Redis copy the backup file (dump.rdb) to the target machine
- Restart the target instance re-
load
RDB file
- About the difference between save / bgsave of
command | save | bgsave |
---|---|---|
IO obstruction | Synchronize | asynchronous |
the complexity | O (n) | O (n) |
Shortcoming | Blocking client | Need to fork, memory consumption |
Based on redis-dump
import and export json
backup
redis-dump JSON-based data backup and restore the Redis https://github.com/delano/redis-dump
# 导出命令
redis-dump –u 127.0.0.1:6379 > lengleng.json
# 导出指定数据库数据
redis-dump -u 127.0.0.1:6379 -d 15 > lengleng.json
# 如果redis设有密码
redis-dump –u :[email protected]:6379 > lengleng.json
# 导入命令
< lengleng.json redis-load
# 指定redis密码
< lengleng.json redis-load -u :[email protected]:6379
复制代码
Based redis-shake
achieve redis-cluster
migration
- Based
Docker
create two clusters
docker run --name redis-cluster1 -e CLUSTER_ANNOUNCE_IP=192.168.0.31 -p 8000-8005:7000-7005 -p 18000-18005:17000-17005 pig4cloud/redis-cluster:4.0
复制代码
docker run --name redis-cluster2 -e CLUSTER_ANNOUNCE_IP=192.168.0.31 -p 8000-8005:7000-7005 -p 18000-18005:17000-17005 pig4cloud/redis-cluster:4.0
复制代码
- Configuration
redis-shake.conf
source.type: cluster
source.address: [email protected]:7000 #配置一个节点自动发现
target.type: cluster
target.address: [email protected]:8000 #配置一个节点自动发现
复制代码
- The implementation of the full amount of incremental synchronization
- restful monitoring indicators
# 用户可以通过restful监控指标查看内部运行状况,默认的restful端口是9320:
http://127.0.0.1:9320/metric
复制代码
Recently time off. The whole point of fancy series, welcome attention.
Recommended items: the Spring Cloud, the Spring Security OAuth2 of RBAC rights management system welcome attention
Recently time off. The whole point of fancy series, welcome attention.