Redis command
Redis commands for performing operations on a redis service.
To execute a command requires a client on redis redis service. Redis client before we redis downloaded the installation package.
grammar
The basic syntax Redis client is:
$ redis-cli
Examples
The following example explains how to start redis client:
Start redis client, open a terminal and enter the commandredis-cli.This command will connect local redis service.
$redis-cli redis 127.0.0.1:6379> redis 127.0.0.1:6379> PING PONG
In the above example we connect to the local redis service and execute thePING command, which is used to detect redis service is started.
Execute commands on remote service
If you need to execute commands on a remote redis service is alsoredis-cli command we use.
grammar
$ redis-cli -h host -p port -a password
Examples
The following example demonstrates how to connect to the host 127.0.0.1, port 6379, the password on mypass redis service.
$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