当前位置>主页 > 期刊在线 > 信息技术 >

信息技术22年11期

基于 Keepalived 和 Mycat 的 MySQL 数据库高 可用性设计与实现
廖卓,姚敏,余筱,黄俊铭
(中移互联网有限公司,广东 广州 510640)

摘  要:为实现移动认证平台 MySQL 数据库主从架构的故障自动切换,提升系统恢复效率,设计了一套基于 Keepalived 和 Mycat的数据库高可用方案。该方案的核心思想是通过独立的健康检测程序探测数据库运行状态,当策略判断主用数据库异常时,通过控制Keepalived 切换虚拟 IP 来实现代理 Mycat 的主备切换,从而实现数据库切换。实验结果表明该方案可有效降低数据库故障切换时间。


关键词:MySQL 数据库;Keepalived;Mycat;高可用;故障切换



DOI:10.19850/j.cnki.2096-4706.2022.011.007


中图分类号:TP311                                          文献标识码:A                                 文章编号:2096-4706(2022)11-0027-04


Design and Implementation of High Availability of MySQL Database Based on Keepalived and Mycat

LIAO Zhuo, YAO Min, YU Xiao, HUANG Junming

(China Mobile Internet Co., Ltd., Guangzhou 510640, China)

Abstract: In order to realize the automatic failover of MySQL database master-slave architecture and improve the system recovery efficiency, a set of database high availability scheme based on Keepalived and Mycat is designed. The core idea of this scheme is to detect the running state of the database through an independent health detection program. When the strategy judges that the main database is abnormal, it realizes the master and standby switching of the agent Mycat by controlling the Keepalived switch virtual IP, so as to realize the database switching. Experimental results show that this scheme can effectively reduce the database failover time.

Keywords: MySQL database; Keepalived; Mycat; high availability; failover


参考文献:

[1] MySQL. MySQL 5.7 Reference Manual/Replication [EB/OL].[2022-03-26]. https: //dev.mysql.com/doc/refman/5.7/en/replication.html.

[2] 田关伟 .MySQL 复制技术分析研究 [J]. 哈尔滨师范大学自然科学学报,2015,31(4):45-48+64.

[3] Oracle coporation. MySQL 5.7 Reference Manual/InnoDB Cluster [EB/OL].[2022-03-26].https://dev.mysql.com/doc/refman/5.7/en/mysql-innodb-cluster-introduction.html.

[4] 汪海洋,凌永兴,包丽红,等 . 基于 Keepalived 的高可用性应用研究 [J]. 电子技术,2014,43(7):21-24.

[5] 高鹏祥,陈文俊 . 基于 Mycat 的分布式数据库的应用研究[J]. 金融科技时代,2019(1):50-53.


作者简介:廖卓(1986—),女,汉族,湖南长沙人,公司员工,硕士研究生,研究方向:系统运维。