English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Redis commands are used to perform operations on the redis service.
To execute commands on the redis service, you need a redis client. The redis client is included in the installation package we downloaded earlier.
The basic syntax of the Redis client is:
$redis-cli
The following example explains how to start the redis client:
Start the redis server, open the terminal and enter the command redis-cliwhich will connect to the local redis service.
$redis-cli redis 127.0.0.1:6379> redis 127.0.0.1:6379> PING PONG
In the above example, we connected to the local redis service and executed PING command, which is used to check if the redis service is running.
If you need to execute commands on a remote redis service, we also use redis-cli commands.
$redis-cli -h host -p port -a password
The following examples demonstrate how to connect to a host at 127.0.0.1on port 6379 on a Redis service with the password mypass.
$redis-cli -h 127.0.0.1 -p 6379 -a "mypass" redis 127.0.0.1:6379> redis 127.0.0.1:6379> PING PONG