redis 主从切换

<pre name="code" class="sql">test_redis2:/etc# redis-cli 
127.0.0.1:6379> auth '99999'
OK
127.0.0.1:6379> set aaa 999
(error) READONLY You can't write against a read only slave.
127.0.0.1:6379> 


redis-cli -p 6379 slaveof NO ONE



test_redis2:/etc# redis-cli -p 6379 slaveof NO ONE
(error) NOAUTH Authentication required.


test_redis2:/etc# redis-cli -p 6379 -a '999999' slaveof NO ONE
OK

  -a <password>      Password to use when connecting to the server.

127.0.0.1:6379> auth 'r,uLgt.313' 
OK
127.0.0.1:6379> set xxx 999
OK
127.0.0.1:6379> get xxxx
(nil)
127.0.0.1:6379> get xxx
"999"



                                    
原文地址:https://www.cnblogs.com/hzcya1995/p/13351345.html