pgReplicationTutorial icon indicating copy to clipboard operation
pgReplicationTutorial copied to clipboard

What if...

Open blaggacao opened this issue 7 years ago • 7 comments

...someone would try to do a sleak and compliant postgres query loadbalancer in lua for haproxy?

https://www.arpalert.org/haproxy-lua.html

I mean is this not the natural thing to do to replace bgbouncer / pgpool and all the other tools?

Nice side effect: haproxy happens to be the lb of choice of many orchestration frameworks under the hood, like rancher and I believe docker swarm and kubernetes also work atop of haproxy or can be configured that way...

Not sure if this is insane or just nobody has asked this question, so far...

blaggacao avatar Jan 26 '18 20:01 blaggacao

Someone has already played arround with postgres and lua: https://github.com/norman/lua-postgres

blaggacao avatar Jan 26 '18 20:01 blaggacao

postgres marries haproxy -> haprosql :smile:

blaggacao avatar Jan 26 '18 20:01 blaggacao

/cc @CyberDem0n @alexeyklyukin @feikesteenbergen

blaggacao avatar Jan 26 '18 20:01 blaggacao

@jirutka, You might be probably the expert on this having contributed repmgr package to alpine linux and having some lua repos on your github...

blaggacao avatar Jan 30 '18 18:01 blaggacao

@blaggacao do I understand correctly that you want to parse sql statements and route them to the primary or replica, depending on what kind of statement you've got?

CyberDem0n avatar Jan 30 '18 19:01 CyberDem0n

@CyberDem0n That's been more or less the idea... :smile: Additionally to something that does connection pooling directly on a haproxy...

blaggacao avatar Jan 30 '18 20:01 blaggacao

... once there, failover would only be a stone's throw away.

blaggacao avatar Jan 30 '18 21:01 blaggacao