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:
If you need to check without connecting, use ss or netstat to find the listening port:
You can also read the port directive from the config file:
Connecting to a specific port
To connect to Redis on a non-default port, pass -p to redis-cli:
Connection URLs follow the same pattern:
Many Redis client libraries also read the REDIS_URL environment variable:
Changing the port
Open redis.conf and update the port directive:
Then restart Redis:
To start Redis with a custom port without editing the config file, pass the flag directly:
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:
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:
If you need to allow a specific internal IP, list it explicitly:
Require a password. Set requirepass in redis.conf:
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:
Common database ports
| Database | Default port |
|---|---|
| Redis | 6379 |
| PostgreSQL | 5432 |
| MySQL | 3306 |
| MongoDB | 27017 |
Quick reference
| Task | Command |
|---|---|
| Check active port | redis-cli INFO server | grep tcp_port |
| Find port via OS | ss -tlnp | grep redis |
| Connect to custom port | redis-cli -p 6380 |
| Start with custom port | redis-server --port 6380 |
| Set port in config | port 6380 in redis.conf |
| Bind to localhost | bind 127.0.0.1 in redis.conf |
| Require password | requirepass <password> in redis.conf |