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
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
Find the following line in the configuration file:
Change the port number to your desired value (e.g.,
Save and close the file.
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.