$ redis-cli -h
redis-cli 4.0.9
Usage: redis-cli [OPTIONS] [cmd [arg [arg ...]]]
-h <hostname> Server hostname (default: 127.0.0.1).
-p <port> Server port (default: 6379).
-s <socket> Server socket (overrides hostname and port).
-a <password> Password to use when connecting to the server.
-u <uri> Server URI.
-r <repeat> Execute specified command N times.
-i <interval> When -r is used, waits <interval> seconds per command.
It is possible to specify sub-second times like -i 0.1.
-n <db> Database number.
-x Read last argument from STDIN.
-d <delimiter> Multi-bulk delimiter in for raw formatting (default: \n).
-c Enable cluster mode (follow -ASK and -MOVED redirections).
--raw Use raw formatting for replies (default when STDOUT is
not a tty).
--no-raw Force formatted output even when STDOUT is not a tty.
--csv Output in CSV format.
--stat Print rolling stats about server: mem, clients, ...
--latency Enter a special mode continuously sampling latency.
If you use this mode in an interactive session it runs
forever displaying real-time stats. Otherwise if --raw or
--csv is specified, or if you redirect the output to a non
TTY, it samples the latency for 1 second (you can use
-i to change the interval), then produces a single output
and exits.
--latency-history Like --latency but tracking latency changes over time.
Default time interval is 15 sec. Change it using -i.
--latency-dist Shows latency as a spectrum, requires xterm 256 colors.
Default time interval is 1 sec. Change it using -i.
--lru-test <keys> Simulate a cache workload with an 80-20 distribution.
--slave Simulate a slave showing commands received from the master.
--rdb <filename> Transfer an RDB dump from remote server to local file.
--pipe Transfer raw Redis protocol from stdin to server.
--pipe-timeout <n> In --pipe mode, abort with error if after sending all data.
no reply is received within <n> seconds.
Default timeout: 30. Use 0 to wait forever.
--bigkeys Sample Redis keys looking for big keys.
--hotkeys Sample Redis keys looking for hot keys.
only works when maxmemory-policy is *lfu.
--scan List all keys using the SCAN command.
--pattern <pat> Useful with --scan to specify a SCAN pattern.
--intrinsic-latency <sec> Run a test to measure intrinsic system latency.
The test will run for the specified amount of seconds.
--eval <file> Send an EVAL command using the Lua script at <file>.
--ldb Used with --eval enable the Redis Lua debugger.
--ldb-sync-mode Like --ldb but uses the synchronous Lua debugger, in
this mode the server is blocked and script changes are
are not rolled back from the server memory.
--help Output this help and exit.
--version Output version and exit.
Examples:
cat /etc/passwd | redis-cli -x set mypasswd
redis-cli get mypasswd
redis-cli -r 100 lpush mylist x
redis-cli -r 100 -i 1 info | grep used_memory_human:
redis-cli --eval myscript.lua key1 key2 , arg1 arg2 arg3
redis-cli --scan --pattern '*:12345*'
(Note: when using --eval the comma separates KEYS[] from ARGV[] items)
When no command is given, redis-cli starts in interactive mode.
Type "help" in interactive mode for information on available commands
and settings.
Print rolling stats about server: mem, clients, …
$ redis-cli --stat
------- data ------ --------------------- load -------------------- - child -
keys mem clients blocked requests connections
11 821.82K 1 0 6348 (+0) 665
11 821.82K 1 0 6349 (+1) 665
11 821.82K 1 0 6350 (+1) 665
11 821.82K 1 0 6351 (+1) 665
11 821.82K 1 0 6352 (+1) 665
11 821.82K 1 0 6353 (+1) 665
11 821.82K 1 0 6354 (+1) 665
11 821.82K 1 0 6355 (+1) 665
$redis-cli -r 1 config get maxclients
1) "maxclients"
2) "1000"
127.0.0.1:6379> config set maxclients 100
OK
127.0.0.1:6379> config get maxclients
1) "maxclients"
2) "100"
127.0.0.1:6379> config set maxclients 10000
OK
127.0.0.1:6379> config get maxclients
1) "maxclients"
2) "10000"
127.0.0.1:6379> config get dir
1) "dir"
2) "/var/lib/redis
127.0.0.1:6379> client list
id=673 addr=127.0.0.1:40150 fd=8 name= age=195 idle=191 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=keys
id=679 addr=127.0.0.1:41468 fd=9 name= age=33 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
127.0.0.1:6379> info clients
# Clients
connected_clients:2
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
127.0.0.1:6379> config get save
1) "save"
2) "900 1 300 10 60 10000"
127.0.0.1:6379> config get dbfilename
1) "dbfilename"
2) "dump.rdb"
127.0.0.1:6379> config get databases
1) "databases"
2) "16"
127.0.0.1:6379> config get loglevel
1) "loglevel"
2) "notice"
127.0.0.1:6379> config get port
1) "port"
2) "6379"
127.0.0.1:6379> config get port
1) "port"
2) "6379"
127.0.0.1:6379> config get timeout
1) "timeout"
2) "0"
127.0.0.1:6379> config get logfile
1) "logfile"
2) "/var/log/redis/redis-server.log"
127.0.0.1:6379> config get bind
1) "bind"
2) "127.0.0.1 ::1"
127.0.0.1:6379> config get *
1) "dbfilename"
2) "dump.rdb"
3) "requirepass"
4) ""
5) "masterauth"
6) ""
7) "cluster-announce-ip"
8) ""
9) "unixsocket"
10) ""
11) "logfile"
12) "/var/log/redis/redis-server.log"
13) "pidfile"
14) "/var/run/redis/redis-server.pid"
15) "slave-announce-ip"
16) ""
17) "maxmemory"
18) "0"
19) "proto-max-bulk-len"
20) "536870912"
21) "client-query-buffer-limit"
22) "1073741824"
23) "maxmemory-samples"
24) "5"
25) "lfu-log-factor"
26) "10"
27) "lfu-decay-time"
28) "1"
29) "timeout"
30) "0"
31) "active-defrag-threshold-lower"
32) "10"
33) "active-defrag-threshold-upper"
34) "100"
35) "active-defrag-ignore-bytes"
36) "104857600"
37) "active-defrag-cycle-min"
38) "25"
39) "active-defrag-cycle-max"
40) "75"
41) "auto-aof-rewrite-percentage"
42) "100"
43) "auto-aof-rewrite-min-size"
44) "67108864"
45) "hash-max-ziplist-entries"
46) "512"
47) "hash-max-ziplist-value"
48) "64"
49) "list-max-ziplist-size"
50) "-2"
51) "list-compress-depth"
52) "0"
53) "set-max-intset-entries"
54) "512"
55) "zset-max-ziplist-entries"
56) "128"
57) "zset-max-ziplist-value"
58) "64"
59) "hll-sparse-max-bytes"
60) "3000"
61) "lua-time-limit"
62) "5000"
63) "slowlog-log-slower-than"
64) "10000"
65) "latency-monitor-threshold"
66) "0"
67) "slowlog-max-len"
68) "128"
69) "port"
70) "6379"
71) "cluster-announce-port"
72) "0"
73) "cluster-announce-bus-port"
74) "0"
75) "tcp-backlog"
76) "511"
77) "databases"
78) "16"
79) "repl-ping-slave-period"
80) "10"
81) "repl-timeout"
82) "60"
83) "repl-backlog-size"
84) "1048576"
85) "repl-backlog-ttl"
86) "3600"
87) "maxclients"
88) "10000"
89) "watchdog-period"
90) "0"
91) "slave-priority"
92) "100"
93) "slave-announce-port"
94) "0"
95) "min-slaves-to-write"
96) "0"
97) "min-slaves-max-lag"
98) "10"
99) "hz"
100) "10"
101) "cluster-node-timeout"
102) "15000"
103) "cluster-migration-barrier"
104) "1"
105) "cluster-slave-validity-factor"
106) "10"
107) "repl-diskless-sync-delay"
108) "5"
109) "tcp-keepalive"
110) "300"
111) "cluster-require-full-coverage"
112) "yes"
113) "cluster-slave-no-failover"
114) "no"
115) "no-appendfsync-on-rewrite"
116) "no"
117) "slave-serve-stale-data"
118) "yes"
119) "slave-read-only"
120) "yes"
121) "stop-writes-on-bgsave-error"
122) "yes"
123) "daemonize"
124) "yes"
125) "rdbcompression"
126) "yes"
127) "rdbchecksum"
128) "yes"
129) "activerehashing"
130) "yes"
131) "activedefrag"
132) "no"
133) "protected-mode"
134) "yes"
135) "repl-disable-tcp-nodelay"
136) "no"
137) "repl-diskless-sync"
138) "no"
139) "aof-rewrite-incremental-fsync"
140) "yes"
141) "aof-load-truncated"
142) "yes"
143) "aof-use-rdb-preamble"
144) "no"
145) "lazyfree-lazy-eviction"
146) "no"
147) "lazyfree-lazy-expire"
148) "no"
149) "lazyfree-lazy-server-del"
150) "no"
151) "slave-lazy-flush"
152) "no"
153) "maxmemory-policy"
154) "noeviction"
155) "loglevel"
156) "notice"
157) "supervised"
158) "no"
159) "appendfsync"
160) "everysec"
161) "syslog-facility"
162) "local0"
163) "appendonly"
164) "no"
165) "dir"
166) "/var/lib/redis"
167) "save"
168) "900 1 300 10 60 10000"
169) "client-output-buffer-limit"
170) "normal 0 0 0 slave 268435456 67108864 60 pubsub 33554432 8388608 60"
171) "unixsocketperm"
172) "0"
173) "slaveof"
174) ""
175) "notify-keyspace-events"
176) ""
177) "bind"
178) "127.0.0.1 ::1"
127.0.0.1:6379> keys *
1) "test_lock"
2) "a"
3) "greeting"
4) "four"
5) "two"
6) "greeting_7777"
7) "one"
8) "three"