HAProxy load balancing proxy

1. Install yum -y install haproxy
2. Under the configuration file /etc/haproxy

global

log 127.0.0.1 local2 #Log definition level
chroot /var/lib/haproxy #Current working directory
pidfile /var/run/haproxy.pid #Process id
maxconn 4000 #Maximum number of connections
daemon #Background form running
stats socket /var/lib/ haproxy/stats mode 600 level admin # The level is admin, otherwise when using socat, you will be prompted for permission denial
defaults
mode tcp #haproxy operating mode (http | tcp | health)
log global
option dontlognull
option redispatch #After the server corresponding to serverId hangs, force Direct to other healthy servers
option tcp-smart-accept
option tcp-smart-connect
retries 3 #If the connection fails three times, the server does not need to
timeout http-request 15s
timeout queue 5m
timeout connect 10s #Connection
timeout timeout client 480m #Client timeout
timeout server 480m #Server timeout
timeout http-keep-alive 10s
timeout check 10s #Heartbeat detection
maxconn 900 #Maximum number of connections

listen stats #Configure the haproxy status page (the page used to view)
mode http
bind:8888 #The listening port of the web front-end monitoring page
stats enable

Guess you like

Origin blog.csdn.net/keepandkeep/article/details/132365961