haproxy(负载均衡,双机热备,fence等相关详细配置)
一、haproxy负载均衡
server1为haproxy主机,server2、server3为haproxy后端负载均衡主机,server4为后续高可用另一台master主机
server1
yum install -y haproxy.x86_64
配置文件
cd /etc/haproxy/
vim haproxy.cfg
60 stats uri /status
61
62 #---------------------------------------------------------------------
63 # main frontend which proxys to the backends
64 #---------------------------------------------------------------------
65 frontend main *:80
66 # acl url_static path_beg -i /static /images /javascript /stylesheets
67 # acl url_static path_end -i .jpg .gif .png .css .js
68
69 # use_backend static if url_static
70 default_backend app
71
72 #---------------------------------------------------------------------
73 # static backend for serving up images, stylesheets and such
74 #---------------------------------------------------------------------
75 #backend static
76 # balance roundrobin
77 # server static 172.25.5.2:80 check
78 #
79 #---------------------------------------------------------------------
80 # round robin balancing between the various backends
81 #---------------------------------------------------------------------
82 backend app
83 balance roundrobin
84 server app1