当前位置:网站首页>Redis 迁移(操作流程建议)1
Redis 迁移(操作流程建议)1
2022-06-26 15:53:00 【franket】
除了下面两条,其它配置都一样
router_id:不同节点不一样
priority:master要高于slave
修改iptables
加入如下配置到b和c 的filter表,然后reload
-A INPUT -d 224.0.0.18 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT
Note: 加载完iptables配置 ,最好在其它机器上进行一个访问测试,避免出现网络问题
b同步到a
选择业务低峰点操作
SLAVEOF a 6379
可以使用以下命令观察同步状态 master_sync_in_progress
info replication
Note: b的同步完成之后,使用相同的方法让c同步b
关闭slave只读
在b上关闭slave只读
Tip: 这个设置本来是为了安全,避免对slave的写操作而导致的数据不一致,但为了平滑切换,需要牺牲一点这方面的安全考虑,如果不打开此设置,会出现一些写入报错
CONFIG SET slave-read-only no
切换keepalived,发布到新VIP
1.切换keepalived,把ip切换到b (可以通过调整优先级,然后reload)
2.然后发布应用到新的VIP(修改配置,将新的VIP作为对redis的访问IP)
Note: 如果先进行的步骤 2 ,然后进行的步骤 1 ,这样有一段时间由于arp缓存的缘故,同时会对a和b进行读写操作,如果应用层面对于数据的读写划分得比较好,短时间内,不会造成太大的问题(a b数据不一致),但时间久了就不行,最彻底的解决办法,还是对新VIP再重新发布一下
断开同步
观察一段时间,注意以下几个方面
1.a上的redis网络连结数 (连接数降为0)
2.b上的redis网络连接数 (连接数逐渐稳定)
3.日志与报错 (没有特别值得注意的报错信息)
在b上使用如下命令断开与a的同步
slaveof no one
此时切换完成,b已经成为了c的master
Tip: 可以考虑重新将a 作为 b的slave,而原来a的slave也可以考虑回收(数据陈旧已经不能用),注意keepalived实例的优先级,避免飘回
原文地址
边栏推荐
- 大话领域驱动设计——表示层及其他
- Auto Sharding Policy will apply Data Sharding policy as it failed to apply file Sharding Policy
- 5 模型保存与加载
- C. Inversion Graph
- HW safety response
- 5000 word analysis: the way of container security attack and defense in actual combat scenarios
- 4 custom model training
- Canvas three dot flashing animation
- 7 自定义损失函数
- Development, deployment and online process of NFT project (2)
猜你喜欢

还存在过有键盘的kindle?

全面解析Discord安全问题

NFT transaction principle analysis (2)

Net基于girdview控件实现删除与编辑行数据

10 tf.data

「干货」NFT 上中下游产业链全景分析

Application of ansible automation

Tencent Peking University's sparse large model training acceleration program het was selected into the VLDB of the international summit

JS creative icon navigation menu switch background color

李飞飞团队将ViT用在机器人身上,规划推理最高提速512倍,还cue了何恺明的MAE...
随机推荐
大话领域驱动设计——表示层及其他
牛客小白月赛50
Solidus Labs欢迎香港前金融创新主管赵嘉丽担任战略顾问
Golang temporary object pool optimization
Development, deployment and online process of NFT project (2)
Tsinghua's "magic potion" is published in nature: reversing stem cell differentiation, and the achievements of the Nobel Prize go further. Netizen: life can be created without sperm and eggs
8 自定义评估函数
C. Inversion Graph
El dialog drag and drop, the boundary problem is completely corrected, and the bug of the online version is fixed
人人都当科学家之免Gas体验mint爱死机
还存在过有键盘的kindle?
R语言广义线性模型函数GLM、glm函数构建逻辑回归模型(Logistic regression)、分析模型是否过离散(Overdispersion)、使用残差偏差与二项式模型中的剩余自由度的比率评估
H5 close the current page, including wechat browser (with source code)
Canvas three dot flashing animation
振动式液量检测装置
若依微服务特殊字符串被过滤的解决办法
【leetcode】48. Rotate image
Interview pit summary I
JVM笔记
How to configure and use the new single line lidar