【发布时间】:2014-05-28 21:38:46
【问题描述】:
我有 HAProxy 路由到 PostgreSQL 机器列表。当主机打开 PostgreSQL 时,我可以使用下面的行成功连接。在所有主机上关闭 PostgreSQL 后,我希望看到来自 HAProxy 的错误消息,类似于“连接被拒绝”的内容,但没有看到任何内容......这是我的示例配置:
global
log 127.0.0.1 local4 debug
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
defaults
mode tcp
log global
option tcplog
option dontlognull
option redispatch
retries 3
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout check 10s
maxconn 3000
frontend cluster01
bind *:33300
mode tcp
option tcplog
default_backend cluster01
backend cluster01
mode tcp
option tcplog
balance roundrobin
server host1 <host ip>:5432 check
server host2 <host ip>:5432 check
这是我正在尝试执行的命令:
psql -U postgres -d <dbname> -p 33300 -h 127.0.0.1
这是“回复”:
psql:
这是系统日志中的条目:
2014-05-28T21:17:15.486474+00:00 localhost.localdomain [info] haproxy[28503]: 127.0.0.1:58014 [28/May/2014:21:16:55.170] cluster01 cluster01/<NOSRV> -1/-1/0 0 SC 0/0/0/0/0 0/0
两个问题:
我的配置是否适合记录错误?
HAProxy 是否支持 TCP 连接的个性化错误消息?我注意到,在特定的 HTTP 响应代码上,HAProxy 支持 errorfile 条目,但我没有看到与 TCP 相关的任何内容......我错了吗?
有任何问题都可以问
【问题讨论】:
标签: postgresql tcp syslog haproxy