Bootstrap

查看Linux环境下MySQL是哪个java进程在链接

首先,在mysql cli中执行如下命令:

MySQL [appcpa_bitmap]> show processlist;
+-----------+--------+--------------------+---------------+---------+-------+-------+------------------+
| Id        | User   | Host               | db            | Command | Time  | State | Info             |
+-----------+--------+--------------------+---------------+---------+-------+-------+------------------+
| 553146774 | appcpa | 172.22.64.14:35771 | appcpa_bitmap | Sleep   | 26882 |       | NULL             |
| 553151683 | appcpa | 172.22.64.22:48545 | appcpa_bitmap | Query   |     0 | init  | show processlist |
+-----------+--------+--------------------+---------------+---------+-------+-------+------------------+

看到是172.22.64.14:35771在链接。

登陆到172.22.64.14上,执行如下命令:

$ lsof -i tcp:35771
COMMAND   PID   USER   FD   TYPE     DEVICE SIZE/OFF NODE NAME
java    16909 hadoop  127u  IPv6 2469044019      0t0  TCP 172.22.64.14:35771->172.22.68.80:mysql (ESTABLISHED)

我们可以看到是java进程,PID为16909

执行 ps -ef | grep 16909 ,查看输出。。看到了。。

;