Limited Time Offer: 40% off

Redis default port

Redis listens on port 6379 by default. Here's how to check it, change it, and connect.

Redis listens on port 6379 by default. This applies to every Redis installation unless the configuration has been changed.

The number has an origin: 6379 corresponds to "MERZ" on a phone keypad, a reference to Alessia Merz, an Italian showgirl mentioned by Redis creator Salvatore Sanfilippo. It stuck as the standard Redis port.

Checking which port Redis is using

Ask the running server directly:

BASH
redis-cli INFO server | grep tcp_port
tcp_port:6379

If you need to check without connecting, use ss or netstat to find the listening port:

BASH
ss -tlnp | grep redis
# or
netstat -tlnp | grep redis

You can also read the port directive from the config file:

BASH
grep "^port" /etc/redis/redis.conf
port 6379

Connecting to a specific port

To connect to Redis on a non-default port, pass -p to redis-cli:

BASH
redis-cli -p 6380

Connection URLs follow the same pattern:

redis://localhost:6380
redis://:yourpassword@10.0.1.5:6380

Many Redis client libraries also read the REDIS_URL environment variable:

BASH
export REDIS_URL="redis://localhost:6380"

Changing the port

Open redis.conf and update the port directive:

port 6380

Then restart Redis:

BASH
sudo systemctl restart redis

To start Redis with a custom port without editing the config file, pass the flag directly:

BASH
redis-server --port 6380

The command-line flag takes precedence over redis.conf.

Running multiple Redis instances

Different ports let you run multiple Redis instances on the same host. A common pattern is one instance for caching and another for queues or sessions:

BASH
redis-server /etc/redis/redis-cache.conf   # port 6379
redis-server /etc/redis/redis-queues.conf  # port 6380

Each config file specifies its own port, logfile, dir, and daemonize settings. This keeps the instances independent and easy to manage separately.

Security

A default Redis install accepts connections from any address. Before exposing Redis to anything outside the local machine, take these steps.

Bind to localhost only. Add this to redis.conf:

bind 127.0.0.1

If you need to allow a specific internal IP, list it explicitly:

bind 127.0.0.1 10.0.1.5

Require a password. Set requirepass in redis.conf:

requirepass a-long-random-string

Never expose port 6379 to the public internet without authentication. Redis is designed for trusted networks. An unauthenticated Redis instance reachable from the internet can be used to read data, write data, or in some configurations gain remote code execution.

TLS. When you need encrypted connections, port 6380 is a common convention for TLS-enabled Redis (Redis 6+). Configure it in redis.conf:

tls-port 6380
tls-cert-file /etc/redis/tls/redis.crt
tls-key-file  /etc/redis/tls/redis.key

Common database ports

DatabaseDefault port
Redis6379
PostgreSQL5432
MySQL3306
MongoDB27017

Quick reference

TaskCommand
Check active portredis-cli INFO server | grep tcp_port
Find port via OSss -tlnp | grep redis
Connect to custom portredis-cli -p 6380
Start with custom portredis-server --port 6380
Set port in configport 6380 in redis.conf
Bind to localhostbind 127.0.0.1 in redis.conf
Require passwordrequirepass <password> in redis.conf