A Quick Guide to IBM Cloud Databases for Redis

5 min read

Introducing Databases for Redis

As you may have seen, we’re launching a new range of databases called IBM Cloud Databases with Databases for PostgreSQL and Databases for Redis. If you are not yet familiar, then let’s introduce you to IBM Cloud Databases for Redis. To learn more about Databases for PostgreSQL, check out this post.

What is IBM Cloud Databases?

The experts on the IBM Compose team have been working to deliver databases on a next-generation platform. There were two design criteria. One was to build on a modern, open, cloud management platform—Kubernetes—rather than building one from scratch. The other criteria was that the new service had to integrate with IBM Cloud natively, as a provider and a consumer of services.

From those design criteria came the new architecture, with simpler access to the databases, cleaner high availability, and smoother backup orchestration. It’s all integrated with IBM Identity Access and Management (IAM) and provisioned as a native IBM Cloud service. Underneath that, a consistent system for managing stateful storage and backup storage does the heavy data lifting.

It is onto that solid platform that our developers are bringing battle-tested database configurations. And that’s IBM Cloud Databases.

What’s Redis?

Redis is an open source in-memory data structure store that is designed to be very fast and flexible. It allows developers to share and cache structures ranging from simple strings, lists, and sets to queryable sorted sets, bitmaps, hyperloglogs, and geospatial data, all referenced with user-defined keys. These keys can also be created with a time-to-live so that they can automatically expire. This simple, flexible architecture is combined with a guarantee of atomic operations that extends to Redis’s Lua scripting support. Redis can act as a session or state store for applications, be used to queue jobs between workers, or keep metric counters.

That last one is where hyperloglogs come in—they are a data structure which probabilistically counts the number of unique items presented to it without consuming large amounts of memory. That means you can count different IP addresses, hostnames, or hashes and only use a small (12KB) amount of memory.

Redis is the epitomy of NoSQL databases. It’s tuned for in-memory storage and fast connections with a custom explicit command set.

What’s in IBM Cloud Databases for Redis?

Databases for Redis gives two Redis instances—a master and a replica member—with Redis sentinels monitoring both. Accessing the database is managed through a single Kubernetes Nodeport, behind which one or more HAProxy instances handle all the traffic. It’s the HAProxy instances that manage to which we’ve added support for TLS/SSL encryption for incoming connections to the Redis server—something Redis doesn’t do out-of-the-box currently.

So how do I get a Redis deployment like this?

Go to the IBM Cloud Catalog, look for Databases for Redis, and create a deployment. By default, you’ll be getting Redis 4, with 1GB of RAM and 1GB of storage allocated to each of the two database members. Click Create, and off you go. When it’s all set up, you’ll be at the manage screen, where you can create credentials, set the admin password, and view the state of Redis.

I like the command line. What tools do you have?

IBM Cloud has an IBM Cloud CLI tool, and once installed, you can use it to provision and deprovision your databases. There’s also an IBM Cloud Databases plugin for the CLI just an ibmcloud plugin install cloud-databases command away. That then gives you commands to create users, set passwords, get connection strings, and much more.

Set the admin password with ibmcloud cdb user-password admin password. As the redis-cli doesn’t handle TLS connections, we created and open-sourced our own version— redli— which you can download and install.

From there, entering ibmcloud cdb cxn yourredisdatabasename -s is all you need to do to start an interactive session with the Redis database.

What if I want or need to use the official redis-cli?

Not a problem. Head to the Databases for Redis documentation where you’ll find a Connecting with redis-cli section. It shows you how to configure redis-cli with Stunnel, a TLS/SSL tunnelling application. You can use the same technique with any Redis application which doesn’t support TLS/SSL.

I like APIs. Where do I get started?

We have an API—the Cloud Databases API. This API gives you all the management features which are also exposed by the CLI. Provisioning and deprovisioning are managed, separately, by the IBM Cloud’s Resource Controller API. API Keys are provisioned through the IBM Cloud’s User API Keys.

How do I scale?

You can use the IBM Cloud Manage page. Go to the Settings view, and you can drag the sliders to as much memory and disk storage as you need. If you want precise control, the Cloud Databases CLI plugin or API are also able to set your scaling. Scaling happens with no disruptions or scheduled maintenance. We do recommend you scale Redis memory and disk in parallel.

Can I set up other users for Redis?

No. It’s a design feature of Redis that it has just one notional user with a single authentication password. On Databases for Redis, we call that user admin to fit in with the other databases. You can change that user’s password but you can’t create new users.

Do you support Redis modules?

Redis modules are a new feature in Redis 4.0 which allow developers to plug into the Redis database engine and add their own extensions. It’s pretty exciting stuff but because it’s quite hands-on (requiring compilation, file system access, and other things which don’t rest well on a cloud-hosted platform) we aren’t offering it with Databases for Redis.

Where do I find out more about Redis?

The place to start for all things Redis is the Redis.io website with its documentation collection.

Where do I find out more about Databases for Redis?

Head over to the Databases for Redis documentation, which covers all the Databases for Redis specifics.

Be the first to hear about news, product updates, and innovation from IBM Cloud