Migrate to RunxBuild and earn up to $50 in hosting credit on your first deposit.

Calculate your savings
unxBuild

redis-cli: Connect, Monitor, and Cluster Mode

Sean

Platform Writer

Jul 05, 2026
5 min read

redis-cli is the Redis command-line client per the Redis docs. Connects to localhost:6379 by default, supports cluster mode with -c, has interactive mode and scripting. The team that uses redis-cli has direct access to inspect, debug, and script Redis operations.

redis-cli: Connect, Monitor, and Cluster Mode

Table of contents

Basic connection

redis-cli
# Connects to localhost:6379

With options:

redis-cli -h redis.example.com -p 6380 -a mypassword
redis-cli -u redis://user:pass@host:6379

The team that uses -h -p -a or -u has the right connection for the environment.

Interactive mode

redis-cli
127.0.0.1:6379> SET foo bar
OK
127.0.0.1:6379> GET foo
"bar"
127.0.0.1:6379> INCR counter
(integer) 1
127.0.0.1:6379> exit

The team that uses interactive mode has REPL-style exploration.

Pipeline mode

Send multiple commands at once:

echo -e "SET k1 v1\nSET k2 v2\nGET k1\nGET k2" | redis-cli

Or use --pipe for large inserts:

cat data.txt | redis-cli --pipe

The team that uses pipelining has fast bulk operations.

Cluster mode (-c)

redis-cli -c -h cluster.example.com -p 6379

The -c flag enables cluster mode - automatic redirection to the right node based on hash slot. The team that uses cluster mode has transparent multi-node access.

MONITOR for live traffic

redis-cli MONITOR

Shows every command hitting Redis in real-time. The team that uses MONITOR for short periods has visibility into Redis traffic. WARNING: MONITOR is expensive on production - use for short debug sessions only.

SCAN for keys

redis-cli --scan
# or with pattern
redis-cli --scan --pattern 'user:*'

SCAN is the safe alternative to KEYS (which blocks Redis on large databases). The team that uses SCAN has non-blocking key iteration.

INFO for stats

redis-cli INFO
redis-cli INFO memory
redis-cli INFO replication

Shows Redis server stats. The team that uses INFO has visibility into memory, replication, clients, etc.

Connection options

  • -h HOST: hostname (default localhost).
  • -p PORT: port (default 6379).
  • -a PASSWORD: password (warning: visible in shell history).
  • -u URI: full URI.
  • -n DB: database number (default 0).
  • --tls: use TLS.
  • --no-auth-warning: suppress auth warning.

FAQ

What’s the default Redis port?

Can I use redis-cli with TLS?

Yes - --tls flag (Redis 6+). The team that uses TLS for Redis in production has encrypted connections.

How do I run redis-cli from a script?

Use -e for one command: redis-cli SET key value. Or pipe commands. The team that scripts Redis has the right ergonomics.

What’s the difference between redis-cli and mongosh/psql?

redis-cli is to Redis as psql is to Postgres, mongosh is to MongoDB. Each is the official CLI for its database.

Can I monitor specific commands only?

No - MONITOR shows all. The team that uses MONITOR for short debug sessions has visibility; the team that runs it for hours has performance issues.

If you are sizing the infrastructure for the kind of project this post covers, the RunxBuild hosting calculator is the right place to model the line items. The compute, the memory, the storage, the bandwidth, the database - each one is a separate number, and the team’s mental model for the platform is the sum of those numbers. The RunxBuild dashboard is where the team sees the actual usage in one place.

Useful related references:

#redis#cli#redis-cli#dev-infra