mairadb+galera+haproxy+keepalived如何实现mysql负载均衡与高可用
mairadb+galera+haproxy+keepalived如何实现mysql负载均衡与高可用
这篇文章主要介绍了mairadb+galera+haproxy+keepalived如何实现mysql负载均衡与高可用,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
一:服务器资源
Haproxy+keepalived node1 10.116.19.251
Haproxy+keepalived node2 10.44.90.201
mariadb+galera node1 10.44.66.2
mariadb+galera node2 10.116.148.103
mariadb+galera node3 10.170.142.108
二:mariadb 集群安装
请参照上一篇博文,安装成功后,集群中新增haproxy访问用户
mysql -u root -p
CREATE USER 'haproxy'@' 10.116.19.251';
CREATE USER 'haproxy'@' 10.44.90.201';
FLUSH PRIVILEGES;
三:haproxy 安装
sudo yum install haproxy
配置haproxy vi /etc/haproxy/haproxy.cfg
点击(此处)折叠或打开
-
global_defs {
-
lvs_id LBL01
-
}
-
-
vrrp_sync_group SyncGroup01 {
-
group {
-
FloatIP1
-
}
-
}
-
-
vrrp_script check_haproxy {
-
script "killall -0 haproxy"
-
interval 2
-
weight 2
-
}
-
-
vrrp_instance FloatIP1 {
-
state BACKUP
-
interface eth0
-
virtual_router_id 10
-
priority 100
-
advert_int 1
-
virtual_ipaddress {
-
192.168.1.60
-
}
-
track_script {
-
check_haproxy
-
}
-
}
启动keepalived
chkconfig keepalived on
/etc/init.d/keepalived start
感谢你能够认真阅读完这篇文章,希望小编分享的“mairadb+galera+haproxy+keepalived如何实现mysql负载均衡与高可用”这篇文章对大家有帮助,同时也希望大家多多支持高防服务器网,关注高防服务器网行业资讯频道,更多相关知识等着你来学习!
[微信提示:高防服务器能助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。
[图文来源于网络,不代表本站立场,如有侵权,请联系高防服务器网删除]
[