Using haproxy: Difference between revisions

From MiRTA PBX documentation
Jump to navigation Jump to search
(Created page with "Haproxy can add a useful layer, allowing to balance and failover the connection between two mysql servers. This is a client provided configuration file: <tt> # pxdbproxy hapr...")
 
No edit summary
 
Line 2: Line 2:


<tt>
<tt>
# pxdbproxy haproxy config
  # pxdbproxy haproxy config
 
 
global
  global
         log 127.0.0.1 local2
         log 127.0.0.1 local2
         chroot /var/lib/haproxy
         chroot /var/lib/haproxy
Line 13: Line 13:
         daemon
         daemon
         stats socket /var/lib/haproxy/stats
         stats socket /var/lib/haproxy/stats
 
 
defaults
  defaults
         mode tcp
         mode tcp
         log global
         log global
Line 26: Line 26:
         timeout client 10s
         timeout client 10s
         timeout server 10s
         timeout server 10s
 
 
#
  #
# BEGIN local mysql proxy definition
  # BEGIN local mysql proxy definition
 
 
listen mysql-proxy
  listen mysql-proxy
         bind 127.0.0.1:3306
         bind 127.0.0.1:3306
         balance roundrobin
         balance roundrobin

Latest revision as of 15:04, 21 March 2017

Haproxy can add a useful layer, allowing to balance and failover the connection between two mysql servers. This is a client provided configuration file:

 # pxdbproxy haproxy config
 
 global
       log 127.0.0.1 local2
       chroot /var/lib/haproxy
       pidfile /var/run/haproxy.pid
       maxconn 4000
       user haproxy
       group haproxy
       daemon
       stats socket /var/lib/haproxy/stats
 
 defaults
       mode tcp
       log global
       option tcplog
       option dontlognull
       option logasap
       option http-server-close
       option redispatch
       retries 3
       timeout connect 1s
       timeout client 10s
       timeout server 10s
 
 #
 # BEGIN local mysql proxy definition
 
 listen mysql-proxy
       bind 127.0.0.1:3306
       balance roundrobin
       option httpchk
       option tcpka
       default-server port 3307 inter 2s downinter 5s rise 3 fall 2 slowstart 60s
       server pbx-db01 172.24.9.99:3306 check
       server pbx-db02 172.24.9.100:3306 check backup
       timeout client 30m
       timeout server 30m