Questions tagged [redis-cli]

redis-cli is the command line interface that is installed when installing Redis.

redis-cli 3.0.5

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.
  -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.
  --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.
  --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>.
  --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.
278 questions
2
votes
0 answers

config get * not working in redis 3.2.8

>config get * ERR unknown command 'config' however, https://redis.io/commands/config-get says that the command is available since redis 2.0. My redis_version : 3.2.8 P.S. I have just started learning redis.
sumit sachdeva
  • 429
  • 3
  • 12
2
votes
2 answers

How to delete Redis keys with special characters?

I cannot delete a key of the format ENV:NAMESPACE:?''?""-last from our Redis instance. It appears to have been added maliciously. Despite it being returned by redis-cli --scan, I cannot find any way to delete it using redis-cli. Every single…
lsglick
  • 51
  • 7
2
votes
0 answers

redis-cli restore a dumped key file with size of more than 1GB

I have used the command line below to backup a key into a file . The file size is 1.5GB . It is a hash key with many many fields . redis-cli --raw dump mykey | head -c-1 > myfile When I used the command line below to restore the key , I always got…
Richard Mao
  • 202
  • 3
  • 12
2
votes
0 answers

How to modify the output of redis-cli pipe

I am using redis-cli pipe for mass insertion data from file into redis. The output is as follow: All data transferred. Waiting for the last reply... Last reply received from server. errors: 0, replies: 8 MY problem is when redis throws error while…
Arti Negi
  • 81
  • 6
2
votes
1 answer

Redis - delete field by pattern matching on hash key

I have the following structure in Redis, commKey:hkey1 target1 - value1 target2 - value2 commKey:hkey2 target2 - value3 target3 - value4 commKey:hkey3 target1 - value5 target3 - value6 ... commkey will appear on all hashkeys…
RaR
  • 3,075
  • 3
  • 23
  • 48
2
votes
0 answers

node js app with redis backend - how to send a "SCAN" command

I've just installed a redis client for my node application. Package information is as follows: me@mydevbox:/var/www/html/node/test$ cat package.json { "name": "test", "version": "0.0.0", "private": true, "scripts": { "start": "node…
Happydevdays
  • 1,982
  • 5
  • 31
  • 57
2
votes
1 answer

How to get the memory size of a list in Redis?

I'm storing a very large list of strings in Redis and I'm trying to figure out if there is a command (or any other way) to get the memory used by that list. Any suggestions? I went over the list of Redis commands by couldn't find anything relevant.
Forge
  • 6,538
  • 6
  • 44
  • 64
2
votes
1 answer

redis hmget with wildcard fields

I have a hashset in redis like below. "abcd" : { "rec.number.984567": "value1", "rec.number.973956": "value2", "rec.number.990024": "value3", "rec.number.910842": "value4", "rec.number.910856": "...", "other.abcd.efgh": "some…
Mopparthy Ravindranath
  • 3,014
  • 6
  • 41
  • 78
2
votes
1 answer

Best way to delete multiple keys with wildcard in redis-cli

I want to run a bash script from node.js to remove all session keys from redis every time the server restarts. I have read somewhere that Keys shouldn't be used to delete multiple keys with a pattern because it would subject the server to security…
RedGiant
  • 4,444
  • 11
  • 59
  • 146
2
votes
0 answers

Redis encoding on Windows

I've been testing Redis on Windows from a PowerShell console and I cannot get keys with locale diacritic signes (values are in French). I've just discovered --raw option from another SOF question…
jgran
  • 1,111
  • 2
  • 11
  • 21
2
votes
3 answers

Configure Redis Cluster in Ubuntu Server 14.04

I've installed redis-server using apt-get install redis-server and everything went fine. Right now I'm trying to configure it in a Cluster mode. The problem is that in the tutorial supplied here http://redis.io/topics/cluster-tutorial they use a…
Alexandru
  • 833
  • 1
  • 8
  • 24
1
vote
1 answer

Why is redis throwing "The client is closed" return Promise.reject(new errors_1.ClientClosedError()); error?

I am running redis in docker environment with nodejs as backend, postgres as db and react as frontend. The logic is to get index value from the frontend, calculate the fibonacci number for the index and return it. The server part takes the value and…
Sandy M
  • 138
  • 7
1
vote
0 answers

How to avoid redis-cli encryption for the key and value in Symfony PHP

I have problems with key-value encryption in redis-cli. My Settings are as in tutorials service.yml app.my_custom_redis_provider: class: \Predis\Client factory: [ 'Symfony\Component\Cache\Adapter\RedisAdapter', 'createConnection' ] …
mehmetsen80
  • 727
  • 1
  • 8
  • 25
1
vote
1 answer

Redis client connecting to a different port

I have launched redis on port 6379. And I connected a redis-cli client to the same port. But when I run this command: client list It shows me the following redis-cli connected: id=5 addr=IP-MASKED:46604 laddr=IP-MASKED:6379 fd=8 name= age=124…
Ankit Sahay
  • 1,710
  • 8
  • 14
1
vote
1 answer

How to generate a large amount of redis data of a specific size to a redis cluster

I need to generate millions of redis data with a value size of 1kb to a redis cluster, assuming that only the value type is string. I learned about two options, the first one is to use debug populate to generate a specific amount of data, but it…
moluzhui
  • 1,003
  • 14
  • 34