Redis Replication Question
I am planning to use Redis in my application for storage & caching. I read most of the documentation online, but still have a question regarding replication.
My usecase:
Dashboard app: that writes and reads from redis ( Master redis instance )
Couple of instances of another app that run redis clients and only do reads.
Clients replicate from master after every X minutes.
Question: - I understand that when clients are doing replication开发者_JS百科, they are blocked for operations. But, is read operation also blocked ?
- If read is also blocked, what would be a good approach to overcome it, since I want to be able to do reads without any blocks.
Appreciate your help in advance!
That's not EXACTLY what it says in the docs, it actually says:
replication is blocking on the slave side: while the slave is performing the first synchronization it can't reply to queries.
and
If you set up a slave, upon connection it sends a SYNC command. And it doesn't matter if it's the first time it has connected or if it's a reconnection.
So, during normal operation it should not block on the slaves at all. BUT reads are blocked during initial sync.
You can see if it is currently synchronising with the info command; master_sync_in_progress:0
The replication works by first sending everything (blocks) Then it sends incremental updates (non-blocking, as it is "just" the executed commands modifying the dataset, in correct order)
You can only overcome it by connecting to a different redis instance, maybe the master as fallback ?
精彩评论