Redis client connecting to a different port

311 views Asked by At

I have launched redis on port 6379. And I connected a redis-cli client to the same port.

But when I run this command:

client list

It shows me the following redis-cli connected:

id=5 addr=IP-MASKED:46604 laddr=IP-MASKED:6379 fd=8 name= age=124 idle=0 flags=N db=0 sub=0 psub=0 ssub=0 multi=-1 qbuf=26 qbuf-free=20448 argv-mem=10 multi-mem=0 rbs=1024 rbp=0 obl=0 oll=0 omem=0 tot-mem=22298 events=r cmd=client|list user=default redir=-1 resp=2

What is port 46604 shown in the addr section? I see 6379 is also list in the laddr section - and that seems to be the port on which Redis is running.

1

There are 1 answers

2
for_stack On BEST ANSWER

addr is the IP & port of the client, and in your case, it's redis-cli. laddr is the local IP & port, on which Redis server binds to.

What is port 46604 shown in the addr section?

This is the port that redis-cli uses to communicate with Redis server.