Sql-server – Is it possible to connect to MS SQL server via HAProxy

haproxysql server

I need to be able to connect to MS SQL server hosted on Amazon (RDS, single AZ) via HAProxy. I tried the following configuration (bottom) but MS SQL returned me (although I used valid login and password):

A connection was successfully established with the server, but then an
error occurred during the pre-login handshake. (provider: TCP
Provider, error: 0 – An existing connection was forcibly closed by the
remote host.) (Microsoft SQL Server, Error: 10054)

listen RDS_MSSQL *:1433
    mode tcp
    balance roundrobin
    option log-health-checks
    server legacy xxxx.xxxxxx.us-east-1.rds.amazonaws.com:1433 check port 1433 inter 1000

Best Answer

It is possible. Instead of listen I use a frontend block and a backend block:

frontend tcp-in-mssql
  bind :8800
  mode tcp
  use_backend mssql

backend mssql
  mode tcp
  server mssqlserver 10.10.10.10:1433 check