首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >HAproxy与MySQL母版-主复制非常慢

HAproxy与MySQL母版-主复制非常慢
EN

Server Fault用户
提问于 2012-06-25 20:48:55
回答 1查看 2.4K关注 0票数 3

我有两个多主模式的MySQL服务器,带有一个HAproxy机器,用于简单的负载平衡/冗余。当我直接连接到其中一台服务器并尝试更新大约100,000条条目时,它将在半分钟内完成,包括复制。当通过代理连接时,通常需要超过三分钟。有这种延迟是正常的吗?我的代理配置是否有问题(包括下面的内容)?这变得非常令人沮丧,因为我认为代理会实现某种负载平衡,或者至少没有多少开销。

代码语言:javascript
运行
复制
#---------------------------------------------------------------------
# Example configuration for a possible web application.  See the
# full configuration options online.
#
#   http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
# to have these messages end up in /var/log/haproxy.log you will
# need to:
#
# 1) configure syslog to accept network log events.  This is done
#    by adding the '-r' option to the SYSLOGD_OPTIONS in
#    /etc/sysconfig/syslog
#
# 2) configure local2 events to go to the /var/log/haproxy.log
#   file. A line like the following can be added to
#   /etc/sysconfig/syslog
#
#    local2.*                       /var/log/haproxy.log
#
log         127.0.0.1 local2

#    chroot      /var/lib/haproxy
#    pidfile     /var/run/haproxy.pid
maxconn     4096
user        haproxy
group       haproxy
daemon
#debug
#quiet


# turn on stats unix socket
stats socket /var/lib/haproxy/stats

#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode                    tcp
log                     global
#option                  tcplog
option                  dontlognull
option                  tcp-smart-accept
option                  tcp-smart-connect
#option http-server-close
#option forwardfor       except 127.0.0.0/8
#option                  redispatch
retries                 3
#timeout http-request    10s
#timeout queue           1m
timeout connect         400
timeout client          500
timeout server          300
#timeout http-keep-alive 10s
#timeout check           10s
maxconn                 2000

listen mysql-cluster 0.0.0.0:3306
    mode tcp
    balance roundrobin
    option tcpka
    option httpchk

server db01 192.168.15.118:3306 weight 1 inter 1s rise 1 fall 1
server db02 192.168.15.119:3306 weight 1 inter 1s rise 1 fall 1
EN

回答 1

Server Fault用户

回答已采纳

发布于 2012-06-27 00:25:43

事实上,每次更新都要连接一次,这意味着每个连接都有一定的开销。很多更新都是在很多连接上加起来的。如果可以的话,试着对更新进行批次。或者,因为它是主/母节点,所以只需选择一个节点并将更新推到那里。

票数 3
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/402146

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档