Redis is an open source in-memory database used by companies around the world—for everything from caching to queuing. Because of its speed and ease of use, Redis is a personal favorite solution of mine for dealing with large key-value datasets.
In the past, I've used Redis to speed up costly ranking queries that were ill-suited to a more traditional relational database. I also often use it to manage auto-expiring caches and FI/FO queue systems within many of the projects I find myself working on.
In this post, I demonstrate how to run Redis on Alibaba Cloud using the ApsaraDB service for high-performance database applications.
Alibaba Cloud Console
As a result of the popularity of Redis, it's no surprise that Alibaba Cloud has a great solution for spinning up affordable, highly available instances with minimal overhead and next to no effort. To get started with Redis on Alibaba Cloud, first head to the Alibaba Cloud console and click on the ApsaraDB for Redis button within Products & Services:
ApsaraDB for Redis Instance List
Next, we'll have to actually create a Redis instance to connect to. To do this, click on the Create Instance button within the ApsaraDB for Redis Instance List. It is important to note that, while the instance list is scoped to a specific region (Virginia, Silicon Valley, etc), you will have the opportunity to select a different region while creating a new instance.
ApsaraDB for Redis Configuration
That button will take us to the ApsaraDB order form, which will allow us to select the desired Redis configuration prior to deployment. ApsaraDB Redis configuration falls into four main sections: Basic Configuration, Network, Password, and Quantity.
The Basic Configuration section is where you select the type of Redis instance you would like to deploy, and the region and zone to deploy it in.
The Network section gives you the opportunity to define which network to run your instance on. At a high level, services running on the Classic Network are not isolated, which means that access can only be blocked by the security group or whitelist policy of the service. On the flip side, the VPC (Virtual Private Cloud) network allows you to build an isolated network environment by providing the ability to customize the route table, IP address range, and gateway within the VPC. Be aware that, while you can convert a classic network instance to a VPC instance, you cannot convert a VPC instance to a classic network instance.
Reset ApsaraDB for Redis Password
The Password section allows you to set the password of your Redis instance before, or after checkout. While I personally recommend setting the password before checkout, if you decide to set it later, you will have to click on the Modify Password button within the instance information panel, and then proceed to reset the password.
Like Basic Configuration, Quantity is a pretty self-explanatory section. If you need to spin up more than one distinct instance, you can purchase up to 10.
ApsaraDB for Redis Instance List
Once you've purchased your Redis instance, it's time to get connected to it. To do this, head back to the ApsaraDB for Redis Instance List and click on the region that you purchased your instance for. You should see a new instance under the region that you chose during checkout. Clicking on the name of the instance will take you to the Instance Information panel, which is where we can find information such as the connection address, port number, zone, and other configuration options.
ApsaraDB for Redis Instance Information
Before we can connect to our instance, however, we first need to set up our whitelist. ApsaraDB for Redis only allows connections from within the Alibaba Cloud intranet, which means that only Redis clients on ECS instances within the Alibaba Cloud network can connect to the service. Regardless, by default, connections to ApsaraDB for Redis are limited to localhost access only, so to open this up to our own applications, we need to whitelist some IP addresses. To do this, open the Whitelist Settings panel found near Instance Information, and add any IP addresses or IP ranges to the list.
ApsaraDB for Redis Whitelist Settings
After access is opened to the appropriate IP addresses, you can test the connection by logging into any ECS instance within the same network and connecting via the redis-cli command line tool:
Testing Redis Connection
While this is just a simple demonstration, it shows just how easy it is to get started with ApsaraDB for Redis in Alibaba Cloud. Because of the security policies that are used to protect your Redis instances from the outside world, hosting your entire application infrastructure on Alibaba Cloud will give you the advantage of ease-of-use, combined with advanced configuration ability.
Zachary Flower (@zachflower) is a Fixate IO Contributor and lead developer at Emerson Stone, a Boulder-based design and branding agency. He has an eye for simplicity and usability, and strives to build products with both the end user and business goals in mind. From building projects for the NSA to creating features for companies like Name.com and Buffer, Zach has always taken a strong stand against needlessly reinventing the wheel, often advocating for the use of well established third-party and open source services and solutions to improve the efficiency and reliability of a development project.
Alibaba Clouder - January 21, 2021
OpenAnolis - March 7, 2022
Alibaba Clouder - January 8, 2018
ApsaraDB - October 12, 2020
Alibaba Clouder - April 17, 2018
Alibaba Clouder - February 14, 2018
A key value database service that offers in-memory caching and high-speed access to applications hosted on the cloudLearn More
ApsaraDB Dedicated Cluster provided by Alibaba Cloud is a dedicated service for managing databases on the cloud.Learn More
ApsaraDB for POLARDB is a cloud-native relational database compatible with MySQL, PostgreSQL, and Oracle.Learn More
A financial-grade distributed relational database that features high stability, high scalability, and high performance.Learn More
More Posts by Alibaba Clouder