Redis Cloud quick start
If you’re new to Redis Enterprise Cloud, this quick start helps you get up and running.
You’ll learn how to:
-
Create a free subscription
-
Create a database
-
Connect to your database
If you already have a subscription, see Manage subscriptions and Manage databases.
Create a subscription
To create a new free subscription:
-
Sign in to the Redis Cloud admin portal. (Create an account if you don’t already have one.)
-
If this is the first time you’ve signed in, you have no active subscriptions and can select the Add subscription button.
If you already have a subscription, select the New subscription button in the admin menu.
(You can only have one free subscription.)
-
When the New subscription page appears, select Fixed plans and then scroll to the cloud vendor options.
-
Choose a Cloud Provider and a Region.
(You can ignore the High-Availability options for now; these are available in paid tiers only.)
-
In the Fixed Size panel, locate the Dataset Size list and then choose 30MB.
Free plans are a tier of Fixed plans; this provides an easy upgrade path when you need it.
-
Enter a descriptive Subscription Name and then select the Create subscription.
Create a database
Now that you have a subscription, you need to create a database.
-
If you aren’t already at the Subscription details screen, sign into the Redis Cloud admin console and select your subscription from the subscription list.
-
Select the New Database button.
-
In the General section, enter a descriptive Database Name.
- You have 40 characters
- You can use letters, numbers, or a hyphen
- The name must start with a letter and end with either a letter or a number
- Spaces are not allowed
-
For this exercise, leave the remaining options at their default values. (To learn about them, see Create a fixed subscription.)
-
Select the Activate database button near the upper, right corner of the page.
-
You’re taken to the Configuration tab for your new database.
In the upper corner, an icon shows the current status of the database. If the icon shows an orange clock, this means your database is still being created and its status is pending.
Once the database has been created, it becomes active and the status indicator switches to a teal circle containing a checkmark.
Admin console operations are asynchronous; they operate in the background. You can continue to use the admin console for other tasks, but pending resources aren’t available until they’re active.
When your new database becomes active, you’re ready to connect to it.
Connect to a database
At this point, you’re viewing the Configuration details for your new database.
To connect to your database, you need the following info:
- The hostname for your database
- The port number
- The database password
These are displayed in the Configuration tab.
-
In the General section, the Public endpoint setting shows the hostname for your database and the port number.
-
The Security section contains your Default user password. By default, this is masked. Select the eye icon to show or hide the password.
Once you have the connection details, you can connect in a variety of ways, including:
-
Using the
redis-cli
utility -
Using a connection client for your preferred programming language
Here’s an example of each.
Use redis-cli (via Docker)
The redis-cli
utility is installed when you install Redis. It provides a command-line interface that lets you work with your database using core Redis commands.
Docker provides a convenient way to run redis-cli
without the full installation experience.
Run the following commands to create a redis
Docker container and connect to your database with redis-cli
:
-
Download the
redis
Docker image:$ docker pull redis
-
Start a container created from the image:
$ docker run -d --name redis1 redis
-
Connect to a bash prompt running in the container:
$ docker exec -it redis1 bash
-
Connect to your database with
redis-cli
:# redis-cli -h <host> -p <port> -a <password>
Replace
<host>
,<port>
, and<password>
with the details copied earlier from the View Database screen. -
After you connect to your database, try these basic Redis commands:
xxx:yyy> ping PONG xxx:yyy> set hello world OK xxx:yyy> get hello "world"
Use code (Python)
Different programming languages use different clients to interact with Redis databases.
Here’s how to connect to your database using the redis-py
library for Python.
-
If you don’t already have the client installed:
sudo pip install redis
-
The specific syntax varies according to the client:
import redis r = redis.Redis(host='<endpoint>', port='<port>', password='<password>') r.set('hello', 'world') print(r.get('hello'))
-
Now, run the code:
$ python example_redis.py world