Get the App
SLTechnology News&Howtos  ›  Database  › 

Introduction and use of redis command

Shulou Source: shulou.com Published: 2022-06-01 15:34:47 10月29日 Update

This article shows the syntax and use of the redis command, the code is concise and easy to understand, and it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

The Redis command is used to perform operations on the redis service.

A redis client is required to execute commands on the redis service. The Redis client is in the redis installation package we downloaded earlier.

Grammar

The basic syntax for the Redis client is:

$redis-cli

Example

The following example shows how to start the redis client:

Start the redis client, open the terminal and enter the command redis-cli. This command connects to the local redis service.

$redis-cliredis 127.0.0.1 PINGPONG 6379 > redis 127.0.0.1

In the above example, we connect to the local redis service and execute the PING command, which is used to detect whether the redis service is started.

Execute commands on remote services

If you need to execute a command on a remote redis service, we also use the redis-cli command.

Grammar

$redis-cli-h host-p port-a password

Example

The following example shows how to connect to a redis service with host 127.0.0.1, port 6379, and password mypass.

$redis-cli-h 127.0.0.1-p 6379-a "mypass" redis 127.0.1 redis > redis 127.0.1 redis 6379 > PINGPONG after reading the above, have you mastered how to use the redis command? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Tags: Commands services instances clients clients syntax content more concise concise host code usage passwords skills articles methods ports side articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Huawei macOS Redmi Shulou Tech Info