To load balance RDBMS like MYSQL and Oracle, you cannot use
http as haproxy protocol.
Therefore you need to change the protocol from http to tcp.
We can do this by changing default mode to tcp.
Or we can mention protocol in frontends and backends like
below,
frontend http-in
bind *:<listening Port> #database listening port
option tcplog
mode tcp
default_backend db_backend
backend db_backend
mode tcp
balance source
server db1 <db server1 IP>:<your port> check #change with your IP and port
server db2 <db server2 IP>:<your port> check #change with your IP and port
listen stats *:8080
stats enable
stats scope http-in
stats scope db_backend
stats uri /haproxy?stats
stats hide-version
stats auth haproxy:stats
That’s all. Now restart haproxy service,
I feel SQL and many other aspects are actually very helpful to provide solutions to many complex IT problems and solutions.
ReplyDeleteSQL Server Load Rest Api
Implementing load balancing for MySQL or Oracle databases is crucial for optimizing performance and ensuring high availability. Explore To Games By distributing queries across multiple servers, it enhances system efficiency.
ReplyDelete