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

配置为 dockerized postgres 时 pgbouncer 无法启动

如何解决配置为 dockerized postgres 时 pgbouncer 无法启动

我是第一次尝试配置 pgbouncer。

我的 postgres 数据库作为容器运行(使用端口 5011)

我的操作系统是 debian 10。

我使用 apt-install 来安装 pgbouncer:

sudo apt-get install pgbouncer

然后可以看到 pgbouncer 状态正常:

# sudo systemctl status pgbouncer
● pgbouncer.service - LSB: start pgbouncer
   Loaded: loaded (/etc/init.d/pgbouncer; generated)
   Active: active (running) since Wed 2021-05-26 16:15:49 IDT; 11min ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 2 (limit: 4915)
   Memory: 2.4M
   CGroup: /system.slice/pgbouncer.service
           └─4392 /usr/sbin/pgbouncer -d /etc/pgbouncer/pgbouncer.ini

我的数据库名为 mydb,postgres 容器运行在 5011 端口,所以我这样配置 /etc/pgbouncer/pgbouncer.ini:

[databases]
octopus-bouncer = host=10.1.1.1 port=5011 user=dbauser dbname=mydb

;; Configuration section
[pgbouncer]
auth_file = userlist.txt

; IP address or * which means all IPs
listen_addr = *
listen_port = 6432

; any,trust,plain,crypt,md5,cert,hba,pam
auth_type = md5
auth_file = /etc/pgbouncer/userlist.txt

; total number of clients that can connect
max_client_conn = 100

; default pool size.  20 is good number when transaction pooling
; is in use,in session pooling it needs to be the number of
; max clients you want to handle at any moment
default_pool_size = 20

我终于把我的用户放到了 /etc/pgbouncer/userlist.txt:

"dbauser" "mypassword"

然后我重新启动了 pgbouncer - 但失败了:

# sudo systemctl restart pgbouncer
Job for pgbouncer.service Failed because the control process exited with error code.
See "systemctl status pgbouncer.service" and "journalctl -xe" for details.

状态仅显示

# sudo systemctl status pgbouncer
● pgbouncer.service - LSB: start pgbouncer
   Loaded: loaded (/etc/init.d/pgbouncer; generated)
   Active: Failed (Result: exit-code) since Wed 2021-05-26 17:04:00 IDT; 2min 3s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 28111 ExecStart=/etc/init.d/pgbouncer start (code=exited,status=1/FAILURE)

May 26 17:04:00 Octopus systemd[1]: Starting LSB: start pgbouncer...
May 26 17:04:00 Octopus pgbouncer[28111]: Starting PgBouncer: pgbouncer Failed!
May 26 17:04:00 Octopus systemd[1]: pgbouncer.service: Control process exited,code=exited,status=1/FAILURE
May 26 17:04:00 Octopus systemd[1]: pgbouncer.service: Failed with result 'exit-code'.
May 26 17:04:00 Octopus systemd[1]: Failed to start LSB: start pgbouncer.

我错过了什么吗? 如何调试问题?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 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”。这是什么意思?