// Tutorial Series //
How To Manage a Redis Database
Default avatar
By Mark Drake
Manager, Developer Education
How To Manage a Redis Database


Redis is an open-source, in-memory key-value data store. A NoSQL database, Redis doesn’t use structured query language, otherwise known as SQL. Redis instead comes with its own set of commands for managing and accessing data.

The tutorials included in this series cover a broad range of Redis commands, but they generally focus on connecting to a Redis database, managing a variety of data types, and troubleshooting and debugging problems, along with a few other more specific functions. They are written in cheat sheet format with self-contained examples. We encourage you to jump to whichever guide is relevant to the task you’re trying to complete.

Summary View
detailed View
// Cheatsheet //

How To Connect to a Redis Database

Published on September 20, 2019 · Updated on June 26, 2020

Whether you’ve installed Redis locally or you’re working with a remote instance, you need to connect to it in order to perform certain operations. In this tutorial we will go over how to connect to Redis from the command line, how to authenticate and test your connection, as well as how to close a Redis connection.

// Cheatsheet //

How To Manage Redis Databases and Keys

Published on September 20, 2019 · Updated on September 20, 2019

Redis is a key-value data store, which is a type of NoSQL database where keys serve as unique identifiers for their associated values. Any given Redis instance includes a number of databases, each of which can hold many different keys of a variety of data types. In this tutorial, we will go over how to select a database, move keys between databases, and manage and delete keys.

// Cheatsheet //

One Redis’s most sought-after features is its support for replication: any Redis server can replicate its data to any number of replicas, allowing for high read scalability and strong data redundancy. Additionally, Redis was designed to allow many clients (up to 10000, by default) to connect and interact with data, making it a good choice for cases where many users need access to the same dataset. This tutorial goes over the commands used to manage Redis clients and replicas.

// Cheatsheet //

How To Manage Strings in Redis

Published on September 20, 2019

In Redis, strings are the most basic type of value you can create and manage. This tutorial provides an overview of how to create and retrieve strings, as well as how to manipulate the values held by string keys.

// Cheatsheet //

How To Manage Lists in Redis

Published on September 20, 2019 · Updated on September 20, 2019

In Redis, a list is a collection of strings sorted by the order in which they were inserted unless otherwise specified, similar to linked lists. This tutorial details how to create lists and retrieve and delete elements from lists.

// Tutorial //

How To Manage Hashes in Redis

Published on September 20, 2019 · Updated on September 20, 2019

A Redis hash is a data type that represents a mapping between a string field and a string value. A single hash can hold many field-value pairs and are designed to not take up much space, making them ideal for representing data objects. For example, a hash might represent a customer, and include fields like ‘name’, ‘address’, ‘email’, or ‘customer_id’. This tutorial will go over how to manage hashes in Redis, from creating them to retrieving and deleting the data held within a hash.

// Cheatsheet //

How To Manage Sets in Redis

Published on September 26, 2019

Sets in Redis are collections of strings stored at a given key. When held in a set, an individual record value is referred to as a member. Unlike lists, sets are unordered and do not allow repeated values. This tutorial explains how to create sets, retrieve and remove members, and compare the members of different sets.

// Cheatsheet //

How To Manage Sorted Sets in Redis

Published on November 22, 2019

In Redis, sorted sets are a data type similar to sets in that both are non repeating groups of strings. The difference is that each member of a sorted set is associated with a score, allowing them to be sorted or ranked from the smallest score to the greatest. This tutorial explains how to create sorted sets, retrieve and remove their members, and create new sorted sets from existing ones.

// Cheatsheet //

How To Run Transactions in Redis

Published on October 1, 2019

Redis allows you to plan a sequence of commands and run them one after another, a procedure known as a transaction. It’s impossible for clients to run commands while a transaction block is being executed, ensuring that the transaction is treated as a single isolated operation. This tutorial goes over how to how to execute and cancel transactions, and also includes some information on pitfalls commonly associated with transactions.

// Cheatsheet //

How To Expire Keys in Redis

Published on October 8, 2019

Redis is an open-source, in-memory key-value data store. Depending on the needs of your application, there may be cases where you’ve set a key but you know you will want to delete it later on after a certain amount of time has passed. This tutorial explains how to set keys to expire, check how long a key has until it will expire, and cancel a key’s expiration setting.

// Cheatsheet //

How To Troubleshoot Issues in Redis

Published on September 20, 2019 · Updated on September 20, 2019

Redis comes with several commands that can help with troubleshooting and debugging issues. Because of its nature as an in-memory key-value store, many of these commands focus on memory management, but there are others that are valuable for providing an overview of the state of your Redis server. This tutorial will provide details on how to use some of these commands to help diagnose and resolve issues you may run into as you use Redis.

// Cheatsheet //

There may be times where you want to change the behavior of your Redis instance on the fly. Redis has several commands that allow you to make changes to the Redis server’s configuration settings directly from the redis-cli interface. This tutorial will go over some of these commands, and also explain how to make these configurations permanent.

Check out all our Tutorial Series

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.

Sign up