Port 6379 (Redis)

Port 6379 is the default port of Redis, a fast data store that keeps data in memory and is used mainly as a cache, for queues, and for storing sessions…

Key facts

Port
6379
Protocols
TCP
Range
Registered port, 1024-49151
IANA service name
redis

IANA assigns ports in this range to services on request, under RFC 6335.

About port 6379

Port 6379 is the default port of Redis, a fast data store that keeps data in memory and is used mainly as a cache, for queues, and for storing sessions, over TCP.

IANA registers TCP port 6379 for the redis service.

What port 6379 is used for

  • Cache for websites and applications: query and calculation results are stored in memory, so the site serves them faster and puts less load on the database.
  • Sessions: applications store user session data in Redis, even when several application servers work together.
  • Queues and background jobs: applications add jobs to a queue in Redis, and background processes run them.
  • Local connection: when the application and Redis are on the same server, the connection goes through 127.0.0.1 or a local socket file.

Port 6379 in the firewall

According to the Redis documentation, the service is meant to be accessed only by trusted clients, so never open port 6379 to the internet. When the application and Redis are on the same server, keep the port closed in the firewall, and set Redis to listen only on 127.0.0.1 (the bind setting).

When another server needs access, allow it only from that server's IP address, and also set a password or ACL users:

  • UFW: ufw allow from 203.0.113.10 to any port 6379 proto tcp
  • firewalld: firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="203.0.113.10" port port="6379" protocol="tcp" accept'

Risks and security

When Redis runs with the default settings and no password, its built-in Protected Mode makes it answer only connections from the server itself. Alongside limiting network access, a few simple settings complete the protection:

  • Keep Protected Mode on, and don't disable it to allow outside connections.
  • Set up users and permissions with ACL, or at least a long password in the requirepass setting.
  • Use ACL permissions to restrict sensitive commands such as FLUSHALL and CONFIG.
  • Run Redis as a dedicated system user, without root privileges.
  • When the connection crosses a network that isn't private, encrypt it with TLS.

Commands to check and configure

  • ss -tlnp | grep ':6379 '

    Shows which address Redis is listening on: 127.0.0.1 means local access only.

  • redis-cli ping

    Returns PONG when the service is running and responding. When a password is set, add the --askpass option.

  • redis-cli CONFIG GET bind

    Shows the addresses Redis is set to listen on.

  • redis-cli CONFIG GET protected-mode

    Shows whether Protected Mode is on.

  • redis-cli -h 10.0.0.5 -p 6379 --askpass ping

    Tests a connection to a remote Redis server with a password. The password is prompted for separately.

  • ufw allow from 203.0.113.10 to any port 6379 proto tcp

    Allows access to port 6379 only from the given IP address (UFW).

  • firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="203.0.113.10" port port="6379" protocol="tcp" accept'

    Allows access to port 6379 in firewalld only from the given IP address. Then run firewall-cmd --reload.

Port 6379 in the IANA registry

Port Protocol Service IANA registry description
6379 TCP redis An advanced key-value cache and store
6379 UDP Reserved Reserved

Data source: IANA Service Name and Transport Protocol Port Number Registry (opens in a new tab)

Port 6379 FAQ

Do I need to open port 6379 for my site to use Redis?

No, not when the site and Redis are on the same server. In that case, the site connects through 127.0.0.1 or a local socket file, and the port stays closed in the firewall. Open the port only to another server that needs to connect, and only to its IP address.

How does Redis make a site faster?

Redis keeps data in memory, so reading from it is much faster than reading from a regular database. Websites and applications store query and calculation results in it, and serve them to the next visitors without calculating them again.

What is Protected Mode in Redis?

Protected Mode is a built-in protection mechanism in Redis that kicks in when the service listens on all addresses with no password. In this mode, it answers only connections from the server itself, and to connections from other addresses it returns a message explaining how to configure it properly. The right way to allow access from another server is to set a password or ACL users and limit access in the firewall.

Can I run several Redis instances on the same server?

Yes. Each Redis instance listens on its own port, for example 6379 and 6380, with a separate configuration file. This way you can separate, for example, the cache of different sites.

Shopping cart

Your cart is emptyYou can start with one of our popular plans.

Site search

Accessibility

Text size
100%
Accessibility statement