Redis master-slave replication occurs architecture down how to do? And sentinel function

If the primary situation downtime from replication architecture, the situation needs points:

1. From Redis down

  It is relatively simple, Redis from the library restart automatically added to the master-slave architecture, automatically synchronizing data;

  Problem is that if from the library during the off, little change in the main library, and then start from the library, main library will still do all of the data RDB operation it? Or incremental update? (From the library had done under the premise of persistence)

    No, because after Redis2.8 version of wine to achieve the main achieve incremental replication recovery from the case after disconnection.

2. Main Redis down

  Relatively complex, it requires the following two steps to complete

    Step 1: from the database to perform SLAVE ON ONE command, disconnect the master-slave relationship and enhance the main library to continue to serve .

    Step two: the main library restarts, do SLAVEOF command, set it to other libraries from the library, which is able to update the data back.

 

Seen from the main Redis down recovery more difficult and error-prone, there is no better solution? Of course there is, Redis Sentinel ( Sentinel ) function

 

Sentinel (Sentinel)

What is Sentinel

As the name suggests, is the role of sentinel on the operation of a system to monitor Redis, he is an independent process. He has two functions:

1. Monitoring the main library and the library is run from a normal

2. The main library after the failure of the automatic conversion of the main library from library

 

principle:

A single sentry architecture:

 

 Multiple Sentinel architecture

 

 More sentinel, while monitoring not only from the master database, and mutual surveillance among sentinel.

 

From the environment in a multiple master environment

 

 Configuring Sentinel

Start Sentinel Sentinel process of choice need to create the configuration file; 

there sentinel.conf

Start Sentinel:

sentinel monitor  RedisMaster 127.0.0.1 6379 1

Description:

MyMonitorMaster:监控主数据库的名称 ,自定义即可,可以使用大小姐字母和“.-_”符号
127.0.0.1:监控的主数据库的IP
6379:监控主数据库的端口
1:最低通过票数


Guess you like

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