Introducing Dragonfly Cloud! Learn More

Question: What is the default port used by Redis?

Answer

By default, Redis uses port 6379 for client connections. If you want to change this port number to a different value, you can modify the port configuration option in the Redis configuration file (redis.conf). Here's a concise guide on how to change the default port:

  1. Open the Redis Configuration File: On Linux systems, use the following command to open the file in the nano text editor:

    sudo nano /etc/redis/redis.conf
    
  2. Locate the Port Configuration Line: Find the line that specifies the port:

    port 6379
    
  3. Modify the Port Number: Change 6379 to your desired port number (e.g., 6380):

    port 6380
    
  4. Save and Exit: Save the changes and close the editor. In nano, you can do this by pressing Ctrl+O to write the changes and Ctrl+X to exit.

  5. Restart the Redis Server: Apply the changes by restarting the Redis server:

    sudo systemctl restart redis
    

After restarting, clients will need to connect using the new port number (6380 in this example).

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Start building today 

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.