Getting started with Databases for Redis
This tutorial guides you through the steps to quickly start using IBM Cloud® Databases for Redis deployment.
Follow these steps to complete the tutorial:
- Before you begin
- Step 1: Provision through the console
- Step 2: Set your Admin password
- Step 3: Connect to your instance
- Step 4: Use Redis
- Next steps
- Things to remember
Follow these steps to complete the tutorial:
- Before you begin
- Step 1: Provision through the CLI
- Step 2: Set your Admin password
- Step 3: Connect to your instance
- Step 4: Use Redis
- Next steps
- Things to remember
Before you begin
-
You need an IBM Cloud account.
-
Download and install the IBM Cloud CLI and the Cloud Databases CLI plugin. Use the IBM Cloud CLI tool to communicate with IBM Cloud from your terminal or command line, and the plugin contains communication commands for your database deployments.
-
Download and install Redli.
Before you begin
- You need an IBM Cloud account.
- Download and install the IBM Cloud CLI and the Cloud Databases CLI plugin. Use the IBM Cloud CLI tool to communicate with IBM Cloud from your terminal or command line, and the plugin contains communication commands for your database deployments.
- Download and install Redli.
Download and install Redli
Redli is a Go-based alternative to the official Redis-cli application.
Connect, Send and Receive data with Redis, by connecting with a CLI client. All IBM Cloud Databases use TLS/SSL secured connections, so use a Redis CLI client that supports TLS/SSL, like Redli.
To install Redli, download and install the package for your system. Uncompress the files, give the binary executable permissions, and move it to your path. For example,
to install it on a Mac, download the redli....darwin_amd64.tar.gz
file and run a command like this one:
tar zxvf <redli_version>.tar
example: tar zxvf redli_0.13.0_darwin_amd64.tar
chmod +x <extracted redli filename>
sudo cp <extracted redli filename> /usr/local/bin
Step 1: Provision through the console
- Log in to the IBM Cloud console.
- Click the IBM Cloud® Databases for Redis service in the Catalog.
- Follow these steps to provision a IBM Cloud® Databases for Redis instance.
- When your instance is provisioned, click on the instance name to view more information.
Step 1: Provision through the CLI
- You can provision a IBM Cloud® Databases for Redis instance by using the CLI. If you don't already have it, you need to install the IBM Cloud CLI.
- Follow these steps to provision a IBM Cloud® Databases for Redis instance.
Step 2: Set your Admin password
The admin user
When you provision a IBM Cloud® Databases for Redis deployment, an admin
user is automatically created.
Set the admin
password before using it to connect to IBM Cloud® Databases for Redis.
Set the admin password through the UI
Set your admin
password through the UI by selecting your instance from the IBM Cloud Resource list. Then, select Settings. Next, select
Change Database Admin Password.
Refer Managing Users and Roles to know more.
Set the admin password through the CLI
Use the cdb user-password
command from the IBM Cloud CLI Cloud Databases plug-in to set the admin
password. For example, use the following command:
ibmcloud cdb user-password <INSTANCE_NAME_OR_CRN> admin <NEWPASSWORD>
Refer Managing users and roles to know more.
Step 3: Connect to your instance
You can easily connect to Redis through the IBM Cloud CLI using Redli to store and retrieve data with your IBM Cloud® Databases for Redis deployment.
Connect through the IBM Cloud CLI
Now that you've installed and set up Redli, the IBM Cloud CLI tool, and the IBM Cloud Databases plugin, connect to your deployment. Log in with ibmcloud login
, and connect with ibmcloud cdb cxn -s
, for example:
ibmcloud cdb cxn -s <deployment-name>
Provide admin
password when prompted and it uses REDLI to connect.
You can explore other options to connect to IBM Cloud® Databases for Redis using Connecting through the command-line interface (CLI).
Step 4: Use Redis
Your connection is now open, which looks like:
>
You can start storing and retrieving data.
> set foo bar
OK
> get foo
"bar"
>
Next steps
-
If you are using Redis for the first time, read the official Redis documentation, an introduction to Redis data types and abstractions, and a Command reference to learn about Redis.
-
Implement IBM Cloud® Databases for Redis best practices, read Best practices for Redis on the IBM Cloud.
-
To use IBM Cloud® Databases for Redis with your applications, see Connecting an external application and Connecting an IBM Cloud application.
-
To ensure the stability of your applications and your database, see High-availability and Performance.
-
For more information on migrating your existing data to Databases for Redis, see A how-to for migrating Redis to IBM Cloud Databases for Redis.
Things to remember
-
IBM Cloud® Databases for Redis deployments are set by default as persistence, however, you can change it as Cache.
-
Integrate IBM Cloud® Databases for Redis with IBM Cloud® Monitoring and IBM® Cloud Logs services to observe trends in your usage and right size your instance.