Thanks for visiting the site !!! Visit below intrested Ads to support us if you like the site .Sharing is caring .keep distance and keep safe . Happy Learning ... 😀

redis-server & –> to run Redis on the background

Redis running on standalone mode and listening on 6379 port .

A command-line interface to send commands to Redis .It has two modes.1)Command line mode 2)Interactive mode

Command-line — > useful for testing and scripts


$ redis-cli GET mycounter
(integer) 8

Interactive –> responses simpler to read

$ redis-cli
PING
PONG
127.0.0.1:6379> connect metal 6379

metal:6379> PING
PONG

Note:  <host>:<port> of connected Redis instance . In the above example it is 127.0.0.1:6379

By default redis-cli connects to 127.0.0.1 port 6379) (use -p to specify an alternate port)

$ redis-cli -h redis15.localnet.org   PING PONG

use -a option to specify the password in the command line itself

 $ redis-cli -a <password>  PING 
PONG

Auto-complete

127.0.0.1:6379> Z& 127.0.0.1:6379> ZADD=

Running same command N times

127.0.0.1:6379> 2 INCR mycounter (integer) 1 (integer) 2>

Command history and help

127.0.0.1:6379> help 127.0.0.1:6379> help Categories include: @generic, @list, @set, @sorted_set, @hash, @pubsub, @transactions, @connection, @server, @scripting, @hyperloglog

Create a key/value pair

Run the set command and pass the {key} and {value} as parameters

 

Query by key name
Run the get command and pass the {key} as a parameter

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *