HAProxy as Proxy SQL (query restriction)



I am using memsql community version which doesn’t provide user role management i.e. all user can perform any operation which is dangerous. I want to use HAProxy in such a way that if it sees any modify database operation like delete, drop, update etc then drop the request otherwise send operation to memsql.

Is it possible?

I also want to know if it’s possible to deploy HAProxy in high availability mode (something like a cluster) i.e. if any HAProxy machine goes down, a user can still communicate with server with another running instance of HAProxy without any downtime/code change?


Regarding the first question: No. This would require actually parsing and understanding the protocol. which haproxy does not do.

Regarding HA: yes, you can deploy two haproxy instances and use something like keepalived, corosync or pacemaker (I’m not sure which one is most suitable for this). You’d have to do your own digging about this though.