Quick Setup of Redis Cloud Pro
The steps for creating a simple Redis Cloud Pro deployment are:
- Sign up for a Redis Cloud Pro account.
- Create a new Redis Cloud Pro subscription.
- Create a new database definition.
- Connect to your database.
Step 1: Sign up for Redis Cloud Pro account
If you do not already have one, sign up for a Redis Cloud Pro Account.
If you already have an account, sign in to Redis Cloud Pro.
Step 2: Create a new Redis Cloud Pro subscription
Add a new subscription to your account, if you do not already have one.
For a new subscription:
- Enter a subscription name.
- Select if you want to use Redis on Flash or pure RAM Redis database.
- Select the cloud region in which you want your databases to be created.
- Select whether you want to use Multi-AZ for in-memory replication to another availability zone in the same region.
- Enter the required Deployment CIDR. The CIDR an IPv4 subnet that you want Redis Cloud Pro to use for this subscription. For a standard deployment, you can specify 10.0.1.0/24. Make sure that the CIDR you provide does not conflict with your application VPC CIDR to avoid problems when you peer the VPC to your.
- Select whether you want Persistent Storage Encription.
- Click Next to finalize your subscription.
Step 3: Create the database definition
Next, define the databases to provision. Each row in the table represents a group of databases that share the same specification.
To start with a single database:
- Enter the database name.
- Select the protocol (Redis or Memcached).
- Enter the dataset size - The estimated size of your data. You can specify 1GB for a small database.
- Define if you want to have database replication (note that when enabling the database will consume twice the amount of memory).
- Select data persistence policy.
- Define if the database will support OSS Cluster API.
- Throughput - You can define your estimated total throughput you expect from your database by either specifying the required ops/sec or number of shards needed.
- Modules - You can select which Redis Module you want to load to your database. In case you select 'RediSearch' please provide the estimated number of documents you are going to index.
- Click Save and enter the number of databases with these settings that you would like to provision. To add more rows, click the plus.
When you finish with all databases, click Next.
Behind the scenes, Redis Cloud Pro is performing a few operations based on your inputs:
- Calculating the necessary resources
- Crafting a plan for an optimized cloud infrastructure based on those calculations
After planning is complete, review the presented subscription and database information. This includes the expected infrastructure and shard prices. Provide a payment method by selecting an existing one or click + to add a new one. A $100 credit will be assigned to the new subscription for a free trial.
Click Continue to create the subscription and deploy the databases. The subscription shows a "Pending" status and may take 10-15 minutes to build the infrastructure with the generated optimization plan. You will receive an email when your databases are ready to use.
Step 4: Connect to your database
In the menu, go to the Databases page. Select one of the databases, select the Configuration tab, and look for the database endpoint.
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 18.104.22.168... Connected to redis-19836.c9.us-east-1-2.ec2.cloud.redislabs.com. Escape character is '^]'. AUTH my_redis_password PING +PONG
$ 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.
After you test 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.garantiadata.com', port=10382) # 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, you change the host, port, password and SSL certificates in any existing code or apps that use Redis and you are done.