Redis 101 : A basic introduction to Redis - Remote Dictionary In memory Server -



The redis database:


Redis - remote dictionary in memory server - is a database that lives in memory.

Because the data is stored in memory, it makes access to it faster than the traditional databases

When having different databases with different data structures and management, using separate database software to deal with the different databases could be very complex.

A better solution could be to use a multi-model database like redis that makes it possible for us to handle different types of data structures using only one database software

Redis uses a "key-value" model to store its data.

This model could be extended using modules that could handles the data type the we are dealing with.

For example, RedisGraph is used for storing graphs and RedisJSON is used for handling JSON values from redis database.

Since the data in redis lives in the memory, It uses snapshots to be able to restore data in case the redis database and it replicas go down.

Snapshots happen at regular fixed interval, but there is an issue, the latest data - that is not in the latest snapshot - would be lost. 
To remedy that , we use the AOF log files.

Redis uses also AOF files or log files - they are "append" only file -. 
All the changes are saved in these files and if the system goes down for a wile, it could rebuild its state from the AOF files, which are stored on the disk. 

AOF file are a safer and they could be a slower alternative to snapshots.

To save costs, Redis using tiering when it comes to data storage.
Hot data or "heavily-accessed" data is stored on the RAM and cold data - data that is not accessed frequently - is stored on SSD drives.

Redis could work in a cluster where a primary node handles the -"read/write" actions and the replicas that handle the "read" actions.

Comments

Leave as a comment:

Archive