your "developer warning light" is spot on. we tried the zero-downtime
approach when we switched datacenters -- admittedly from the states
to europe, so the replication lag was particularly bad in that case.
anyway, we still do not fully understand what went wrong, but we have
broken / inconsistent data left over from this exercise.
in hindsight, we now wish we had scheduled a half-hour of planned
downtime instead, which would have saved us tons of trouble.
tim
> --
> You received this message because you are subscribed to the Google
> Groups "Redis DB" group.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to redis-db+u...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/redis-db?hl=en
> .
>
On 2011-02-27, at 04:56 , Jak Sprats wrote:
> On the Fusion-IO cards, that will be VERY interesting. The FusionIO
> cards use a Btree (on-card) to buffer writes (all SSDs have a RAM
> buffer for writes), what would be truly kick-ass is to be able to plug
> diskstore into that btree directly, it would be a native software/
> firmware solution on the best SSDs to date.
> On Feb 26, 7:29 pm, Jeremy Zawodny <Jer...@Zawodny.com> wrote:
>> Tangentially related, I'm planning to test diskstore on boxes with fusion-io
>> SSD cards at some point. I could be a great way to build *massive* redis
>> boxes that far exceed RAM but don't sacrifice as much performance as you
>> otherwise might.
Ok let's make your scenario more concrete:
master1 list => a b c
slave1 list => a b c
client 1: RPOP gainst master1, get element 'c'
master1 list => a b
slave1 list => a b c (operation yet not replicated)
client 2, with updated config: RPOP against slave1 list, get element 'c'
slave1 list => a b
previos RPOP gets replicated, slave 1 list => a
'c' was popped two times, while 'b' is lost.
So you are right, this can happen. The window of exposure is tiny if
the two Redis instances are "near" (low latency), but as there is more
latency the risk is increased (replication over internet for
instance).
However how to avoid this problem? The trivial fix is to stop the
application for a time that is at least equivalent to the replicaiton
latency, so one should stop the application, change configuration,
restart the app again.
The replication latency is usually sub millisecond, so well, just a
stop/start is enough.
If it's over internet, it's better to wait a few seconds before
restarting the app again.
An interesting alternative that can fix this problems is however to
support a command that is able to block all the new connections. so
for instance I can do:
1) Create a slave, and wait for the synchronization.
2) Issue the command BLOCKNC (block new clients) against the slave.
The replication will work as usually, but new connections will be just
accepted without being processed (we just unregister the listening
socket read handler).
3) Change the configuration of the clients to use the slave.
4) wait two seconds. The final replication data will go from master to
slave. Everything is now in sync.
5) Issue UNBLOCKNC against the slave.
Sounds good? Better ideas?
Thanks for your contribution Jak, that was very useful.
Cheers,
Salvatore
--
Salvatore 'antirez' Sanfilippo
open source developer - VMware
http://invece.org
"We are what we repeatedly do. Excellence, therefore, is not an act,
but a habit." -- Aristotele