reverse proxy to postgresql with haproxy

From: Aviel Buskila <aviel33(at)gmail(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: reverse proxy to postgresql with haproxy
Date: 2016-02-04 08:56:16
Message-ID: CAB3=tTE1sEMaCK9m=YLmrHFy06U04yBEZxCe99aemrDAUACfKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey everyone,
I am trying to configure reverse proxy to postgresql using haproxy, for
this example I have the following architecture:
- node1
- node2
- haproxysrv

Streaming replication between node1 and node2 and auto failover with repmgr.

When I issue a connection to haproxysrv to connect, I get a pg_hba.conf
error telling that I haven't configured the haproxysrv to connect to the
database.

The reason that this scenario occurs is that:
HAProxy establishes 2 separate connections, 1 between the client and
haproxy and one between haproxy and postgresql. the connection made haproxy
haproxy and postgresql contains source ip of the haproxy itself.

HAProxy offers a "transparent" ip using proxy protocol.

According to haproxy docs and forums this feature is feasible only if the
application is proxy protocol aware.

My question are:
1. is there any other solution for this issue?
2. is there anyone who knows if postgresql is proxy protocol aware?

Best regards,
Aviel B.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message arnaud gaboury 2016-02-04 09:28:44 Re: query from two tables & concat the result
Previous Message Adrian Klaver 2016-02-04 01:41:55 Re: Fatal error when not numeric value - PostgreSQL 9.2