重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
本篇内容主要讲解“PostgreSQL 12在日志记录上的改进是什么”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“PostgreSQL 12在日志记录上的改进是什么”吧!
公司主营业务:成都做网站、成都网站设计、移动网站开发等业务。帮助企业客户真正实现互联网宣传,提高企业的竞争能力。创新互联建站是一支青春激扬、勤奋敬业、活力青春激扬、勤奋敬业、活力澎湃、和谐高效的团队。公司秉承以“开放、自由、严谨、自律”为核心的企业文化,感谢他们对我们的高要求,感谢他们从不同领域给我们带来的挑战,让我们激情的团队有机会用头脑与智慧不断的给客户带来惊喜。创新互联建站推出神农架林区免费做网站回馈大家。对于每一个客户端连接,PG都会请求Postmaster,然后fork一个后台进程来处理请求,Postmaster期望每一个客户端请求发送startup message给PG Server,startup packet中的信息用于配置fork的后台进程。对于端口扫描、HA解决方案中的心跳检测等等都会发请求给PG Server port,PG会启动进程来处理这些连接,但安全检测、HA脚本等不同于常规的客户端,对于这些请求,PG会产生一条日志条目,因此会造成日志文件的膨胀而导致不必要的IO开销。
PG 11
使用工具nc来访问数据库端口,日志中会产生无用的日志条目。
[xdb@localhost ~]$ psql -c 'select version();' Timing is on. Expanded display is used automatically. version --------------------------------------------------------------------------------------------------------- PostgreSQL 11.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16), 64-bit (1 row) Time: 56.253 ms [xdb@localhost ~]$ [xdb@localhost ~]$ for i in {1..100}; do nc -zv localhost 5110 ; done Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds. Ncat: Version 7.50 ( https://nmap.org/ncat ) Ncat: Connected to ::1:5110. Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds. Ncat: Version 7.50 ( https://nmap.org/ncat ) Ncat: Connected to ::1:5110. Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds. Ncat: Version 7.50 ( https://nmap.org/ncat ) Ncat: Connected to ::1:5110. Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds. Ncat: Version 7.50 ( https://nmap.org/ncat ) Ncat: Connected to ::1:5110. Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds. ...
数据库日志输出
2019-12-09 14:35:55.468 CST,,,16065,"::1:57554",5dedeb4b.3ec1,1,"",2019-12-09 14:35:55 CST,,0,LOG,08P01,"incomplete startup packet",,,,,,,,,"" 2019-12-09 14:35:55.479 CST,,,16067,"::1:57556",5dedeb4b.3ec3,1,"",2019-12-09 14:35:55 CST,,0,LOG,08P01,"incomplete startup packet",,,,,,,,,"" 2019-12-09 14:35:55.490 CST,,,16069,"::1:57558",5dedeb4b.3ec5,1,"",2019-12-09 14:35:55 CST,,0,LOG,08P01,"incomplete startup packet",,,,,,,,,"" 2019-12-09 14:35:55.503 CST,,,16071,"::1:57560",5dedeb4b.3ec7,1,"",2019-12-09 14:35:55 CST,,0,LOG,08P01,"incomplete startup packet",,,,,,,,,"" 2019-12-09 14:35:55.513 CST,,,16073,"::1:57562",5dedeb4b.3ec9,1,"",2019-12-09 14:35:55 CST,,0,LOG,08P01,"incomplete startup packet",,,,,,,,,"" ...
这些日志其实是无用的日志信息,可以不作记录。
PG 12
[xdb@localhost ~]$ psql -h localhost -p 5120 -U pg12 -c 'select version();' Timing is on. Expanded display is used automatically. version --------------------------------------------------------------------------------------------------------- PostgreSQL 12.1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16), 64-bit (1 row) Time: 60.207 ms [xdb@localhost ~]$ [xdb@localhost ~]$ for i in {1..100}; do nc -zv localhost 5120 ; done Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds. Ncat: Version 7.50 ( https://nmap.org/ncat ) Ncat: Connected to ::1:5120. Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds. Ncat: Version 7.50 ( https://nmap.org/ncat ) Ncat: Connected to ::1:5120. Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds. Ncat: Version 7.50 ( https://nmap.org/ncat ) Ncat: Connected to ::1:5120. Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds. Ncat: Version 7.50 ( https://nmap.org/ncat ) Ncat: Connected to ::1:5120. Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds. Ncat: Version 7.50 ( https://nmap.org/ncat ) Ncat: Connected to ::1:5120. Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds. [xdb@localhost ~]$ ...
数据库日志信息,相对于PG 11,没有出现无用的日志信息
[pg12@localhost ~]$ tail -f $PGDATA/pg_log/postgresql-2019-12-09.log 2019-12-09 14:18:59.317 CST [1813] LOG: ending log output to stderr 2019-12-09 14:18:59.317 CST [1813] HINT: Future log output will go to log destination "csvlog".
到此,相信大家对“PostgreSQL 12在日志记录上的改进是什么”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!