Distributed locks with Redis – Redis https://redis.io/topics/distlock
There is an obvious race condition with this model:
- Client A acquires the lock in the master.
- The master crashes before the write to the key is transmitted to the slave.
- The slave gets promoted to master.
- Client B acquires the lock to the same resource A already holds a lock for. SAFETY VIOLATION!
Why failover-based implementations are not enough
原文:https://www.cnblogs.com/yuanjiangw/p/12987229.html