Redis Cheatsheet - rivernews/iriversland2-kubernetes GitHub Wiki

Connection

  • Use redis CLI: redis-cli -h host-name-or-ip -p port-num
  • If you don't have redis-cli, like in nginx container, you can instead use $ (printf "PING\r\n";) | nc localhost 6379 (SO)

Commands

Spin up redis cli redis-cli.

  • Check overall usage across each db number: INFO keyspace
  • Select db: SELECT <db num>
  • List keys KEYS <regex>
  • Show value MGET "<key>" "<key2>" ..., e.g. mget "bull:cronjobs:completed".
  • Clean all keys in current db FLUSHDB, or clean all db FLUSHALL
  • PubSub - list all current available channel: PUBSUB CHANNELS.
  • List all client CLIENT LIST. Kill client: CLIENT KILL ADDR host:port, or CLIENT KILL ID idOfClient.
⚠️ **GitHub.com Fallback** ⚠️