Redis Sentinel mode (the Sentinel) configuration

Redis Sentinel Mode Configuration Tutorial

What is the mode Redis Sentinel

To become masters of the automatic version, can Redis cluster, background monitoring whether the host fault, if fault according to the number of votes from the library automatically converts the main library

New Sentinel Profiles

New sentinel.conf file name must not be wrong

touch sentinel.conf

Add Content

Configuration requires monitoring of the file you just created a good sentinel.conf host, and become masters of mode.

Use vim editing commands or open files directly can

sentinel monitor 被监控数据库名字(自己起名字) 127.0.0.1 6379 1

The last number above 1 indicates the host let hang salve vote to see who takes over as host, after the number of votes becomes the master

If you want a simple configuration, you can use the code below:

sentinel monitor 127.0.0.1 6379 1

Start Sentinel mode

Sentinel mode startup, you need to specify it loads the configuration file

/usr/local/bin/redis-sentinel /root/java/redis/employ/sentinel.conf

 After starting

Incidentally, a group capable of monitoring several Master sentinel

test

When we close monitoring of Redis service, the sentinel will select a new host Redis

Redis from all current machines are connected to 127.0.0.1 6379, the main the following diagram:

When our Redis 6379 port switch off process will choose a host in 6380,6381,6382,6383

After the above can be seen 6379shutdown, select the host for the service 6382Redis 

Shortcoming

Since all write operations are the first to operate on the Master, and then synchronize updates to the Slave, so there is a delay from Master to Slave synchronous machine, when the system is busy, delay problem will become more severe, increasing the number of Slave machine also make this problem worse.

Published 36 original articles · won praise 3 · Views 5656

Guess you like

Origin blog.csdn.net/TanGuozheng_Java/article/details/104085495