Client Commands

CLIENT-LIST-&-CLIENT-KILL

CLIENT commands let you see and manage all connections to your Redis server. Find resource hogs, debug connection issues, and disconnect problematic clients.

You'll Learn

  • Viewing connections with CLIENT LIST
  • Client information breakdown
  • Disconnecting clients with CLIENT KILL
  • Managing client resources
Free Download

See Your Data, Not Terminal Text

Redimo visualizes every Redis data type beautifully. Edit inline, undo mistakes, stay safe in production.

1. CLIENT LIST: See All Connections

CLIENT LIST shows every connection to your Redis server with detailed information about each one.

CLIENT LIST

127.0.0.1:6379> CLIENT LIST
id=3 addr=192.168.1.100:52345 fd=8 name=webapp age=3600 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=32742 obl=0 oll=0 omem=0 events=r cmd=get user=default
id=4 addr=192.168.1.101:52346 fd=9 name=worker age=1800 idle=5 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=brpop user=default
id=5 addr=192.168.1.102:52347 fd=10 name= age=60 idle=60 flags=N db=1 sub=5 psub=2 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=subscribe user=readonly

2. Understanding CLIENT LIST Fields

Identity

  • id - Unique client ID (incrementing)
  • addr - Client IP:port
  • name - Client name (if set)
  • user - ACL username

Timing

  • age - Connection age in seconds
  • idle - Seconds since last command

State

  • db - Selected database (0-15)
  • sub - Channel subscriptions
  • psub - Pattern subscriptions
  • multi - Commands in MULTI (-1 if not in transaction)
  • cmd - Last command executed

Memory

  • qbuf - Query buffer size
  • qbuf-free - Free space in query buffer
  • obl - Output buffer length
  • oll - Output list length (for large responses)
  • omem - Output buffer memory

Flags

  • N - Normal client
  • M - Master (replication)
  • S - Replica (slave)
  • O - MONITOR mode
  • x - Executing MULTI
  • b - Blocked (BRPOP, etc.)
  • P - Pub/Sub subscriber

3. Filtering CLIENT LIST

Filter Options (Redis 6.2+)

# Only normal clients
CLIENT LIST TYPE normal

# Only replica connections
CLIENT LIST TYPE replica

# Only pub/sub clients
CLIENT LIST TYPE pubsub

# Filter by ID
CLIENT LIST ID 3 4 5

4. CLIENT INFO: Current Connection

CLIENT INFO

127.0.0.1:6379> CLIENT INFO
id=3 addr=127.0.0.1:52345 fd=8 name= age=10 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=32742 obl=0 oll=0 omem=0 events=r cmd=client user=default

# Shows info about YOUR connection

5. CLIENT SETNAME: Identify Your Connection

Give your connections meaningful names for easier debugging.

Naming Connections

# Set connection name
CLIENT SETNAME webapp-server-1
OK

# Now in CLIENT LIST:
# ... name=webapp-server-1 ...

# Get current name
CLIENT GETNAME
"webapp-server-1"

# In client libraries
const redis = new Redis({
  name: 'webapp-server-1'  // ioredis
});

Naming Convention

Include service name, server/pod ID, and purpose: webapp-pod-abc123, worker-queue-1, cache-reader-main. When debugging, you'll immediately know which service owns which connection.

6. CLIENT KILL: Disconnect Clients

Forcefully disconnect clients. Use carefully - the client will reconnect if it has retry logic.

CLIENT KILL

# Kill by address
CLIENT KILL ADDR 192.168.1.100:52345
OK

# Kill by client ID
CLIENT KILL ID 3
OK

# Kill by client type
CLIENT KILL TYPE normal  # Disconnect all normal clients
(integer) 5

# Kill clients in specific state
CLIENT KILL TYPE pubsub  # Disconnect all subscribers

# Kill old connections
# (Custom logic - no built-in "older than X")

# Skip yourself (avoid disconnecting your own session)
CLIENT KILL TYPE normal SKIPME yes

When to Kill Clients

Use CLIENT KILL for: stuck clients consuming resources, connections from compromised IPs, cleaning up after a misbehaving service, emergency resource recovery. Clients with proper retry logic will reconnect automatically.

7. Debugging Connection Issues

Find Resource Hogs

# Check for large output buffers (slow consumers)
CLIENT LIST | grep "omem=[1-9]"

# High omem means responses are piling up
# Client isn't reading fast enough

# Check idle connections
CLIENT LIST | grep "idle=[0-9]{4}"  # Idle > 1000s

# Check for too many connections from one IP
CLIENT LIST | cut -d' ' -f2 | cut -d':' -f1-3 | sort | uniq -c | sort -rn

Connection Limits

# Check current count
INFO clients
# connected_clients:42
# blocked_clients:2
# tracking_clients:0

# Check max connections
CONFIG GET maxclients
1) "maxclients"
2) "10000"

# If approaching limit, investigate
CLIENT LIST | wc -l

8. CLIENT PAUSE: Stop Processing

Temporarily stop command processing for all clients. Useful for maintenance windows.

CLIENT PAUSE

# Pause all clients for 5 seconds
CLIENT PAUSE 5000
OK

# Clients' commands will queue, then resume

# Pause only writes (reads still work)
CLIENT PAUSE 5000 WRITE

# Use case: Safe failover
# 1. Pause clients
CLIENT PAUSE 10000 WRITE
# 2. Wait for replication sync
# 3. Promote replica
# 4. Redirect traffic

# Resume early
CLIENT UNPAUSE
OK

9. Output Buffer Limits

Prevent slow clients from consuming all memory. Redis will disconnect clients exceeding these limits.

Configure Limits

# Check current limits
CONFIG GET client-output-buffer-limit
1) "client-output-buffer-limit"
2) "normal 0 0 0 slave 268435456 67108864 60 pubsub 33554432 8388608 60"

# Format: <class> <hard limit> <soft limit> <soft seconds>
# normal: 0 0 0 - no limit for normal clients
# slave: 256MB hard, 64MB soft for 60s
# pubsub: 32MB hard, 8MB soft for 60s

# Set stricter limits
CONFIG SET client-output-buffer-limit "normal 256mb 64mb 60"

# If client exceeds:
# - Hard limit immediately: disconnect
# - Soft limit for X seconds: disconnect

10. CLIENT NO-EVICT

Protect Important Connections

# Mark current connection as protected
CLIENT NO-EVICT ON

# This connection won't be evicted when hitting memory limits
# Use for critical admin connections

# Remove protection
CLIENT NO-EVICT OFF

Quick Reference

CommandPurpose
CLIENT LISTAll connected clients
CLIENT INFOCurrent connection info
CLIENT SETNAMEName your connection
CLIENT GETNAMEGet current name
CLIENT KILLDisconnect a client
CLIENT PAUSEPause command processing
CLIENT UNPAUSEResume processing
CLIENT NO-EVICTProtect connection from eviction

Manage Your Clients

Know what's connecting to your Redis. Monitor and manage clients with Redimo.

Download Redimo - It's Free

Continue Learning

Free Download

Stop Fighting with CLI.
Visualize Your Data.

Redimo makes every Valkey and Redis command easier. Visual data, inline editing, Safe Mode for production.