Edit

Share via


Use client tools to manage data in Azure Managed Redis

You can use the following tools to access and manage data in Azure Managed Redis as a client. Use these tools to directly interact with your Azure Managed Redis instance and for debugging and troubleshooting.

  • Redis Insight
  • redis-cli command-line tool

Redis Insight

Redis Insight is a rich open-source graphical tool for issuing Redis commands and viewing the contents of a Redis instance. It works with Azure Managed Redis and is supported on Linux, Windows, and macOS.

redis-cli command-line tool

Use the redis-cli command-line tool to interact with an Azure Managed Redis instance as a client. Use redis_cli as a lightweight way to issue commands and for repeatable testing in scripts.

Install redis-cli

The redis-cli tool is installed automatically with the Redis package, which is available for multiple operating systems. See the open source install Redis guide for the most detailed documentation on your preferred operating system.

Linux

The redis-cli runs natively on Linux, and most distributions include a Redis package that contains the redis-cli tool. On Ubuntu, for instance, you install the Redis package with the following commands:

sudo apt-get update
sudo apt-get install redis

Windows

The best way to use redis-cli on a Windows computer is to install the Windows Subsystem for Linux (WSL). The Linux subsystem allows you to run linux tools directly on Windows. To install WSL, follow the WSL installation instructions.

Once WSL is installed, you can install redis-cli using whatever package management is available in the Linux distro you chose for WSL.

Gather cache access information

You can gather the information needed to access the cache using these methods:

In this section, you retrieve the information from the Azure portal.

To connect your Azure Managed Redis server, the cache client needs the cache endpoint, port, and a key for the cache. Some clients might refer to these items by slightly different names. You can get this information from the Azure portal.

  • To get the endpoint and port for your cache, select Overview from the Resource menu. The endpoint is of the form {yourcachename}.{region}.redis.azure.net. The port is 10000 for all Azure Managed Redis instances.

  • To get the access keys, select Authentication from the Settings menu. Then, select the Access keys tab. Here, you can find the primary and secondary keys for the cache. You can use either key to connect with your client tool.

Connect using redis-cli

Open up a shell or terminal on a computer with the Redis package installed. If using WSL, you can use the Windows Terminal to open a Linux command line. Before connecting with redis-cli, check:

  1. Whether TLS access is needed - By default, Azure Managed Redis instances use TLS encryption for connections. Whenever TLS is used on the server side, TLS on redis-cli must be enabled using the --tls option.
  2. The port used - all Azure Managed Redis instances use port 10000. Note that this is different than the default for the Redis community edition, which is 6379.
  3. Whether the cache instance uses the OSS cluster policy - If you're using the OSS cluster policy, add the -coption to ensure all shards can be accessed.

Examples

  1. Connect to an Azure Managed Redis instance using Enterprise cluster policy with TLS:

    redis-cli -p 10000 -h {yourcachename}.{region}.redis.azure.net -a YourAccessKey --tls
    
  2. Connect to an Azure Managed Redis instance using OSS cluster policy and TLS:

    redis-cli -p 10000 -h {yourcachename}.{region}.redis.azure.net -a YourAccessKey --tls -c
    

Testing the connection

Once the connection is established, you can issue commands to your Azure Managed Redis instance. One easy way to test the connection is to use the PING command. This command returns PONG in the console.

yourcachename.region.redis.azure.net:10000> PING
PONG

You can also run commands like SET and GET:

yourcachename.region.redis.azure.net:10000> SET hello world
OK
yourcachename.region.redis.azure.net:10000> GET hello
"world"

You're now connected to your Azure Managed Redis instance using the redis-cli.

Get started by creating a new Azure Managed Redis Instance instance.