Redis

<< Back to wiki homepage

Table of contents:

Usage

Show DBs

info keyspace

Select db

select {number}

Get keys

keys *

Get the type of the key

type keyname

Get details of the key

if value type is:

Delete keys matching the pattern

redis-cli --scan --pattern '*mypattern*' | xargs redis-cli del

Migration

Clone / dump / restore

Use rump to do all:

rump -from redis://redis_addr:redis_port/db_number -to redis://redis_addr:redis_port/db_number
# or -to/-from redisdb.dump if you want to use files

Export to csv

redis-cli --csv ${query to run} > output.csv

Management

Change settings without restarting

Might not be possible for all options, but docs are good. Example seting the maxmemory value to 4GB:

CONFIG SET maxmemory 4294967296

Cluster

Check the nodes

redis-cli --no-auth-warning -p ${YOUR_CLUSTER_PORT} -a ${YOUR_AUTH_PASS} CLUSTER NODES