Avoid gaps when using replication - Redis

We have 1 master with Radish. And 2 slaves of this master. Slaves are also used as WebServer. We use Redis for PHP sessions. We load balance using Round Robin DNS. Thus, this means that requests are sent to a "random" server.

How do I configure a thing like a PHP session so as not to disrupt the user interface. For example, I have a replication period for redis every 10 seconds. User logins and session created. After a few seconds, the user requests a new page and gets to another server. But on this server, Redis is not yet replicated.

What to do in this case, when the data is important in this matter? We also have non-critical data in redis, so we don’t want to set the replication period to a very small period and put a strain on master.

In fact, this does not apply only to Redis. I don’t know yet, maybe we will have the same problem with MySQL.

+3
source share
1 answer

For example, I have a replication period for redis every 10 seconds

I assume that you are referring to a setting repl-ping-slave-period- that is, the time interval for ping from master to slave to confirm the link up.

Redis . . , 10 , .

. telnet, localhost 6379 ( , ). sync. , . 10 .

​​, PHP, ?

Redis slave. Redis -.

3 - Redis. - , - .

? . Redis-Sentinel, , .

, , .

+4

All Articles