Redis主从持久化测试(2)

实践证明,在redis主从读写分离条件下,快照持久化只有开在主实例侧才可以保证数据可以跨越实例重启!

[root@server11 ~]# /usr/local/redis2/bin/redis-cli -h 192.168.1.112 -a 123
redis 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"
 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/745f7cfe2af46a7227e67fe121ce26b1.html