skip to Main Content

How to use aerospike to generate a unique auto-incrementing ID,like redis

i want to use aerospike to generate a unique auto-incrementing ID,like redis 。I don’t know how I can do it,Has anyone tried this?
For example: If I am saving some Person data in DB, Do I need to create a uid for the Person or it is auto generated by the database

2

Answers


  1. Aerospike doesn’t support auto-incrementing ID due to its distributed nature.

    Check out the following threads that describes it with more details.
    Alternative suggestion might be to use a generated unique id as a primary key:

    1. https://discuss.aerospike.com/t/auto-generate-an-id-for-a-particular-data-in-aerospike/5168
    2. How to auto generate an Aerospike primary key?
    Login or Signup to reply.
  2. Check out using ULIDs perhaps, these can be generated client side and there are libraries for many programming languages.

    Quoting from their spec:

    • 128-bit compatibility with UUID
    • 1.21e+24 unique ULIDs per millisecond
    • Lexicographically sortable!
    • Canonically encoded as a 26 character string, as opposed to the 36 character UUID
    • Uses Crockford’s base32 for better efficiency and readability (5 bits per character)
    • Case insensitive
    • No special characters (URL safe)
    • Monotonic sort order (correctly detects and handles the same millisecond)

    We use these for client side ID generation in the Redis OM libraries.

    https://github.com/ulid/spec

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search