Redis on Compose
Redis is an open-source, in-memory data structure store with on-disk persistence. Focusing on data sets the size of the memory you give them, Redis is a high-performance way to store and operate on key-value structures of complex data types, such as strings, hashes, lists, sets, and others. Compose Redis deployments are also highly-available replica sets that will auto-scale as your data grows.
Redis for All is a general introduction to Redis on Compose.
Are you wondering what you'll get, or can get, with a Compose Redis deployment? Want to know what you'll need to do to manage it? Check out some of the implementation features and details down in Redis for Ops and Admins.
Just deployed Redis and want to get coding with it? Developing an application or want to try a new stack? Then see the
Redis for Developers section for resources on how to connect from different languages, command line tools and more information to get you started.
Redis for All
When deployed on Compose, Redis comes with these standard Compose features.
- Automatically scaling server stack that scales RAM, CPU, and I/O as your Redis data grows.
- Daily, weekly, monthly, and on-demand backups.
- Metrics displayed in the Compose UI.
- Deploy, manage, backup, and otherwise automate database tasks through The Compose API.
- Guaranteed resources per deployment.
- Daily logs available for download.
Compose deployments of Redis also come with a number of Redis specific features:
- Data Browser For Redis.
- Configuration tuning so Redis behaves as you want it to.
- View Redis Slow Logs from the Compose UI.
- An optional add-on for real-time log access.
- The ability to forward rich metrics to services with an optional add-on.
- Use Redis as a 'cache' or use the traditional auto-scaling 'storage' mode.
- The Redis Import Tool makes it easy to move data into your deployment from anywhere.
- Start with 256MB memory for $18.50 - as you grow each additional 256MB costs $13.
A Redis deployment starts with three nodes - two redis/sentinel nodes and one dedicated sentinel node. The redis/sentinel nodes each have 256MB memory and 256MB storage. The dedicated sentinel and the included haproxy portal to manage connections have 64MB memory each.
Redis deployments can be both vertically and horizontally scaled. The deployment is automatically vertically scaled as your data size increases (unless you have 'cache' mode enabled); adding both memory and storage to your data nodes. You can also manually scale your deployments to fit your anticipated data size in the Resources panel of the Compose UI. Portals (haproxy and SSH) may also be vertically scaled.
There are also options for horizontally scaling your Redis deployment by adding extra read-only slaves. The read-only nodes get the same memory resources as the other data nodes on your deployment. It is also possible to add additional haproxy portals for better fail-over handling.
See Compose Datacenter Availability for current location availability.
Billing and Costs
Compose deployments are billed based on disk usage and your Redis deployment usage is measured hourly. It is then grouped into a single monthly billing cycle. This means that any scaling or add-on usage will be charged from when the new resource was provisioned; not just for the month. You can see your deployment's usage in the Overview panel, under Current Usage.
Initial deployment set up is $18.50/month. Depending on which scaling and add-ons options you choose, the cost will increase. For example, if you wish to add extra storage and RAM, it is billed at an additional $13/month per unit of 256MB memory/256MB storage, so an additional 512MB memory/512MB storage will cost an additional $26.00/month.
For Ops and Admins
High-availability and Failover Details
Redis deployments use Redis Sentinel to provide high-availability and monitoring for your databases. Each deployments consists of three data nodes; all three run the sentinel process and two run the redis process. One of the nodes running the redis process is the master, and the other is a slave. The slave is an exact copy of the master, and the master pushes updates to the slave asynchronously. Should the master node fail, the sentinel process on the two nodes will fail-over and promote the other redis node to be the new master.
To provide fail-over for your connections, you may add additional haproxy portals to your deployment and configure your applications to fail-over should one portal not be able to connect.
Redis saves a binary snapshot of your data by default. The dump.rdb file can then be used as a backup for point-in-time recovery. To make the snapshot Redis forks, so that all of the work for the snapshot is done by the child process while the parent process continues handling your data as normal. The backup process doesn't affect your application or database. You are able to both download a copy of your backups, or restore them directly into a new deployment. More information on managing your backups, schedules, and retention can be found on the Backups page.
Restore to a Local Database
Since we make your Redis backups available for you to download, it is possible to get a copy of your data running locally. You will need to be able to spin up a local instance of Redis and a downloaded dump.rdb file.
- First, you will probably want to move your dump.rdb file into it's own directory, say 'db'.
- We will need a Redis configuration file to start up the Redis instance, so you will want to copy a redis.conf file from your install into your db directory with the dump.rdb file. For example, if you installed Redis on OSX with homebrew, the redis.conf file is in
/usr/local/etc, so from the db directory run,
cp /usr/local/etc/redis.conf .
- Edit the configuration file to point to our current directory when it starts. Open redis.conf with a text editor and change the line
dir .. Save the file and exit.
- Start the redis server in the db directory supplying the configuration file:
High Resolution Scaling
With Redis, the autoscaling system samples the resource consumption of deployments sixty times faster (once a minute) than standard Compose autoscaling.This makes it extra-responsive to the demands a memory-based database can place on resources.
redis-cli is the command-line interface to manually connect and communicate with your Redis deployment - it's the most direct way to remotely work with Redis on Compose. It comes as part of the Redis package, so you will need to have Redis installed locally to use it. On Mac OS X we recommend installing brew and then using
brew install redis to get up and running. On Linux, refer to your distributions package manager for the latest build or, if you are so inclined, download the source and build it yourself.
Connecting to Redis
The Overview panel of the Compose UI provides the basic information you need to get connected to your databases. In the section Connection info you will find Credentials ,the TCP Connection String for your application, and the TCP Command Line for
redis-cli. More information and examples in few different languages can be found on the Connecting to Redis page.
Additional Resources and Related Articles
The full list of documentation for Redis is in the sidebar, in addition to all things Compose.
For more than just help docs, check out Compose Articles and our curated collection of Redis-related topics for more how-to's and information on Redis on Compose.
Still Need Help?
If this article didn't solve things, summon a human and get some help!
Updated over 3 years ago