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

Fetch and delete redis data using bat file

I have created a bat file for deleting specific data from Redis DB. I have follwing code title:Redis Service @echo off cls ECHO "Redis cache clearing started" ECHO "fetching started method 1" redis-cli -h 192.134.56.67 -p 6379 -a MyPassword keys…
Abdul Manaf
  • 4,933
  • 8
  • 51
  • 95
0
votes
1 answer

Redis node won't go into MASTER mode

I have a simple redis deployment MASTER, SLAVE and 2 SENTINEL running on docker swarm. I run the stack and all services come up. redis-master start as MASTER and I kill it to test SENTINEL and SLAVE recovering. redis-master then recovers and becomes…
haytham
  • 502
  • 4
  • 22
0
votes
1 answer

Redis delete batch keys strips slashes from key names

In my MacOs 10.15 environment I have a strange Redis behaviour when I list some keys with: redis-cli -n 1 --scan --pattern "product_doctrine*" It gives me for…
numediaweb
  • 16,362
  • 12
  • 74
  • 110
0
votes
0 answers

Plink - Remote interactive connection with bash script does not seem to work properly

I have a redis database on a remote docker host, and I'd like to access it through a single ssh script command via plink. The script is simple (redis-script.sh): #!/bin/bash echo "Enter Redis Password." read -s pass docker exec -it…
R. StackUser
  • 2,005
  • 4
  • 17
  • 24
0
votes
0 answers

Remove newlines in Redis

I dump all data to a text file using redis-dump > output.txt command. Output file contains SET commands which consists of multiple lines. SET 3ds:request:021333976bab4102a6d119293a1d0717 '{ "offer" : { "id" : 0, "secureId" :…
Halil
  • 1,795
  • 1
  • 24
  • 39
0
votes
0 answers

ZINTERSTORE not working in https://try.redis.io/

ZINTERSTORE command is not identified by Redis CLI on https://try.redis.io/. The Redis command's guide highlight that ZINTERSTORE (https://redis.io/commands/zinterstore) command is available from 2.0.0 version. The Redis available on try.redis.io is…
smulkutk
  • 71
  • 9
0
votes
0 answers

Why redis hash name cannot contain an email address?

I'm able to set keys that contain an email address like mario@mario.com but I cannot set a hash that contains @ character. What are the characters allowed when setting a hash key? Is is possible to set a hash key that contains an email?
Mario
  • 1,213
  • 2
  • 12
  • 37
0
votes
0 answers

Rails redis-server throws maxmemory error. Redis::CommandError (OOM command not allowed when used memory > 'maxmemory'.):

I'm still getting the following error message Redis::CommandError (OOM command not allowed when used memory > 'maxmemory'.): Even after setting maxmemory to 80gb inside my redis.conf file. When I check the value for maxmemory inside the redis…
Hugo
  • 2,073
  • 6
  • 23
  • 46
0
votes
2 answers

Why the redis returning more values instead of count?

I am using Ruby on Rails to store keys into redis. There are more than 20000 keys under my hash. I tried to limit 10 while getting all. But the redis returning 11 instead of 10. Why its returning 11? My hash, 127.0.0.1:6379> HLEN myhash (integer)…
SST
  • 2,054
  • 5
  • 35
  • 65
0
votes
1 answer

redis-cli: using "-r -1" exits immediately instead of running command indefinitely

I'm trying to monitor the behavior/uptime of a Redis cluster (on AWS ElastiCache) while performing various maintenance operations on it. According to this doc (under "Continuously Run Same Command"), I should be able to use the "-r" flag with the…
sixty4bit
  • 7,422
  • 7
  • 33
  • 57
0
votes
1 answer

redis-cli config host and port

How can I config redis-cli to use host and port for a certain bash script? Something like: redis-cli config host redis-cli config port is there way to do this?
user5047085
0
votes
1 answer

delete a key based on the refernmce of values in redis

Hi I have 100 key value pairs with different keys and same value in my redis now I want to delete all my key value pairs using value as reference how can I do it
Darshu Bc
  • 526
  • 5
  • 22
0
votes
1 answer

interacting with redis-client pod on kubernetes

I'm having a Redis cluster on Kubernetes. I need to interact with one of the redis-client pods, mainly in order to delete keys from time to time. The way I'm currently doing it is: Tunnel Kubernetes dashobard to localhost:8081 From the dashboard,…
Noam
  • 1,640
  • 4
  • 26
  • 55
0
votes
1 answer

How to call redis-cli get using Bash?

Is it possible to call redis-cli in bash? I tried: #!/bin/bash while IFS='' read -r line || [[ -n "$line" ]]; do echo "Text read from file: $line" echo 'keys $line' | redis-cli | sed 's/^/get /' | redis-cli done < "$1" It returns: line…
Ps-kl
  • 97
  • 2
  • 3
  • 14
0
votes
1 answer

Redis - Get total dataset size in a cluster

When a Redis instance is setup and running, the dataset size (in bytes) can be retrieved from output of the below command by looking at used_memory_dataset field. ./redis-cli -h -p info However, when I have multiple instances…
pree
  • 2,297
  • 6
  • 37
  • 55