Question: What is the default port used by Redis?


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 an example of how to change the default port to 6380:

  1. Open the Redis configuration file using your preferred text editor. On Linux systems, you can use the following command to open the file in the nano text editor:

    sudo nano /etc/redis/redis.conf
  2. Find the following line in the configuration file:

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

    port 6380
  4. Save and close the file.

  5. Restart the Redis server to apply the changes:

    sudo systemctl restart redis

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

Was this content helpful?

Start building today

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