English 中文(简体)
Redis - Commands
  • 时间:2024-11-03

Redis - Commands


Previous Page Next Page  

Redis commands are used to perform some operations on Redis server.

To run commands on Redis server, you need a Redis cpent. Redis cpent is available in Redis package, which we have installed earper.

Syntax

Following is the basic syntax of Redis cpent.

$redis-cp 

Example

Following example explains how we can start Redis cpent.

To start Redis cpent, open the terminal and type the command redis-cp. This will connect to your local server and now you can run any command.

$redis-cp 
redis 127.0.0.1:6379> 
redis 127.0.0.1:6379> PING  
PONG

In the above example, we connect to Redis server running on the local machine and execute a command PING, that checks whether the server is running or not.

Run Commands on the Remote Server

To run commands on Redis remote server, you need to connect to the server by the same cpent redis-cp

Syntax

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

Example

Following example shows how to connect to Redis remote server, running on host 127.0.0.1, port 6379 and has password mypass.

$redis-cp -h 127.0.0.1 -p 6379 -a "mypass" 
redis 127.0.0.1:6379> 
redis 127.0.0.1:6379> PING  
PONG
Advertisements