Click here to Skip to main content
13,766,627 members
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

1.3K views
Posted 15 Dec 2017
Licenced CPOL

High-Performance Redis on Alibaba Cloud

, 15 Dec 2017
Rate this:
Please Sign up or sign in to vote.
In this post, I demonstrate how to run Redis on Alibaba Cloud using the ApsaraDB service for high-performance database applications.

Alibaba Cloud provides a comprehensive suite of global cloud computing services to help power and grow your business. Create an account today and get $300 in new user free credit.

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.

Getting Started with ApsaraDB for Redis

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 Configuration

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.

Basic Configuration

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.

Network

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.

Password

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.

Quantity

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.

Connecting to Redis

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

Next Steps

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Zachary Flower
United States United States
Zachary Flower (@zachflower) is a freelance web developer, writer, and polymath. 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.

You may also be interested in...

Pro

Comments and Discussions

 
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04-2016 | 2.8.181114.1 | Last Updated 15 Dec 2017
Article Copyright 2017 by Zachary Flower
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid