Sign inSign up

toolkitbox/redis

By toolkitbox

•Updated 18 days ago

DevOps toolkit - redis client

Image
0

1.9K

toolkitbox/redis repository overview

⁠Redis Client

GitHub Stars GitHub Issues Docker Pulls

📢 Found an issue or want to request a new tool? Open an issue on GitHub⁠

Command line client for Redis.

⁠Quick Start

⁠Docker
# Interactive mode
docker run -it --rm \
  ghcr.io/pabpereza/toolkitbox/redis:latest \
  redis-cli -h my-server.com -p 6379

# With authentication
docker run -it --rm \
  ghcr.io/pabpereza/toolkitbox/redis:latest \
  redis-cli -h my-server.com -a PASSWORD

# Run single command
docker run --rm \
  ghcr.io/pabpereza/toolkitbox/redis:latest \
  redis-cli -h my-server.com PING
⁠Kubernetes
apiVersion: v1
kind: Pod
metadata:
  name: redis-client
spec:
  containers:
  - name: redis-client
    image: ghcr.io/pabpereza/toolkitbox/redis:latest
    command: ["sleep", "infinity"]
    env:
    - name: REDISCLI_AUTH
      valueFrom:
        secretKeyRef:
          name: redis-credentials
          key: password

⁠Description

Redis CLI (redis-cli) is the official command line tool for interacting with Redis servers. It allows you to execute Redis commands, manage keys, monitor the server, and perform administration operations.

⁠Installation

This component installs redis (which includes redis-cli) from the Alpine Linux repositories.

⁠Basic Usage

⁠Connect to local Redis
redis-cli
⁠Connect to remote server
redis-cli -h hostname -p 6379
⁠Connect with authentication
redis-cli -h hostname -a password
⁠Connect to Redis with TLS
redis-cli -h hostname --tls
⁠Execute command and exit
redis-cli -h hostname PING
⁠Execute multiple commands from file
redis-cli -h hostname < commands.txt

⁠Useful Commands

⁠String operations
# Set value
SET key "value"

# Get value
GET key

# Set with expiration (seconds)
SETEX key 3600 "value"

# Increment counter
INCR counter
⁠List operations
# Add to list
LPUSH my_list "element"
RPUSH my_list "element"

# Get elements
LRANGE my_list 0 -1

# Get length
LLEN my_list
⁠Hash operations
# Set field
HSET user:1 name "John"

# Get field
HGET user:1 name

# Get all fields
HGETALL user:1
⁠Set operations
# Add to set
SADD my_set "element"

# Get members
SMEMBERS my_set

# Check membership
SISMEMBER my_set "element"
⁠Administration
# View all keys
KEYS *

# View keys with pattern
KEYS user:*

# Server information
INFO

# Real-time monitor
MONITOR

# View connected clients
CLIENT LIST

# Get configuration
CONFIG GET maxmemory

⁠Common Options

OptionDescription
-hServer hostname
-pPort (default: 6379)
-aAuthentication password
-nDatabase number (0-15)
--tlsEnable TLS
--scanUse SCAN instead of KEYS
--bigkeysFind large keys
--memkeysAnalyze memory usage

⁠Special Modes

⁠Monitor mode
redis-cli MONITOR
⁠Pub/sub mode
# Subscribe to channel
redis-cli SUBSCRIBE my_channel

# Publish message
redis-cli PUBLISH my_channel "message"
⁠Key analysis
# Find large keys
redis-cli --bigkeys

# Analyze memory
redis-cli --memkeys

⁠Available Legacy Versions

  • v4 - Redis 4.x
  • v5 - Redis 5.x

⁠Official Documentation

Tag summary

Content type

Image

Digest

sha256:d762fded7…

Size

9 MB

Last updated

18 days ago

docker pull toolkitbox/redis