Mysql Redis PostgreSQL数据库查看客户端连接

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

[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数据库查看连接的客户端

[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查看连接的客户端

[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 ~]# 

转载于:https://blog.51cto.com/jerrymin/2366480

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值