Http://blog.sina.com.cn/s/blog_67196ddc0101h8v0.html
Main 192.168.80.62
From 192.168.80.63
The Lord ceased service
Stop service/usr/local/redis/bin/redis-cli-h 192.168.80.62-a redis123-p 6379 shutdown
No password stop service/usr/local/redis/bin/redis-cli-p 6379 shutdown
Execute from top
No password No add-h 192.168.80.63-a redis123
/usr/local/redis/bin/redis-cli-h 192.168.80.63-a redis123-p 6379 slaveof NO One
Test
/usr/local/redis/bin/redis-cli-h 192.168.80.62-a redis123 Set Han 123456
/usr/local/redis/bin/redis-cli-h 192.168.80.62 Get Han
When the Lord recovers
Execute/usr/local/redis/bin/redis-server/usr/local/redis/etc/redis.conf in 192.168.80.62
Executed at 192.168.80.63
/usr/local/redis/bin/redis-cli-p 6379 Save no password
/usr/local/redis/bin/redis-cli-h 192.168.80.62-a redis123-p 6379 Save with password
Cp/data/dbcache/dump.rdb to 192.168.80.62/data/dbcache/
/usr/local/redis/bin/redis-cli-h 192.168.80.63-a redis123-p 6379 slaveof 192.168.80.62 6379
No password execution/usr/local/redis/bin/redis-cli-p 6379 slaveof 192.168.80.62 6379
Ok
This article is from the "No Trace" blog, please be sure to keep this source http://7456193.blog.51cto.com/7446193/1784812
Redis Master-Slave switching