lsof 安装命令
[sarah@hadoop102 bin]$ sudo yum install -y lsof
如何查看
比如查看8080端口被谁占用了
[sarah@hadoop102 bin]$ lsof -i:8080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 8769 sarah 53u IPv6 7950020 0t0 TCP *:webcache (LISTEN)
可以看到8080端口被8769进程占用了,使用jps看8769属于哪个进程文章来源:https://uudwc.com/A/V6DOz
[sarah@hadoop102 bin]$ jps
8769 QuorumPeerMain
11842 JournalNode
16898 HRegionServer
29706 ConsoleProducer
30094 ConsoleProducer
13329 JobHistoryServer
26068 RunJar
16596 HMaster
23510 NodeManager
23319 ResourceManager
28572 ConsoleConsumer
12062 DFSZKFailoverController
4963 HistoryServer
31075 YarnTaskExecutorRunner
13862 DataNode
15655 MasterServer
13799 NameNode
15912 LoggerServer
27944 Kafka
可以看到进程是zk文章来源地址https://uudwc.com/A/V6DOz