3 月 012014
 

redis  主从切换及数据恢复

目前主不做任何持久化, 从rdb 及aof持久化都有

场景 1:主ok, 从挂掉.

直接重启从, 从会自动从主同步最新的数据

场景 2: 主挂掉,从ok

情况1 :sentinel  监控正常 并且自动把从服务器 提升为主 ,  直接重启原来的主服务器 (现在的从服务器), 之后可以手工再把主从切换回来

情况2 : sentinel  没有正常切换, 需要手动把从提升为主(并且执行相关脚本重定向 host), 然后再 重复情况 1的步骤恢复数据

场景 3: 主从同时挂掉

情况1 :从的aof文件正常, 将从的aof 文件copy 到主的目录下, 并配置主的

#appendonly yes
#appendfilename "appendonly.aof"

重启主服务器, 等数据载入完成后 运行命令  config  set appendonly no, 并需要注释掉主服务器的 aof配置。 然后重启从服务器

 Posted by at 下午 11:48

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny