微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PgBouncer:关闭因为:客户端关闭请求和关闭因为:不干净的服务器

如何解决PgBouncer:关闭因为:客户端关闭请求和关闭因为:不干净的服务器

虽然我的网络应用程序运行良好,并且数据写入数据库没有问题。我查看了 PgBouncer 的日志,它显示了大量的

pgbouncer_1        | 2021-04-13 10:45:47.061 UTC [1] LOG C-0x7f7f368200e0: my_affiliate/write_user@172.24.0.8:39444 closing because: client close request (age=0s)
pgbouncer_1        | 2021-04-13 10:45:47.061 UTC [1] LOG S-0x7f7f36819100: my_affiliate/write_user@172.24.0.11:5432 closing because: unclean server (age=0s)
pgbouncer_1        | 2021-04-13 10:45:50.272 UTC [1] LOG C-0x7f7f368200e0: my_affiliate/write_user@172.24.0.8:39456 login attempt: db=my_affiliate user=write_user tls=no
pgbouncer_1        | 2021-04-13 10:45:50.273 UTC [1] LOG S-0x7f7f36819100: my_affiliate/write_user@172.24.0.11:5432 new connection to server (from 172.24.0.4:34854)
pgbouncer_1        | 2021-04-13 10:45:50.282 UTC [1] LOG C-0x7f7f368200e0: my_affiliate/write_user@172.24.0.8:39456 closing because: client close request (age=0s)
pgbouncer_1        | 2021-04-13 10:45:50.282 UTC [1] LOG S-0x7f7f36819100: my_affiliate/write_user@172.24.0.11:5432 closing because: unclean server (age=0s)
pgbouncer_1        | 2021-04-13 10:45:57.770 UTC [1] LOG C-0x7f7f368200e0: my_affiliate/write_user@172.24.0.8:39672 login attempt: db=my_affiliate user=write_user tls=no
pgbouncer_1        | 2021-04-13 10:45:57.771 UTC [1] LOG S-0x7f7f36819100: my_affiliate/write_user@172.24.0.11:5432 new connection to server (from 172.24.0.4:35070)
pgbouncer_1        | 2021-04-13 10:45:57.781 UTC [1] LOG C-0x7f7f368200e0: my_affiliate/write_user@172.24.0.8:39672 closing because: client close request (age=0s)
pgbouncer_1        | 2021-04-13 10:45:57.781 UTC [1] LOG S-0x7f7f36819100: my_affiliate/write_user@172.24.0.11:5432 closing because: unclean server (age=0s)

我想知道,这是 PgBouncer 的正常情况吗?

我只是在数据库上执行正常的读/写,并进行了适当的连接清理。

conn = None
cursor = None

try:        
    conn = psycopg2.connect(constants.POSTGRES_CONNECTION_STRING)        
    cursor = conn.cursor()
    
    ...
    
    conn.commit()
except Exception as e:
    ...
finally:
    if cursor is not None:
        cursor.close()
    
    if conn is not None:
        conn.close()

我在 docker 中的设置也非常简单。

Dockerfile

FROM edoburu/pgbouncer:1.15.0

copY pgbouncer.ini /etc/pgbouncer/
copY auth_file /etc/pgbouncer/

pgbouncer.ini

**
#pgbouncer.ini
# Description
# Config file is in “ini” format. Section names are between “[” and “]”.
# Lines starting with “;” or “#” are taken as comments and ignored.
# The characters “;” and “#” are not recognized when they appear later in the line.
[databases]
* = host=postgres port=5432
[pgbouncer]
# Generic settings

# Uncomment this if you want loggin.
#- LOGFILE=/var/log/pgbouncer/pgbouncer.log

listen_addr = 0.0.0.0
auth_file = /etc/pgbouncer/auth_file
auth_type = md5
ignore_startup_parameters = extra_float_digits
# Log settings
admin_users = pgbouncer
# Connection sanity checks,timeouts
# TLS settings
# Dangerous timeouts
################## end file ##################

你知道为什么我收到大量的日志消息吗

有任何顾虑吗?

谢谢。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?