Redis master (separate read and write) from the Copy

There are benefits from a master copy 2 points:
1, redis avoid single points of failure
2, separate read and write to build infrastructure to meet the reading and writing small application scenarios

 

Master-slave architecture

 

 

Start the instance

Create a directory 6379,6380,6381, respectively, will be installed redis.conf directory are copied to the three directories.

 

 Respectively, into three directories, namely to modify the configuration file, the ports are set to: 6379 (Master), 6380 ( Slave), 6381 (Slave). At the same time you want to set pidfile files for different paths.
Start redis were three instances:

 

 Login server-cli

redis-cli -h host -p port -a password

Setting the master-slave

Disposed in the main from redis in two ways:

1, provided in the redis.conf slaveof
A) slaveof 
2, using redis-cli redis client to connect to the service, the command execution slaveof
A) slaveof 
slaveof

The second way to lose after the restart replication from the primary relationship.

View from the main information: INFO replication

the Lord:

 

 role: the role
connected_slaves: from quantity library
slave0: information from the library

From:

 

Guess you like

Origin www.cnblogs.com/fubinhnust/p/11956339.html