A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/azure/azure-cache-for-redis/cache-how-to-redis-cli-tool below:

Use redis-cli - Azure Cache for Redis

This article describes how to use the redis-cli command-line interface to interact with Azure Cache for Redis as a client. You can use redis-cli to directly interact with your Azure Redis cache instance, and for debugging and troubleshooting.

Prerequisite

Access to an Azure Cache for Redis server instance.

Install redis-cli

The redis-cli tool installs automatically with the Redis package, which is available for Linux, macOS, and Windows. For detailed installation instructions, see the open-source Redis documentation.

Install on Linux

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

sudo apt-get update
sudo apt-get install redis
Install on Windows

The best way to use redis-cli on Windows is to install the Windows Subsystem for Linux (WSL), which allows you to run Linux tools directly on Windows. To install WSL, see How to install Linux on Windows with WSL.

Once installed, use WSL to install a Linux distro, and then install redis-cli by using the available package management for the Linux distro you chose. The default distro for WSL is Ubuntu. For more information, see the open-source Redis documentation.

Connect using redis-cli

To use redis-cli to connect to your Azure Redis cache as a client, you must specify the cache host name, port, and keys. You can retrieve these values by the following methods:

The following section describes how to get these values from the Azure portal.

Get cache host name, port, and access keys from the Azure portal

To connect to your Azure Redis cache, the cache client needs the cache host name, ports, and keys. Some clients might refer to these items by slightly different names. Follow these instructions to get the cache host name, ports, and keys from the Azure portal.

Get other cache information

You might also need to specify the following options for redis-cli:

Run the redis-cli connection command

To connect to your cache, open a shell or terminal on a computer with the Redis package installed. On Windows, you can use WSL with Windows Terminal to open a Linux command line.

Run one of the following command lines, depending on your TLS, port, and clustering options. Replace the <cache name> and <access key> placeholders with the values for your cache.

You're now connected to your Azure Redis cache instance.

Use redis-cli commands with your Azure Redis cache

Once you establish the connection, you can issue commands to your Azure Redis instance at the redis-cli command prompt. The following examples show a connection to a cache named contoso that uses port 6380.

One easy way to test the connection is to use the PING command. The command returns PONG in the console.

contoso.redis.cache.windows.net:6380> PING
PONG

You can also run commands like SET and GET.

contoso.redis.cache.windows.net:6380> SET hello world
OK
contoso.redis.cache.windows.net:6380> GET hello
"world"
Alternatives to redis-cli

While the redis-cli is a useful tool, you can also use the following other methods to connect to your cache for troubleshooting or testing:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4