使用haproxy给mail server做负载均衡

来源:互联网 发布:openwrt nginx l2tp 编辑:程序博客网 时间:2024/06/05 17:15

conf文件如下

###########全局配置#########globalchroot /usr/local/haproxydaemonnbproc 1group nobodyuser nobodypidfile /usr/local/haproxy/logs/haproxy.pidulimit-n 65536#spread-checks 5m #stats timeout 5m#stats maxconn 100 ########默认配置############defaultsmode tcp               #默认的模式mode { tcp|http|health },tcp是4层,http是7层,health只会返回OKretries 3              #两次连接失败就认为是服务器不可用,也可以通过后面设置option redispatch      #当serverId对应的服务器挂掉后,强制定向到其他健康的服务器option abortonclose    #当服务器负载很高的时候,自动结束掉当前队列处理比较久的链接maxconn 32000          #默认的最大连接数timeout connect 5000ms #连接超时timeout client 30000ms #客户端超时timeout server 30000ms #服务器超时#timeout check 2000    #心跳检测超时log 127.0.0.1 local0 err #[err warning info debug] ########smtp配置#################listen smtp 192.168.1.68:25# bind 0.0.0.0:25mode tcpbalance roundrobinserver s1 192.168.1.118:25 weight 1 maxconn 10000 check inter 10sserver s2 192.168.1.240:25 weight 1 maxconn 10000 check inter 10s ########pop3配置#################listen pop3 192.168.1.68:110# bind 0.0.0.0:25mode tcpbalance roundrobinserver s1 192.168.1.118:110 weight 1 maxconn 10000 check inter 10sserver s2 192.168.1.240:110 weight 1 maxconn 10000 check inter 10s ########imap配置#################listen imap 192.168.1.68:143# bind 0.0.0.0:25mode tcpbalance roundrobinserver s1 192.168.1.118:143 weight 1 maxconn 10000 check inter 10sserver s2 192.168.1.240:143 weight 1 maxconn 10000 check inter 10s ########统计页面配置########listen admin_stats 192.168.1.68:8099# bind 0.0.0.0:8099 #监听端口mode http         #http的7层模式option httplog    #采用http日志格式#log 127.0.0.1 local0 errmaxconn 5stats refresh 30s #统计页面自动刷新时间stats uri /stats #统计页面urlstats realm XingCloud\ Haproxy #统计页面密码框上提示文本stats auth admin:admin #统计页面用户名和密码设置stats hide-version #隐藏统计页面上HAProxy的版本信息








0 0