问题描述
虽然我的网络应用程序运行良好,并且数据写入数据库没有问题。我查看了 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 (将#修改为@)