The latest Redis database major version has been just released on the platform. Redis 5.0 is also the new default version when you provision a database. As usual, upgrading is an easy one-click process.
What is new in Redis 5.0
Redis 5.0 has been released with a few changes, and one major change that is worth the discovery: streams. Stream is the first new data structure in Redis since April 2014! For a comprehensive view on the novelty of this release, you can refer to the official release note.
The stream data structure can be seen as a log-like data structure. A log file
is opened in append only mode with a notion of timestamp included with each item
added. In the case of the streams data structure, data appended are key-value.
The analogy with log files does not stop here. When using Redis streams, you
have one entity producing line of logs and possibly multiple entities reading
the logs, just like you would do with a
In terms of Redis commands, this new release introduced 13 commands related to
streams. Here is a comprehensive list of
them. They all start with the
The most important one being
XADD which lets
you append one or multiple key-value to the stream. It’s format is:
XADD key ID field string [field string ...]
After adding some data in your Redis stream, you can chose among different ways to query this data structure:
- The first query possibility is really like a
tail -fin the Linux world (using
- But Redis streams also allows you to use Redis as a time series data store and
query data by time range (using
- Last but not least, a stream of messages can be partitioned among different
group of consumers. It helps you scale the consumption of messages with
multiple consumers. This use case is more complex and use a mix of
More information about streams on this great introduction in the official documentation.
As usual, the upgrading process on Scalingo is as simple as clicking a button on the database dashboard. The following picture shows the message you will see on your database dashboard if you are running the latest 4.0 version (i.e. Redis 4.0.14 at the time of writing):
This upgrade can take some time for the largest databases. Unless your database uses a Business plan, the upgrade process will induce a short downtime. Indeed, all Redis databases using a Business plan include a high availability setup and you will be able to upgrade your database without downtime. Our scheduler is able to achieve this zero-downtime upgrade by following the recommended step from Redis: upgrade all the sentinels and upgrade the follower, then manually failover for the upgraded follower to take the leadership. Eventually upgrade the previous master. Here you are, all the nodes are upgraded and the database suffered no downtime!
Version 5.0.4 has been released. You can find the corresponding Docker images on our Docker Hub repository.
Redis 5.0 does not have known incompatibility with the previous 4.0 version. Hence upgrading to this new version should not impact your code. However, you are strongly advised to test that your code still works with the new database version. To ease this task, you can pull the Redis version you need from our public Docker Hub repository and test it locally, with your code, on your workstation before updating.