Hi,
try removing those two lines from config:
option httpchk
http-check expect status 200

it is postgres (tcp backend), you should not expect http response on health
check.

Kind regards,
Maciej

czw., 22 kwi 2021 o 02:38 thủy bùi <buithuy.13...@gmail.com> napisał(a):

> I have open all port by setting firewall rules, But still get the same
> error
>
> Vào Th 4, 21 thg 4, 2021 lúc 23:01 thủy bùi <buithuy.13...@gmail.com> đã
> viết:
>
>> I have change my configuration to TCP mode as below and restart haproxy
>> but still got the same error:
>> global maxconn 100defaults log global mode tcp retries 2 timeout client
>> 30m timeout connect 4s timeout server 30m timeout check 5slisten stats
>> mode tcp bind *:8009 stats enable stats uri /listen postgres bind *:5000
>> option httpchk http-check expect status 200 default-server inter 3s fall
>> 3 rise 2 on-marked-down shutdown-sessions server
>> postgresql_10.128.0.10_5432 10.128.0.10:5432 maxconn 100 check port 8008
>> server postgresql_10.128.0.11_5432 10.128.0.11:5432 maxconn 100 check
>> port 8008
>>
>> Vào Th 4, 21 thg 4, 2021 vào lúc 22:42 Jarno Huuskonen <
>> jarno.huusko...@uef.fi> đã viết:
>>
>>> Hei,
>>>
>>> On Wed, 2021-04-21 at 16:27 +0100, Andrew Smalley wrote:
>>> > From the look of  your configuration you are using  HTTP Mode, for
>>> > PostgreSQL, you will need a TCP VIP
>>> >
>>> > I noted this because of the HTTP check
>>> >
>>> > try using  "mode tcp"
>>> >
>>>
>>> defaults has mode tcp:
>>>
>>> defaults
>>>     log global
>>>     mode tcp
>>> ...
>>>
>>> -Jarno
>>>
>>> >
>>> > On Wed, 21 Apr 2021 at 16:25, Jarno Huuskonen <jarno.huusko...@uef.fi>
>>> > wrote:
>>> > >
>>> > > Hi,
>>> > >
>>> > > On Wed, 2021-04-21 at 21:55 +0700, thủy bùi wrote:
>>> > > > Dear HAproxy dev,I have install all the requirement of HAproxy
>>> into the
>>> > > > system alongside with patroni and etcd, but finding error while
>>> call
>>> > > > into
>>> > > > port 5000.
>>> > > > The information is provided as below.
>>> > > > Please help me find out the issue.
>>> > > > I have running HAproxy successfully
>>> > > >
>>> > > > But unable to connect to my database throught port 5000
>>> > > >
>>> > > >
>>> > > > psql: error: server closed the connection unexpectedly
>>> > > > This probably means the server terminated abnormally
>>> > > > before or while processing the request.
>>> > > > What is your configuration?
>>> > > >
>>> > > ...
>>> > >
>>> > > Does haproxy run when you run it from cli
>>> > > (haproxy -d -f /path/to/yourconfig.cfg) ?
>>> > >
>>> > > And do you have errors in your logs ?
>>> > >
>>> > > > Linux postgre02 3.10.0-1160.21.1.el7.x86_64 #1 SMP Tue Mar 16
>>> 18:28:22
>>> > > > UTC
>>> > > > 2021 x86_64 x86_64 x86_64 GNU/Linux
>>> > >
>>> > > Looks like you're running on CentOS/RHEL 7 ? Do you have selinux
>>> enabled
>>> > > (getenforce) ? You'll probably need to allow haproxy to connect to
>>> all
>>> > > ports
>>> > > (or allow required ports). (setsebool -P haproxy_connect_any=On might
>>> > > help).
>>> > >
>>> > > (Your logs should show if connections are denied).
>>> > >
>>> > > -Jarno
>>> > >
>>> > > --
>>> > > Jarno Huuskonen
>>>
>>>
>>
>> --
>> *BUI THANH THUY*
>> Tel: 0348672994
>> Email: buithuy.13...@gmail.com
>>
> --
> *BUI THANH THUY*
> Tel: 0348672994
> Email: buithuy.13...@gmail.com
>

Reply via email to