实践证明,在redis主从读写分离条件下,快照持久化只有开在主实例侧才可以保证数据可以跨越实例重启!
[root@server11 ~]# /usr/local/redis2/bin/redis-cli -h 192.168.1.112 -a 123redis 192.168.1.112:6379> set 1 a
OK
redis 192.168.1.112:6379> set 2 b
OK
redis 192.168.1.112:6379> set 3 c
OK
redis 192.168.1.112:6379> set 4 d
OK
redis 192.168.1.112:6379> exit
[root@server11 ~]# /usr/local/redis2/bin/redis-cli -h 192.168.1.113 -a 123
redis 192.168.1.113:6379> get 4
"d"
redis 192.168.1.113:6379> exit
[root@server11 ~]# /usr/local/redis2/bin/redis-cli -h 192.168.1.112 -a 123 shutdown
[root@server12 ~]# /usr/local/redis2/bin/redis-cli -h 192.168.1.113 -a 123 shutdown
[root@server11 ~]# /usr/local/redis2/bin/redis-server /usr/local/redis2/etc/redis.conf
[root@server12 ~]# /usr/local/redis2/bin/redis-server /usr/local/redis2/etc/redis.conf
[root@server11 ~]# /usr/local/redis2/bin/redis-cli -h 192.168.1.112 -a 123 get 4
"d"
[root@server11 ~]# /usr/local/redis2/bin/redis-cli -h 192.168.1.113 -a 123 get 4
"d"