1. Redis Sentinel Feature
Redis Sentinel is a set of distributed systems for managing Redis instances, with 3 main tasks to complete:
1) Monitoring: Continuously monitor whether Redis master or slave instances are running as expected
2) Notification: If the monitored Redis instance is running abnormally, Sentinel will notify the external (person or program) via API
3) Automation failover: If the master instance fails, Sentinel will re-elect the master and initiate automatic failover: Select the slave instance of the slave-priority minimum and promote it to master. Also modify the configuration of the other slave so that its master configuration item points to the new master, and when old master resumes restarting, it is automatically demoted to the slave of the new master. Finally, depending on the configuration, Redis Sentinel will also notify the new master address to the application that is currently accessing Redis.
2. Deployment situation
10.150.21.65 Master
10.150.21.69 slave
10.150.21.66 Sentinel Server
3, Master,slave,sentinel server to install Redis;
4. Execute on slave host
REDIS-CLI slaveof 10.150.21.65 6379;/etc/init.d/redis Stop;/etc/init.d/redis start
5. Configuring Sentinel Server
Vim sentinel.conf
#################### #sentinel. conf #############
Port 26379
Dir "/tmp"
Sentinel Monitor Test1 10.150.21.65 6379 1
Sentinel Config-epoch test1 2
Sentinel Leader-epoch test1 2
Sentinel Known-slave test1 10.150.21.69 6379
Sentinel Current-epoch 2
#################### #sentinel. conf #############
6. Launch Sentinel Server
Redis-server sentinel.conf--sentinel &
7. Sentinel Common Commands
Querying the Master State
Redis-cli-h 10.150.21.66-p 26379 Info Sentinel
To get to the primary IP address
Redis-cli-h 127.0.0.7-p 26379 Info sentinel| Awk-f ', '/status/{print $} ' | Awk-f ' = ' {print $} '
Querying the slave status
Redis-cli-h 127.0.0.1-p 26379 Sentinel Slaves Test1
You can also view real-time information
Watch Redis-cli-h 127.0.0.1-p 26379 Sentinel Slaves Test1
This article is from the "interested people, things become" blog, please be sure to keep this source http://wuxinglai.blog.51cto.com/9136815/1672036
Sentinel Redis Cluster configuration