本篇內(nèi)容主要講解“PostgreSQL 12在日志記錄上的改進(jìn)是什么”,感興趣的朋友不妨來(lái)看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來(lái)帶大家學(xué)習(xí)“PostgreSQL 12在日志記錄上的改進(jìn)是什么”吧!
創(chuàng)新互聯(lián)于2013年成立,先為班瑪?shù)确?wù)建站,班瑪?shù)鹊仄髽I(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為班瑪企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問(wèn)題。
對(duì)于每一個(gè)客戶端連接,PG都會(huì)請(qǐng)求Postmaster,然后fork一個(gè)后臺(tái)進(jìn)程來(lái)處理請(qǐng)求,Postmaster期望每一個(gè)客戶端請(qǐng)求發(fā)送startup message給PG Server,startup packet中的信息用于配置fork的后臺(tái)進(jìn)程。對(duì)于端口掃描、HA解決方案中的心跳檢測(cè)等等都會(huì)發(fā)請(qǐng)求給PG Server port,PG會(huì)啟動(dòng)進(jìn)程來(lái)處理這些連接,但安全檢測(cè)、HA腳本等不同于常規(guī)的客戶端,對(duì)于這些請(qǐng)求,PG會(huì)產(chǎn)生一條日志條目,因此會(huì)造成日志文件的膨脹而導(dǎo)致不必要的IO開銷。
PG 11
使用工具nc來(lái)訪問(wèn)數(shù)據(jù)庫(kù)端口,日志中會(huì)產(chǎn)生無(wú)用的日志條目。
[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. ...
數(shù)據(jù)庫(kù)日志輸出
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",,,,,,,,,"" ...
這些日志其實(shí)是無(wú)用的日志信息,可以不作記錄。
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 ~]$ ...
數(shù)據(jù)庫(kù)日志信息,相對(duì)于PG 11,沒(méi)有出現(xiàn)無(wú)用的日志信息
[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".
到此,相信大家對(duì)“PostgreSQL 12在日志記錄上的改進(jìn)是什么”有了更深的了解,不妨來(lái)實(shí)際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
網(wǎng)站標(biāo)題:PostgreSQL12在日志記錄上的改進(jìn)是什么
當(dāng)前網(wǎng)址:http://www.rwnh.cn/article14/gopgge.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、響應(yīng)式網(wǎng)站、網(wǎng)站營(yíng)銷、網(wǎng)站設(shè)計(jì)、云服務(wù)器、網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)