viv1d
viv1d

Reputation: 349

Redis and Data Integrity

I have some questions for REDIS DB:

Ever Thanks for a possible feedback

best regards - SB -

Upvotes: 18

Views: 13867

Answers (2)

Vts
Vts

Reputation: 51

Redis Graph is the module you need to have better data integrity and relations

Upvotes: -1

Didier Spezia
Didier Spezia

Reputation: 73226

Redis is a key/value store on steroids, not a relational database.

How to ensure data integrity? Are there methods ensure the integrity?

Redis supports different persistence options from the "non safe but very efficient" up to the "safe but not very efficient". See more information at:

Redis also supports a master-slave replication mechanism to protect the data in case of complete node failure.

A single Redis instance always provides data consistency (in the sense of the CAP theorem, not in the sense of ACID).

Does Redis primary key? or alternatives

Redis is a key/value store. All items have a key. There is no concept of primary or secondary key.

Foreign key? Referential Integrity?

These are relational concepts. Redis is not a relational database. Foreign key means nothing (there is no table concept with Redis). Referential integrity is not maintained by Redis, and must be enforced by the client application.

How are the ACID properties to be implemented?

They are not supposed to be implemented since Redis is not a transactional database. There is no rollback mechanism with Redis. However, in term of ACID properties:

  • Atomicity and consistency can be guaranteed for a group of commands with a server-side Lua script
  • Isolation is always guaranteed at command level, and can also be guaranteed for a group of command using a MULTI/EXEC block or a Lua script
  • Durability can be guaranteed when AOF is activated (with systematic fsync)

Upvotes: 24

Related Questions