如何解释 lsof 结果名称列下的端口映射字符串?

如何解释 lsof 结果名称列下的端口映射字符串?

我有以下输出lsof -i:portnumber

[ztao@MongoDB ~]$ lsof -i:6379
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
redis-ser 5341 ztao    4u  IPv6  23457      0t0  TCP *:6379 (LISTEN)
redis-ser 5341 ztao    5u  IPv4  23459      0t0  TCP *:6379 (LISTEN)
redis-ser 5341 ztao    6u  IPv4  23533      0t0  TCP localhost:6379->localhost:6633 (ESTABLISHED)
redis-ser 5341 ztao    7u  IPv4  23535      0t0  TCP localhost:6379->localhost:6634 (ESTABLISHED)
redis-ser 5341 ztao    8u  IPv4  23538      0t0  TCP localhost:6379->localhost:6635 (ESTABLISHED)
redis-ser 5341 ztao    9u  IPv4  23540      0t0  TCP localhost:6379->localhost:6636 (ESTABLISHED)
redis-ser 5341 ztao   10u  IPv4  23839      0t0  TCP localhost:6379->localhost:6747 (ESTABLISHED)
redis-ser 5341 ztao   11u  IPv4  23842      0t0  TCP localhost:6379->localhost:6748 (ESTABLISHED)
newsProvi 5349 ztao    6u  IPv4  23530      0t0  TCP localhost:6633->localhost:6379 (ESTABLISHED)
newsProvi 5349 ztao    7u  IPv4  23532      0t0  TCP localhost:6634->localhost:6379 (ESTABLISHED)
newsProvi 5349 ztao    8u  IPv4  23536      0t0  TCP localhost:6635->localhost:6379 (ESTABLISHED)
newsProvi 5349 ztao    9u  IPv4  23539      0t0  TCP localhost:6636->localhost:6379 (ESTABLISHED)
newsDistr 5456 ztao   12u  IPv4  23838      0t0  TCP localhost:6747->localhost:6379 (ESTABLISHED)
newsDistr 5456 ztao   13u  IPv4  23841      0t0  TCP localhost:6748->localhost:6379 (ESTABLISHED)

我无法理解这 localhost:6379->localhost:6633 (ESTABLISHED)意味着什么。我尝试搜索但找不到答案。这肯定是一些非常基础的知识,但我是新人,我不知道。有什么帮助吗?

答案1

localhost:6379->localhost:6633 (ESTABLISHED)localhost表示的端口 6379 和 6633之间已建立连接。 (“Established”是TCP/IP 状态机中的状态;其他协议也有类似的状态。)

箭头并不代表通信的方向;它反映的是端口的所有权。箭头左侧是属于所列进程 (Redis) 的端口,箭头右侧是属于连接远端的端口。

由于连接的两端都是本地的,因此您可以看到连接的另一端:

newsProvi 5349 ztao    6u  IPv4  23530      0t0  TCP localhost:6633->localhost:6379 (ESTABLISHED)

相关内容