Redis architecture contains two main processes: Redis client and Redis Server. Redis client and server can be in the same computer or in two different computers.
Figure 1 : Architecture of Redis
Redis server is responsible for storing data in memory. It handles all kinds of management and forms the major part of architecture. Redis client can be Redis console client or any other programming language’s Redis API.
Redis stores everything in primary memory. Primary memory is volatile and therefore we will loose all stored data once we restart our Redis server or computer. Therefore, for data persistence, Redis supports the following mechanisms:
RDB: At specified intervals, RDB makes a copy of all the data in memory and stores them in permanent storage.
AOF: AOF logs all write operations received by the server, thereby making all data persistent.
SAVE command: Redis server can be forced to create a RDB snapshot any time using the SAVE command.
Redis also supports replication for fault-tolerance and data accessiblility. To enhance storage capacity, you can also group two/more Redis servers to form a cluster.