关于haproxy负载均衡的配置问题,急急急

imhanliu 发布于 2016/08/15 17:02
阅读 242
收藏 0

以下是我的配置文件:


global

maxconn 40000
debug
#quiet
chroot      /var/lib/haproxy
pidfile     /var/run/haproxy.pid
user haproxy
group haproxy
nbproc 1
log 127.0.0.1 local0
spread-checks 2


defaults
timeout server 10s
timeout connect 30s
timeout client 60s
timeout http-request 10s
timeout queue 3s
retries 3
option redispatch


frontend db_write
bind 10.104.181.73:3306
default_backend cluster_db_write


frontend db_read
bind 10.104.181.73:3306
default_backend cluster_db_read


frontend web_haproxy_status
bind *:80
default_backend web_status


frontend monitor_mysql113
bind 127.0.0.1:9301
mode http
acl no_repl_mysql113 nbsrv(mysql113_replication) eq 0
acl no_repl_mysql238 nbsrv(mysql238_replication) eq 0
acl no_mysql113 nbsrv(mysql113_status) eq 0
acl no_mysql238 nbsrv(mysql238_status) eq 0
monitor-uri /dbs
monitor fail unless no_repl_mysql113 no_repl_mysql238 no_mysql238
monitor fail if no_mysql113 no_mysql238


frontend monitor_mysql238
bind 127.0.0.1:9302
mode http
acl no_repl_mysql113 nbsrv(mysql113_replication) eq 0
acl no_repl_mysql238 nbsrv(mysql238_replication) eq 0
acl no_mysql113 nbsrv(mysql113_status) eq 0
acl no_mysql238 nbsrv(mysql238_status) eq 0
monitor-uri /dbs
monitor fail unless no_repl_mysql113 no_repl_mysql238 no_mysql113
monitor fail if no_mysql113 no_mysql238


backend mysql113_replication
mode tcp
balance roundrobin
option tcpka
option httpchk
server mysql113 10.104.167.235:3306 check port 9201 inter 1s rise 1 fall 1


backend mysq238_replication
mode tcp
balance roundrobin
option tcpka
option httpchk
server mysql238 10.104.172.90:3306 check port 9201 inter 1s rise 1 fall 1


backend mysql113_status
mode tcp
balance roundrobin
option tcpka
option httpchk
server mysql113 10.104.167.235:3306 check port 9200 inter 1s rise 2 fall 2


backend mysql238_status
mode tcp
balance roundrobin
option tcpka
option httpchk
server mysql238 10.104.172.90:3306 check port 9200 inter 1s rise 2 fall 2


backend cluster_db_write
mode tcp
option tcpka
balance roundrobin
option httpchk GET /dbs
server mysql113 10.104.167.235:3306 weight 1 check port 9201 inter 1s rise 2 fall 1
server mysql238 10.104.172.90:3306 weight 1 check port 9201 inter 1s rise 2 fall 1 backup
server mysql113_backup 10.104.167.235:3306 weight 1 check port 9301 inter 1s rise 2 fall 2 addr 127.0.0.1 backup
server mysql238_backup 10.104.172.90:3306 weight 1 check port 9302 inter 1s rise 2 fall 2 addr 127.0.0.1 backup


backend cluster_db_read
mode tcp
option tcpka
balance roundrobin
option httpchk GET /dbs
server mysql113 10.104.167.235:3306 weight 1 track cluster_db_write/mysql113
server mysql238 10.104.172.90:3306 weight 1 track cluster_db_write/mysql238
server mysql113_backup 10.104.167.235:3306 weight 1 track cluster_db_write/mysql113_backup
server mysql238_backup 10.104.172.90:3306 weight 1 track cluster_db_write/mysql238_backup
server mysql113_splitbrain 10.104.167.235:3306 weight 1 check port 9300 inter 1s rise 1 fall 2 addr 127.0.0.1
server mysql238_splitbrain 10.104.172.90:3306 weight 1 check port 9300 inter 1s rise 1 fall 2 addr 127.0.0.1


backend web_status
mode http
stats enable
#stats scope
#stats hide-version
stats refresh 5s
stats uri /status
stats realm Haproxy/statistics

stats auth lzd:lzd


加载中
返回顶部
顶部