当前位置:网站首页>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实例的优先级,避免飘回
原文地址
边栏推荐
- Comprehensive analysis of discord security issues
- Canvas three dot flashing animation
- The first batch in the industry! Tencent cloud security and privacy computing products based on angel powerfl passed CFCA evaluation
- Solana capacity expansion mechanism analysis (2): an extreme attempt to sacrifice availability for efficiency | catchervc research
- 9 Tensorboard的使用
- 现在券商的优惠开户政策是什么?现在在线开户安全么?
- 手写数字体识别,用保存的模型跑自己的图片
- (1) Keras handwritten numeral recognition and recognition of self written numbers
- Common properties of XOR and addition
- R language generalized linear model function GLM, GLM function to build logistic regression model, analyze whether the model is over discrete, and use the ratio of residual deviation and residual degr
猜你喜欢

What is the difference between stm32f1 and gd32f1?

如何辨别合约问题

NFT transaction principle analysis (2)

Svg canvas canvas drag

PCIe Capabilities List

Analyse panoramique de la chaîne industrielle en amont, en aval et en aval de la NFT « Dry goods»

SVG大写字母A动画js特效

Handwritten numeral recognition, run your own picture with the saved model

11 introduction to CNN

Simple use of tensor
随机推荐
若依如何实现接口限流?
如何辨别合约问题
JS creative icon navigation menu switch background color
Canvas three dot flashing animation
When a project with cmake is cross compiled to a link, an error cannot be found So dynamic library file
5000字解析:实战化场景下的容器安全攻防之道
CNN optimized trick
Net基于girdview控件实现删除与编辑行数据
若依打包如何分离jar包和资源文件?
Have you ever had a Kindle with a keyboard?
【思考】在买NFT的时候你在买什么?
Svg canvas canvas drag
NFT交易原理分析(1)
js创意图标导航菜单切换背景色
NFT合约基础知识讲解
Selenium saves elements as pictures
Solana扩容机制分析(1):牺牲可用性换取高效率的极端尝试 | CatcherVC Research
2 three modeling methods
Swiftui retrieves the missing list view animation
Development, deployment and online process of NFT project (1)