Introduction and use of redis command
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!