Redis is a popular open-source in-memory database that supports multiple data structures like strings, hashes, lists, and sets. But similar to other tools, we can scale standalone Redis to a particular extent, but not beyond that. That’s why we have a cluster mode setup in which we can scale Redis nodes horizontally and then distribute data among those nodes.
Generally, we categorize the Redis setup into three different types:
- Leader-Follower (Replication)
In a Standalone setup, the complexity is minimal, but we cannot scale the solution if the data increases. Also, the fail-over and high availability will not be supported inside it.
In the Leader-Follower setup, Redis can replicate data to any number of nodes. i.e. it lets the follower have the exact copy of their leader. This helps in performance optimizations. Also, it introduces the concept of high availability.
But it doesn’t support the failover automatically. For that, we need to set up an additional component in the cluster called Sentinel.
A Redis cluster is simply a data-sharding strategy. It automatically partitions data across multiple Redis nodes. It is an advanced feature of Redis which achieves distributed storage and prevents a single point of failure.
Challenges with Redis setup
Although Redis has made a lot of things easy in modern application architecture, setting the correct scale of Redis or Redis cluster is still a challenge for many organizations. Some of the significant challenges are:
- Scaling Redis replicated and sharded cluster on-fly
- Rebalancing and re-sharding of Redis cluster
- Monitoring of important metrics
- Scaling and integration of Sentinel
Redis OSM Role
At our organization, we are a firm believer in contributing to open-source. We create different automation to create ideal solutions. Once we feel that the solution is mature enough to help other people, we open-source it. Similarly, we worked with an organization with a massive requirement for Redis. They managed all three different Redis setups for different use-case, but they needed to create a one-stop automation to handle all these requirements.
Since we already have the OSM ansible role available for redis, we decided to enhance it to support all these use cases.
OSM Redis Setup is a bundle of roles, playbooks, and inventories to set up different modes of redis like- standalone, sharded cluster, and replicated cluster, along with sentinel to handle fail-over. This ansible automation doesn’t restrict to setting up any environment once; it can also be used for change management, upgrading, and scaling the environment.
Supported features of OSM Redis Setup:
- Standalone Redis setup
- Redis replication-based cluster support
- Redis sharding-based cluster support
- Sentinel Integration with replication cluster
- Monitoring support with redis exporter
- Adding and removing the node from the cluster with sharding and rebalancing
In the next blog series, we will show all these redis setups and tuning using the Redis setup ansible role.
For further information on OSM setup and use cases, you can refer to the documentation page of it.
If you face any issues or want to ask any questions, please feel free to use the comment section of this blog. Also, if you have problems or feature requests regarding the Redis Setup role, you can raise the issue in GitHub.
Thanks for reading. I’d appreciate your feedback. Please leave your comment below if you guys have any suggestions or questions.
Cheers till next time!!
Blog Pundits: Sandeep Rawat
Opstree is an End to End DevOps solution provider.
Connect with Us