'Redis sequential unique id generation for distributed clients

I need to generate sequential unique IDs for distributed clients.

  1. I considered Redis in standalone mode, Jedis client, INCR command to increment a counter value against a key shared by all the clients. AOF always option enabled. This option is not good because of the standalone Redis server being SPOF and hence downtime for the clients.
  2. The master and replicas with Sentinels setup is also not foolproof because there will always be a replication lag. It is not guaranteed that in case of master failure, there would be no data lag. I don't want to use the WAIT command to block in unbounded fashion. Consequently, the replicas would be slightly lagged and hence possible duplicate values might be visible to the clients.

Considering that, is Redis reliable for generating unique id sequence for concurrent clients?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source