jim
(jim99)
2019 年8 月 21 日 13:52
1
系统版本:CentOS Linux release 7.6
TiDB 版本:3.0.1
集群节点分布:生产/测试。单机单实例模式-TiDB(3)+ PD(3)+TiKV(3)
问题描述前因后果:
应用使用druid连接池获取数据库连接
尝试过HAProxy,AWS的Elastic Load Balancing
在使用负载均衡对3台tidb server做负载后应用服务器报了很多连接丢失的错误:Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
改用druid直连tidb-server的ip后此报错消失
1 个赞
jim
(jim99)
2019 年8 月 21 日 14:08
3
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
stats socket /var/lib/haproxy/stats
defaults
mode tcp
log global
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 180s
timeout check 30s
maxconn 6000
listen tidb
bind *:4000
log global
mode tcp
balance roundrobin
server tidb-1 172.31.61.204:4000 check inter 2000 rise 2 fall 3
server tidb-2 172.31.61.201:4000 check inter 2000 rise 2 fall 3
server tidb-3 172.31.61.26:4000 check inter 2000 rise 2 fall 3
Lucien
( Lucien)
2021 年3 月 26 日 08:29
4
可以看一下 Haproxy 最佳实践,在 官方文档里面有哈
system
(system)
关闭
2022 年10 月 31 日 19:03
5
此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。