Redis数据库查看连接的客户端

1
2
3
4
5
[root@VM_8_24_centos ~]# redis-cli -h 10.0.4.6 -a yourpassword
10.0.4.6:6379> client list
addr=100.120.205.19:1024 fd=9 cmd=client age=3 idle=0 proxy=33c6e51a9cc4771fb5836880f86a860f
10.0.4.6:6379> exit
[root@VM_8_24_centos ~]#

Myslq数据库查看连接的客户端

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@VM_8_24_centos ~]# mysql -uroot -h 10.0.4.3 -pyourpassword
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 38411
Server version: 5.6.28-cdb2016-log 20180130

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> SELECT substring_index(host, ':',1) AS host_name,state,count(*) FROM information_schema.processlist GROUP BY state,host_name;
+-----------+------------------------------------------------------------------+----------+
| host_name | state | count(*) |
+-----------+------------------------------------------------------------------+----------+
| | | 2 |
| 10.2.8.24 | executing | 1 |
| | Master has sent all binlog to slave; waiting for binlog to be up | 1 |
+-----------+------------------------------------------------------------------+----------+
3 rows in set (0.00 sec)

MySQL [(none)]> exit
Bye
[root@VM_8_24_centos ~]#

PostgreSQL查看连接的客户端

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[root@VM_8_24_centos ~]# psql -h 10.0.4.5 -U postgresadmin -d postgres
Password for user postgresadmin:
psql (9.2.24, server 9.5.4)
WARNING: psql version 9.2, server version 9.5.
Some psql features might not work.
Type "help" for help.

postgres=> select * from pg_stat_activity;
datid | datname | pid | usesysid | usename | application_name | client_addr | client_hostname | client_port | backend_
start | xact_start | query_start | state_change | waiting | state | back
end_xid | backend_xmin | query
-------+----------+-------+----------+---------------+------------------+-------------+-----------------+-------------+----------------
--------------+-------------------------------+-------------------------------+-------------------------------+---------+--------+-----
--------+--------------+---------------------------------
13295 | postgres | 37774 | 10 | postgres | | | | |
| | | | | |
| | <insufficient privilege>
13295 | postgres | 16485 | 10 | postgres | | | | |
| | | | | | |
| <insufficient privilege>
13295 | postgres | 16539 | 16384 | postgresadmin | psql | 10.2.8.24 | | 56434 | 2019-03-21 10:28:44.
91409+08 | 2019-03-21 10:28:58.604402+08 | 2019-03-21 10:28:58.604402+08 | 2019-03-21 10:28:58.604405+08 | f | active | |
1837 | select * from pg_stat_activity;
(3 rows)

postgres-> \q
[root@VM_8_24_centos ~]#