Redis port

Understand redis port | Various ways to check port

Basics of redis

Redis stands for Remote Dictionary Server. Redis is a NO-SQL database that stores data in key-value format. In this blog, we will learn about the redis port. We will also understand how to check and change the redis default port. so let’s get started.

You can also check my below blogs to get familiar with redis.

install Redis using docker

Install redis on centos 7

Install redis on windows

Databases in redis

Mongodb vs redis

what is Redis client

Check redis port

check redis port

There are many ways in which a user can check the port on which the redis is running. By default, the redis runs of port 6379.

1. Check Redis port while connecting to redis

When connecting to redis, usually redis will show you the host and port on which the redis is running.

[email protected]: redis-cli>

From the above command, it is clear that the redis is running on port 6379

2. Check the redis port using CLI

A user can also check the port on which the redis is running using the CLI command.

Type the below command to connect to redis

[email protected]: redis-cli>

Once connected a user can use the CONFIG command to get the port details> CONFIG GET PORT
1) "PORT"
2) "6379"

3. Check the Redis port in the configuration file

All the redis configuration is saved inside a config file called redis.conf. In the network session of redis.conf file a user can find details about the port

check redis port
# Accept connections on the specified port, default is 6379 (IANA #815344).
# If port 0 is specified Redis will not listen on a TCP socket.
port 6379

Change redis port

change redis port

So far we have understood how to check the port in redis. In this session, we will understand how to change the port.

There are many ways using which a user can change the redis port. Some of them are:

1. Change the Redis port using the configuration file

A user can change the port by changing the port in redis.conf file. Let’s say now we want redis to connect to port 6479. So do the following changes in the config file

port 6479

Now restart the redis service

systemctl restart redis

Now while connecting to redis a user needs to specify the custom port. Type the below command to connect to redis

redis-cli -h localhost -p 6479>

2. Change the Redis port using CLI

A user can also change the port in redis by using the CLI command.

First, connect to redis cli using the below command

[email protected]: redis-cli>

Now type the CONFIG SET command to change the redis port to 6479> CONFIG SET port 6479

Verify if the port gets changed> CONFIG GET port 6479
1) "port"
2) "6479"
change redis port

Now exit the redis cli and type the below command to connect to the redis port 6479> exit
[email protected]: redis-cli -h localhost -p 6479


I hope you have liked this tutorial about redis port. Please do let me know if you are facing any issues while following along.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top