Chapter 8. Redis
Redis is an open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, and sorted sets.
Redis has a very novel approach to being a datastore. Actually, its own data structure server is a very apt description: it is a server.
As with all our infrastructure components, we aim for resilience (does not break easily) and reliability (does what you expect it to do). For Redis, we have to figure out how to do the following:
- Scaling (up and down)
This project is available on github at ReDiS.
Redis as a data structure server finds its limits in the server. The core idea is that it exposes the memory on an instance as a variety of structured data through an API. This is fast but very fragile. Memory is not persisted.
This feature has two consequences we have to deal with:
- Persistence (how to make backups)
Both these problems would go away if Redis were available in a distributed manner. In the next chapter, we’ll see how elasticsearch elegantly solves this shortcoming. But the distributed Redis is a work in progress and we don’t know when it will be available. In the meantime, we have our own workaround.
Redis has the notion of master-slave replication. In Redis anything can be a master, and masters are almost completely unaware of existing slaves. A slave has only one master, which is
This simple approach to replication ...