如何解决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 举报,一经查实,本站将立刻删除。