Quick Setup of Redis Cloud Essentials
To quickly setup Redis Cloud Essentials:
- Sign up for a Redis Cloud Essentials account.
- Create a new subscription.
- Setup a database.
- Connect to your Database.
Step 1: Sign up for Redis Cloud Essentials account
If you do not already have one, sign up for a Redis Enterprise Cloud account.
If you already have an account, sign in to Redis Cloud Essentials.
Step 2: Create a new subscription
Add a new subscription to your account, if you do not already have one. If you have an existing subscription, then go to Step 3.
To create a new Redis Cloud Essentials subscription do the following:
- Select 'Redis Enterprise Cloud' from the dropdown on the top of the page.
- Select 'Subscriptions' from the sidebar.
- If you have existing subscriptions- click on the '+' icon. If you don't have existing subsctiptions, proceed to the next step.
- Click on the 'Select' button inside the 'Essentials' box.
New subscription details page will be opened. You will need to select the following:
- The cloud and region you desire your database(s) to be created in
- A subscription name
- One of three subscription plans:
- Cache plans provide highly available, low-latency caching for applications when the authoritative version of the data is stored in another database. Cache plans do not include replication or data persistence so failures may result in an empty cache.
- Standard plans can have a diverse set of features including in-memory replication, auto-failover, data persistence, and backups. Selecting this option will double the memory size of your dataset.
- Multi-AZ (Availability Zone) plans offer all the benefits of Standard plans, as well as auto-failover and in-memory replication to another availability zone.
- Memory size - select from 30MB (free) to 5GB ($33/mo), or a flexible pay-as-you-go model.
You can consider a quick overview of each tier's features upon selection. For more specific information, see Creating a Subscription.
After you select the options that you want, click Continue to review pricing, set payment method and finalize your subscription.
Step 3: Set up a database
After the subscription has been created, you can set up a database under the subscription. To set up a new database:
- Open the sidebar and click on 'Databases'.
- Select your subscription and expand it.
- Click on the '+' icon under the subscription to create a new database. 'Create Database' page will open.
- Give your database a name.
- Fill-in the database settings. For more information please see Creating Databases on Redis Cloud Essentials.
- Click the Activate button to create your database.
Note: the Endpoint displayed on this page is very important because it is your entry point to this database.
Step 4: Reading and Writing Data
As a quick smoke test, telnet to your assigned endpoint and port. Then enter the Redis PING command. You should see something like this:
# telnet redis-19836.c9.us-east-1-2.ec2.cloud.redislabs.com 19836 Trying 188.8.131.52... Connected to redis-19836.c9.us-east-1-2.ec2.cloud.redislabs.com. Escape character is '^]'. AUTH my_redis_password PING +PONG
Note: We recommend loading the redis-cli command-line utility for future use as you will use it for other things.
$ redis-cli -h redis-19836.c9.us-east-1-2.ec2.cloud.redislabs.com -p 19836 -a astrongpassword redis-19836.c9.us-east-1-2.ec2.cloud.redislabs.com:19836> PING PONG
You can get redis-cli and other command-line Redis tools through your favorite package manager or by installing Redis locally.
Once you have tested the connection to your Redis database, you can start reading and writing data. The following code snippet writes the value bar to the Redis key "foo", reads it back, and then prints it. This snippet is written in Python, but you can use your favorite language (for examples in other languages, go here).
You first need to install the Redis client library for Python if you do not have it already.
$ sudo pip install redis
Next copy and paste this into a file named "example_redis.py":
# import the library import redis # Create connection object r = redis.Redis( host='pub-redis-10382.us-west-2-1.1.ec2.redislabs.com', port=10382, password='astrongpassword') # Set a value for the foo object r.set('foo', 'bar') # retrieve and print the value for the foo object print(r.get('foo'))
Now run the code:
$ python example_redis.py bar
With that simple test complete, if you have existing code or an app that uses Redis, just change the host, port, password and SSL certificates and you are done.