5

这是我的第一个 stackoverflow 帖子,所以我想打个招呼!;)

我对 pgbouncer 有疑问。我刚开始将它与我的 django 应用程序和 postgres 一起使用。我虽然一切都设置正确,但我在日志中只得到这样的信息:

"LOG Stats: 0 req/s, in 0 b/s, out 0 b/s"

它似乎没有运行,还是我错过了它的概念?没有其他错误,除了那些只有 0 的统计行。该应用程序不断运行,每秒有数十人使用它,建立数据库连接,所以应该记录一些内容吧?你知道为什么会发生这种情况吗?谢谢!

4

1 回答 1

2

pgbouncer 在端口 6543 上侦听,而您的 postgres 数据库在端口 5543 上。您的应用程序必须连接到 pgbouncer 而不是 postgres 数据库。

your_app -> pgbouncer -> postgres

只需编辑应用程序配置并添加 pgbouncer 的端口,这里是 6543。当然你/etc/pgbouncer/pgbouncer.ini应该包含 postgres 数据库端口 5543。

您可以在此处找到有用的文档: pgbouncer docu

于 2017-04-21T14:47:13.500 回答