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)
- How to start Redis server?
- Is Redis persistent?
- How fast is Redis?
- How to install Redis on Mac?
- How to check if Redis is running?
- How to restart Redis?
- Does Redis persist data?
- How to install Redis on Ubuntu?
- How to stop Redis server?
- How to see Redis version?
- Does Redis have tables?
- How long does Redis store data?
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