The Easiest Way to Set Up Redis in 2022
Rammina
Posted on May 15, 2022
Have you been struggling with setting up Redis?
Or are you looking for an easier way of getting it up and running?
Either way, you might want to check out this FREE simple Redis setup that will save you time!
If you don't know what Redis is and what it is used for, don't worry. Here is a brief outline that will help you understand it better.
Redis: Multipurpose In-memory Data Storage
Let's go over a quick overview of Redis before discussing the setup method.
In short, Redis is an open-source, in-memory data store, that can serve as a cache, database, and message broker. On top of that, it supports various data structures.
Image from Fireship.io
In the database world, Redis is considered revolutionary.
It is an impressive hybrid of in-memory, schema-less design (noSQL) with high-performance, versatile data structures and modules that can be tailored to your data needs. On top of storing data in-memory, Redis allows for high durability and availability through backups and replication.
Redis is one of the most adept, optimal, multi-purpose databases out there: It scales horizontally like a key-value data store, but it also provides various functionalities, despite its simplicity.
You would want to use Redis to implement a highly available, in-memory cache to:
- reduce data access latency
- improve throughput
- minimize the load on your SQL or NoSQL database and on your application itself
Alright, time to set up Redis!
Redis Cloud Setup
The easiest way of getting Redis up and running is by using Redis Enterprise Cloud.
This method reduces the likelihood of running into operating system-specific issues, such as the lack of Windows support for Redis. It also allows you to reach the cloud database endpoint anywhere, whether you are using other computers or VMs.
Short Outline of the Process
- Sign up for an account on Redislabs.
- Add a new subscription.
- Create a new database.
- Choose a protocol and modules.
- Retrieve database information.
1. Redislabs Account Registration
First, you need a Redislabs account to be able to set up a database.
Thankfully, their registration process is hassle-free, since you can just sign up with either your Google account or GitHub account! If you have neither of the two, you can fill in the registration form.
For this example, I'm using GitHub to register for a Redislabs account.
2. Add New Subscription
Before you can set up a database, you'll need to have a subscription plan. Click New subscription
.
Then, choose fixed plans.
Select the cloud vendor that you want to use. For this example, I'm using AWS.
You also need to choose which region you want the service to be located in, choose the closest one near where your application will be hosted.
For the FREE plan, you get 30MB of in-memory storage and no replication/high-availability.
Next, choose a subscription name that makes sense for your use case (e.g. your app's name). Then, click Create subscription
.
You should now have a subscription number (Subscription #1715073) and the option to create a new database.
3. Create New Database
Now, you can proceed to create a new database!
You can do this by clicking New database
on either the top-right of your screen or at the center.
Choose a database name that suits what you are doing with it (e.g. your app's name).
4. Choose Database Protocol and Modules
Select Redis
as your database protocol. As for the modules you'll be using, you can choose both RediSearch
and RedisJSON
. These two modules are usually enough for most projects.
Click Activate database
once you are done filling out the database creation form. After that, you just need to wait for Redislabs to finish setting up your database.
5. Retrieve Database Information
After the database is created, you're probably wondering how you're supposed to connect with the Redis data store.
You can look for the Public endpoint
information on your newly created database.
Take note of the Redis hostname and the port number.
For this example, I have the public endpoint of redis-19827.c83.us-east-1-2.ec2.cloud.redislabs.com:19827
. The hostname is redis-19827.c83.us-east-1-2.ec2.cloud.redislabs.com
and the port number is 19827
.
Note: You may also need a password to connect to your newly created Redis database.
- Scroll further down the database information page.
- Go to the
Security
section. - Retrieve your
Default user password
.
While you can use the default credentials to connect your Redis database, it is best to update it to a more secure one later on.
You can do it by clicking the Edit database
and changing the information that you'd like updated.
Congratulations! You should have a Redis Cloud database successfully set up now.
Frequently Asked Questions (FAQ)
Which programming languages can I use Redis with?
Redis supports most modern programming languages. These include (and are not limited to) Node.js, PHP, Java, Python, Ruby, C#, C++, and so on.
Check your language and framework's libraries or packages for utilizing Redis. For example, Node.js has the node-redis npm package for interacting with a Redis database.
Am I going to be charged for this Redis set up?
If you choose the free, fixed subscription plan, you will not be charged.
However, the free plan does come with its limitations such as 30MB storage, lack of replication, 30 maximum connections, and so on. Usually, this is enough for local development needs, so don't worry about it too much.
Can't you just install and run Redis on Docker? That would be faster than clicking through all the GUI on Redislabs.
This tutorial aims to provide the easiest way to set up Redis.
One issue with a Docker set up is that it requires someone to know (or learn) how to configure Docker images and containers. This intermediate step can be intimidating for beginners who are just starting out.
Resources/Recommended Reading:
A fun resource for learning Redis:
DISCLAIMER:
This is a Starter Guide meant for helping beginners easily set up Redis. This guide only expresses my thoughts and opinions (based on my limited knowledge) and is in no way a substitute for actual references.
If I ever make a mistake or if you disagree, I would appreciate corrections and discussions in the comments!
Other Media
Feel free to reach out to me in other media!
Posted on May 15, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.