【 TiDB 使用环境】生产环境
【 TiDB 版本】8.1.2
【遇到的问题】:
kettle资源库使用tidb集群,使用keepalived+haproxy后,kettle连接容易断开(数据处理任务因为资源库连接失败而报错),没使用keepalived+haproxy 没出现这种问题(kettle配置没变)
【资源配置】
操作系统:ubuntu24
haproxy配置如下:
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
# See: https://ssl-config.mozilla.org/#server=haproxy&server-version=2.0.3&config=intermediate
ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
listen admin_stats
bind 0.0.0.0:8080
mode http
option httplog
maxconn 10
stats refresh 30s
stats uri /haproxy
stats realm HAProxy
stats auth admin:admin123
stats hide-version
stats admin if TRUE
listen tidb-cluster
bind 0.0.0.0:801
mode tcp
balance leastconn
keepalived配置
global_defs {
router_id HA_TIDB
}
vrrp_instance VI_TIDB {
state BACKUP
interface enp1s0f0
virtual_router_id 173
priority 99
advert_int 1
authentication {
auth_type PASS
auth_pass 1234
}
virtual_ipaddress {
X.X.X.X
}
}
virtual_server XX.XX.XX.XX 4000 {
delay_loop 6
persistence_timeout 50
protocol TCP
real_server X.X.X.X 801 {
weight 1
notify_down /etc/keepalived/stopkeepalived.sh
TCP_CHECK {
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
}