Master-slave replication
1. One redis Service has multiple copies of the service , this redis The service is called master, Other copies are called slaves
2. Master and slave will keep data synchronized
3. only master Write command can be executed ,slave Read command only ( default )
4. Creation of master-slave replication
1) Create a slave node :redis-server --port 6379 --slaveof master-ip master-port
2) Start one first redis service , In the client, change to from
>slaveof master-ip master-port
From slave to master in client
>slaveof no one
Client connection :redis-cli -h ip -p port -n dbnum
3) Profile mode : Read profile at startup .6380.conf
slaveof ip port
port 6380
redis-server 6380.conf
5. Master slave replication problem
master down, Need to manually slave use slaveof no one Promote to master
To achieve automation , We need redis sentry

redis High availability sentry
1. Start a run in Sentine In mode redis Service instance
redis-sentinel
redis-server /path/to/sentinel.conf --sentinel
each sentinel Can monitor any number of master And the master Next slaves
Monitoring the same master Of sentinel Will automatically connect , There is a vote , similar zk,3 Nodes

2.sentinel configuration file
Contains at least one monitoring configuration option , For monitoring master
sentinel monitor name ip port quorum( At least a few votes ), for example :
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel Default port 26379
$redis-sentinel sentinel1.conf
port 26379
sentinel monitor s1 127.0.0.1 6379 2
One for each machine sentinel that will do .


3. Start first redis Master slave , Post start sentinel