Silver Sky Studio Blog

The dream that I envisioned, I am still hoping to find

曉 龍之介

@曉 龍之介4 months ago

01/25
17:02
已解决的问题&技巧(Resolved Issues&Tips)

[Database] 显示MySQL Server当前所有连接和操作

以root身份登陆数据库

执行:

SHOW FULL PROCESSLIST;

  注意在负载较大的服务器上执行该命令可能会拖慢整个数据库的速度

输出类似如下:

MariaDB [(none)]> SHOW FULL PROCESSLIST;
+------+----------+------------------+----------+---------+------+-------+-----------------------+----------+
| Id | User | Host | db | Command | Time | State | Info | Progress |
+------+----------+------------------+----------+---------+------+-------+-----------------------+----------+
| 4483 | keystone | controller:44798 | keystone | Sleep | 208 | | NULL | 0.000 |
| 4499 | nova | controller:44830 | nova | Sleep | 3 | | NULL | 0.000 |
| 4500 | nova | controller:44832 | nova_api | Sleep | 22 | | NULL | 0.000 |
| 4501 | nova | controller:44834 | nova | Sleep | 4 | | NULL | 0.000 |
| 4502 | nova | controller:44836 | nova | Sleep | 14 | | NULL | 0.000 |
| 4503 | nova | controller:44842 | nova | Sleep | 5 | | NULL | 0.000 |
| 4504 | nova | controller:44844 | nova | Sleep | 16 | | NULL | 0.000 |
| 4505 | nova | controller:44846 | nova | Sleep | 15 | | NULL | 0.000 |
| 4506 | nova | controller:44850 | nova | Sleep | 6 | | NULL | 0.000 |
| 4507 | nova | controller:44856 | nova | Sleep | 19 | | NULL | 0.000 |
| 4508 | nova | controller:44864 | nova | Sleep | 14 | | NULL | 0.000 |
| 4509 | nova | controller:44866 | nova | Sleep | 3 | | NULL | 0.000 |
| 4510 | keystone | controller:44868 | keystone | Sleep | 220 | | NULL | 0.000 |
| 4511 | keystone | controller:44872 | keystone | Sleep | 525 | | NULL | 0.000 |
| 4512 | nova | controller:44874 | nova | Sleep | 14 | | NULL | 0.000 |
| 4513 | nova | controller:44878 | nova | Sleep | 12 | | NULL | 0.000 |
| 4514 | neutron | controller:44880 | neutron | Sleep | 24 | | NULL | 0.000 |
| 4515 | keystone | controller:44884 | keystone | Sleep | 824 | | NULL | 0.000 |
| 4516 | neutron | controller:44888 | neutron | Sleep | 6 | | NULL | 0.000 |
| 4517 | nova | controller:44890 | nova | Sleep | 9 | | NULL | 0.000 |
| 4518 | neutron | controller:44892 | neutron | Sleep | 7 | | NULL | 0.000 |
| 4519 | neutron | controller:44894 | neutron | Sleep | 25 | | NULL | 0.000 |
| 4520 | nova | controller:44896 | nova | Sleep | 6 | | NULL | 0.000 |
| 4521 | nova | controller:44902 | nova | Sleep | 14 | | NULL | 0.000 |
| 4522 | nova | controller:44904 | nova | Sleep | 2 | | NULL | 0.000 |
| 4523 | neutron | controller:44906 | neutron | Sleep | 26 | | NULL | 0.000 |
| 4524 | keystone | controller:44910 | keystone | Sleep | 208 | | NULL | 0.000 |
| 4525 | neutron | controller:44914 | neutron | Sleep | 26 | | NULL | 0.000 |
| 4526 | nova | controller:44916 | nova | Sleep | 4 | | NULL | 0.000 |
| 4527 | nova | controller:44920 | nova | Sleep | 5 | | NULL | 0.000 |
| 4528 | nova | controller:44924 | nova | Sleep | 4 | | NULL | 0.000 |
| 4529 | neutron | controller:44926 | neutron | Sleep | 39 | | NULL | 0.000 |
| 4530 | nova | controller:44928 | nova | Sleep | 16 | | NULL | 0.000 |
| 4531 | nova | controller:44930 | nova | Sleep | 14 | | NULL | 0.000 |
| 4532 | neutron | controller:44936 | neutron | Sleep | 39 | | NULL | 0.000 |
| 4533 | nova | controller:44942 | nova_api | Sleep | 23 | | NULL | 0.000 |
| 4534 | nova | controller:44944 | nova | Sleep | 16 | | NULL | 0.000 |
| 4535 | nova | controller:44946 | nova | Sleep | 3 | | NULL | 0.000 |
| 4536 | nova | controller:44948 | nova | Sleep | 12 | | NULL | 0.000 |
| 4537 | nova | controller:44954 | nova_api | Sleep | 207 | | NULL | 0.000 |
| 4538 | nova | controller:44956 | nova_api | Sleep | 23 | | NULL | 0.000 |
| 4539 | nova | controller:44958 | nova_api | Sleep | 22 | | NULL | 0.000 |
| 4540 | nova | controller:44960 | nova | Sleep | 4 | | NULL | 0.000 |
| 4541 | nova | controller:44962 | nova | Sleep | 4 | | NULL | 0.000 |
| 4542 | nova | controller:44964 | nova | Sleep | 1 | | NULL | 0.000 |
| 4543 | nova | controller:44966 | nova | Sleep | 2 | | NULL | 0.000 |
| 4544 | nova | controller:44968 | nova | Sleep | 19 | | NULL | 0.000 |
| 4545 | nova | controller:44970 | nova | Sleep | 4 | | NULL | 0.000 |
| 4546 | nova | controller:44972 | nova | Sleep | 4 | | NULL | 0.000 |
| 4547 | nova | controller:44974 | nova | Sleep | 13 | | NULL | 0.000 |
| 4548 | nova | controller:44976 | nova | Sleep | 16 | | NULL | 0.000 |
| 4549 | nova | controller:44978 | nova | Sleep | 14 | | NULL | 0.000 |
| 4550 | nova | controller:44980 | nova | Sleep | 15 | | NULL | 0.000 |
| 4552 | nova | controller:44982 | nova | Sleep | 12 | | NULL | 0.000 |
| 4553 | nova | controller:44984 | nova | Sleep | 6 | | NULL | 0.000 |
| 4554 | nova | controller:44986 | nova | Sleep | 13 | | NULL | 0.000 |
| 4555 | nova | controller:44988 | nova | Sleep | 15 | | NULL | 0.000 |
| 4556 | nova | controller:44990 | nova | Sleep | 15 | | NULL | 0.000 |
| 4557 | nova | controller:44992 | nova | Sleep | 5 | | NULL | 0.000 |
| 4558 | nova | controller:44994 | nova | Sleep | 2 | | NULL | 0.000 |
| 4559 | nova | controller:44996 | nova | Sleep | 9 | | NULL | 0.000 |
| 4560 | nova | controller:44998 | nova | Sleep | 4 | | NULL | 0.000 |
| 4561 | nova | controller:45000 | nova | Sleep | 13 | | NULL | 0.000 |
| 4562 | nova | controller:45002 | nova | Sleep | 4 | | NULL | 0.000 |
| 4564 | nova | controller:45004 | nova | Sleep | 14 | | NULL | 0.000 |
| 4565 | root | localhost | NULL | Query | 0 | init | SHOW FULL PROCESSLIST | 0.000 |
| 4566 | nova | controller:45006 | nova | Sleep | 6 | | NULL | 0.000 |
| 4567 | nova | controller:45008 | nova | Sleep | 6 | | NULL | 0.000 |
| 4568 | nova | controller:45010 | nova | Sleep | 5 | | NULL | 0.000 |
+------+----------+------------------+----------+---------+------+-------+-----------------------+----------+
69 rows in set (0.00 sec)

[Database] 显示MySQL Server当前所有连接和操作