判断PostgreSQL客户端(local)连接用的是哪种协议

[root@dbserver tmp]# netstat -nap |grep postgres
tcp        0      0 0.0.0.0:7432            0.0.0.0:*               LISTEN      64287/postgres      
tcp6       0      0 :::7432                 :::*                    LISTEN      64287/postgres      
udp6       0      0 ::1:61020               ::1:61020               ESTABLISHED 64287/postgres      
unix  2      [ ACC ]     STREAM     LISTENING     491548   64287/postgres       /tmp/.s.PGSQL.7432
unix  3      [ ]         STREAM     CONNECTED     514748   74729/postgres: pg1  /tmp/.s.PGSQL.7432  --->>注意此处74729号进程。
[root@dbserver tmp]# ps -ef |grep postgres
pg12bt2   64287      1  0 18:33 ?        00:00:00 /home/pg12bt2/pg12bt2bin/bin/postgres
pg12bt2   64292  64287  0 18:33 ?        00:00:00 postgres: checkpointer   
pg12bt2   64293  64287  0 18:33 ?        00:00:00 postgres: background writer   
pg12bt2   64294  64287  0 18:33 ?        00:00:00 postgres: walwriter   
pg12bt2   64295  64287  0 18:33 ?        00:00:00 postgres: autovacuum launcher   
pg12bt2   64296  64287  0 18:33 ?        00:00:00 postgres: stats collector   
pg12bt2   64297  64287  0 18:33 ?        00:00:00 postgres: logical replication launcher  
pg12bt2   74728  74686  0 21:19 pts/0    00:00:00 psql -d postgres
pg12bt2   74729  64287  0 21:19 ?        00:00:00 postgres: pg12bt2 postgres [local] idle   --->>注意此处74729号进程。
root      82998  74746  0 23:38 pts/4    00:00:00 grep --color=auto postgres
[root@dbserver tmp]#

参考:
https://access.redhat.com/solutions/442393

The -nap options are a very useful combination to see All connections (local socket and tcp/udp), 
the PID/Program name, and Numeric address instead of DNS name. 
Looking up network names slows the query considerably, particularly if there are problems with DNS. 
The options -t and -u can be used instead of -a to view only TCP and/or UDP connections.

These options are explained from the man page (man netstat) as:

--numeric , -n
    Show numerical addresses instead of trying to determine symbolic host, port or user names.
-a, --all
    Show both listening and non-listening (for TCP this means established connections) sockets.  
    With the --interfaces option, show interfaces that  are  not up
-p, --program
    Show the PID and name of the program to which each socket belongs.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值