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:
-
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
-
Locate the Port Configuration Line: Find the line that specifies the port:
port 6379
-
Modify the Port Number: Change
6379
to your desired port number (e.g.,6380
):port 6380
-
Save and Exit: Save the changes and close the editor. In nano, you can do this by pressing
Ctrl+O
to write the changes andCtrl+X
to exit. -
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?
Other Common Redis Questions (and Answers)
Free System Design on AWS E-Book
Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.
Switch & save up to 80%
Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement. Instantly experience up to a 25X boost in performance and 80% reduction in cost