CentOS 7
Sponsored Link

Redis : Basic Usage#1
This is the Basic Usage of Redis with "redis-cli" client program.
Following examples are basic one, you can see more commands on Official Site below.
⇒ http://redis.io/commands
[1] Connect to Redis Server like follows.
# connect to local server

# password is the one you set on redis.conf

[root@dlp ~]#
redis-cli -a password
# exit from connection> quit 

# possible to authenticate after connecting to Server
[root@dlp ~]# redis-cli> auth password 

# connect to a Database with specifying Database-ID explicitly

# if Database-ID is not specified, connect to Database-ID "0"

[root@dlp ~]#
redis-cli -a password -n 1[1]>

# change to Database-ID "2"[1]> select 2 

# for connecting to Redis on another Host, specify "-h [hostname]"

[root@dlp ~]#
redis-cli -h node01.srv.world -a password>
# possible to get results with non-interactively with redis-cli

# for example, get Value of a Key

[root@dlp ~]#
redis-cli -a password get key01

[2] This is the basic Usage of control Redis Server itself.
[root@dlp ~]#
redis-cli -a password
# refer to statics> info 
# Server
os:Linux 3.10.0-327.22.2.el7.x86_64 x86_64

# show connected clients> client list 
id=3 addr= fd=5 name= age=447 idle=0 flags=N db=0 sub=0 psub=0 
    multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=client
id=4 addr= fd=6 name= age=10 idle=10 flags=N db=0 sub=0 psub=0 
    multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=auth

# kill connection of a client> client kill 

# dump all requests after the command below> monitor 
1469078099.850114 [0] "get" "key01"
1469078112.319154 [0] "set" "key02" "value02"

# save data on disk with foreground> save 

# save data on disk with background> bgsave 
Background saving started

# get UNIX time stamp of the last save to disk> lastsave 
(integer) 1469078407

# save data on disk and shutdown Redis> shutdown 
not connected> quit 
[root@dlp ~]# ps aux | grep [r]edis

Matched Content