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
8
votes
1 answer

how to set a timeout for redis-cli command?

I have a health check I'm trying to use that executes the redis-cli command from the redis servers to the redis-sentinels remotely. redis-cli -h 10.10.10.10 -p 26379 SENTINEL MASTER testing There is a logic that sorts out whether there is a quorum…
numb3rs1x
  • 4,673
  • 5
  • 31
  • 44
8
votes
4 answers

redis-cli redirected to 127.0.0.1

I started Redis cluster on PC1, then connected it on PC2. When needed to redirect to another cluster node, it shows Redirected to slot [7785] located at 127.0.0.1, but should show Redirected to slot [7785] located at [IP of PC1, like 192.168.1.20],…
Robin Chen
  • 81
  • 1
  • 5
7
votes
1 answer

Is it possible to delete all keys on an AWS ElastiCache redis cluster?

I'm trying to delete all keys/values in an AWS ElastiCache cluster, but when I'm executing flushall or flushdb from redis-cli, it only removes the values in the node I'm currently connected to. I am looking for one command which can delete all keys…
pawansgi92
  • 1,065
  • 13
  • 32
7
votes
3 answers

(error) ERR unknown command 'redis-cli'

We have installed the redis client. When we type the following command inside C:\Program Files\Redis\redis-cli.exe: redis-cli -h redis-server.example.com -p 6390 ping It throws the following error: (error) ERR unknown command 'redis-cli' And the…
Zameer Ansari
  • 28,977
  • 24
  • 140
  • 219
7
votes
1 answer

How to find redis keys by TTL

I want to find any/all redis keys with TTL is -1. That's every key that is not set to expire. I've tried a couple GUI clients and none of them seem to off this functionality. I found this answer which appears to offer a way to do it from the command…
emersonthis
  • 32,822
  • 59
  • 210
  • 375
6
votes
2 answers

How to delete all keys in Redis matching pattern from within redis-cli repl?

I am trying to delete a bunch of keys matching a prefix using redis-cli. I have been researching how to do this online and the most common suggestion I have seen is to do it straight from the command line, like this: $ redis-cli [options] KEYS…
Graham S.
  • 1,480
  • 1
  • 20
  • 28
6
votes
1 answer

How to install/manage Redis Cluster on AWS EC2, not ElastiCache?

Due to some historical/incident reasons, my company cannot use AWS ElastiCache, so can someone recommend a step-by-step tutorial on how to configure a Redis Cluster on AWS EC2? This install redis on aws micro instance has already been very answered…
Fisher Coder
  • 3,278
  • 12
  • 49
  • 84
6
votes
2 answers

How to start redis with specific .rdb file?

I had redis installed without password. Then I tried to put password without success and decided to delete all related to redis from my server. After that, I've installed redis once again and set a password successfully. The problem is that now is…
Rodrigo Pereira
  • 1,834
  • 2
  • 17
  • 35
5
votes
3 answers

Delete Redis keys matching a pattern

I am using Redis hash set to store data in the following format: hset b1.b2.b3 name test Now I want to delete this key so I am using the following format: del b1.b2.* But it not working so how I delete the Redis key using a pattern?
Suraj Dalvi
  • 988
  • 1
  • 20
  • 34
5
votes
1 answer

Unable to access Redis (cluster mode enabled) Cluster's Endpoints

I have 1 VPC - under that 1 EC2 instance ( amazon ami ) and 1 Redis (cluster mode enabled) Cluster with Auth ( password) and with Security Group Open to all IP:Port ( only for testing sake ) - so very simple setup. telnet works at port 6379 from my…
dshiv126
  • 131
  • 1
  • 9
5
votes
1 answer

Duplicate a key in redis

Can I duplicate a key using the redis-cli connected, is there any command predefined in redis or not? Duplicate FSS_SYSAGENT to FSS_SYSAGENTDuplicate. 10.44.112.213:6403> hgetall FSS_SYSAGENT 1) "SYSTEM_01" 2)…
Manu C Rajan
  • 153
  • 1
  • 2
  • 13
5
votes
3 answers

Delete keys with spaces

I am trying to delete multiple keys from my remote Redis db using the following command. redis-cli -h -p 6379 KEYS "myprefix:*" | xargs redis-cli -h -p 6379 DEL It has deleted all the matching keys except the ones having spaces in…
XCEPTION
  • 1,671
  • 1
  • 18
  • 38
5
votes
2 answers

set json value from file to redis

I have a bash.sh script: #!/usr/bin/env bash val=$(cat ../my-microservice/conf/config.json) echo "set my-microservice-config ${val}" | redis-cli where the config.json: { "key" : "value" } When I run it I got: ERR unknown command '}' How to…
ses
  • 13,174
  • 31
  • 123
  • 226
5
votes
1 answer

[REDIS]: How to Delete All Keys on Master and Slave(s)?

I'm trying to delete all keys on both redis master and slave, but when I'm executing flushall or flushdb from redis-cli on master it deletes keys only on master, or vice versa if I'm deleting keys on slave it deletes keys only on slave. What command…
Sergei Sirik
  • 1,249
  • 1
  • 13
  • 28
4
votes
3 answers

Redis docker, cannot connect to redis-cli

I am trying to run redis with persistence storage. I followed official docker page of redis fo installation. I pulled the image using - docker pull redis I started redis with persistence storage using - docker run --name some-redis -d redis…
Bopsi
  • 2,090
  • 5
  • 36
  • 58
1
2
3
18 19