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

Redis data is not persistent

I am new to using Redis and I am playing around a little bit with it. I have noticed that after a little time, let's say 10 minutes all the keys that I inserted just go away. I just did the default installation showed in the documentation. I didn't…
Erick Villatoro
  • 170
  • 1
  • 9
0
votes
0 answers

Could not connect to Redis at 127.0.0.1:6379: Connection refused, But Redis is running already

I have Redis running on my server and when I check it using the command I get the following output. ● redis.service - Redis persistent key-value database Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled) …
Happy Coder
  • 4,255
  • 13
  • 75
  • 152
0
votes
0 answers

Get the redis keys with size in azure redis console

I m using azure redis cache and want to get the list of redis keys with its size. Which command will work on the azure redis console ?
0
votes
1 answer

Redis SSL Errors In Logs - No Actual Issues?

I have a strange question. I by all rights believe I have a fully functional 6 node (3 masters, 3 replicas) working with Redis 6.2.6 on Ubuntu Server. The client key appears to work and I get responses from all nodes as expected. However, my logs…
0
votes
1 answer

im setting up redis deployment in kubernetes . how can i locally access the redis that i deployed in kubernetes

Deployed redis in my Kubernetes. How can I access that redis from the local machine my redis-service.yaml is : apiVersion: v1 kind: Service metadata: name: redis labels: app: redis spec: type: NodePort ports: - port: 6379 …
ashique
  • 935
  • 2
  • 8
  • 26
0
votes
0 answers

Kubectl port-forward has no effect

I'm trying to forward my redis pod to my local redis client. I checked pods, services, replica sets, deployments. The command that I'm running on my cluster: $ kubectl port-forward svc/redis 7000:6379 The response of it: Forwarding from…
0
votes
1 answer

Redis Pattern delete is not working on Ubuntu bash for Windows

I want to delete 137K keys by pattern match from Azure Cache for Redis. I am using Ubuntu bash for Windows. Commands I tried: redis-cli -h HOST -p PORT -a PASSWORD keys 'customer*' | xargs redis-cli DEL redis-cli -h HOST -p PORT -a PASSWORD --scan…
Manish Gupta
  • 1,405
  • 14
  • 32
0
votes
0 answers

Correct way to insert values in Redis with format "Key X , Value A,B,C"

I Have a .csv file with columns like these ID Valuue1 Value2 Value3 1 A B C I'm trying to insert those values in redis where ID will be the KEY and the value will be a string like…
JC_Rambo
  • 61
  • 7
0
votes
1 answer

How to connect to master in redis from slave

I have 1 master and 2 slaves. First I'm writining info replication to get infromation. If I'm on slave, I try to coonect to master with redis-cli -h ip-redis-master -a password. Can I automatize this? For example: redis-cli -h $(info replication |…
0
votes
1 answer

How to troubleshoot periodically CPU jump in redis

I use AWS ElastiCache Redis for our prod. I see CPU every 30 minutes of the round hour from average of 2-3% to 20%. This is constant, which tells me it comes from schedule job. From cloudwatch I have a suspicion it is related to KEY (and maybe SET)…
Nir
  • 2,497
  • 9
  • 42
  • 71
0
votes
1 answer

How to convert escaped binary strings returned by redis-cli to Java byte[]?

redis-cli returns values as escaped ASCII strings, as per https://github.com/redis/redis/blob/febe102bf6d94428779f3943aea5947893301912/src/sds.c#L870-L899. How to convert this string to corresponding bytes in Java?
Inego
  • 1,039
  • 1
  • 12
  • 19
0
votes
1 answer

How to pop multiple items from a REDIS SET atomically without using SPOP ?

SPOP [set] [count] was introduced in Redis v3.2 - https://redis.io/commands/spop , my REDIS version is 2.7. How can I atomically pop several items from a SET using cli commands? Is it possible to do something like...? MULTI a = SPOP myset //It…
Kevvvvyp
  • 1,704
  • 2
  • 18
  • 38
0
votes
2 answers

Unregistering a RedisGears registration using inline redis-cli command results in "ERR unknown command `RG_UNREGISTER`"

When using redis-cli, I can unregister a RedisGears registration like this: 127.0.0.1:16379> RG.UNREGISTER "0000000000000000000000000000000000000000-4" OK When running this command as an inline redis-cli command, it fails: $ redis-cli…
Wolkenarchitekt
  • 20,170
  • 29
  • 111
  • 174
0
votes
1 answer

Export Mysql to Redis and index with Redis search

Create table CREATE TABLE events_all_time ( id int(11) unsigned NOTNULL AUTO_INCREMENT, action varchar(255) NOTNULL, count int(11) NOTNULL DEFAULT 0, PRIMARY KEY (id), UNIQUE KEY uniq_action (action)); Below is an example of an sql script that…
Jamie Ross
  • 246
  • 1
  • 3
  • 13
0
votes
2 answers

How to send stdin to redis channel in realtime?

I want to send the stdout and stderr of terminal while I run a huge batch file. The batch file echoer.sh echo $HOME sleep 3 echo $HOME sleep 3 echo $HOME # n times Executing in terminal ./echoer.sh | redis-cli -x publish echoer This waits for the…
Prashant Raj
  • 152
  • 7