一种数据库控制方法和系统技术方案

技术编号:18711309 阅读:102 留言:0更新日期:2018-08-21 22:44
本发明专利技术公开了一种数据库控制方法和系统。方法包括基于负载均衡的方式访问数据库集群;连接数据库集群的所有数据库获取对应binlog日志,生成与binlog日志匹配的数据库的快照。系统包括由MySQL数据库组成的数据库集群、负载均衡服务器和binlog服务器,其中,所述负载均衡服务器基于负载均衡的方式访问所述数据库集群;所述binlog服务器从所述数据库集群的所有数据库获取对应binlog日志,生成与binlog日志匹配的数据库的快照。本发明专利技术通过负载均衡实现数据库集群的访问,通过binlog日志和快照保证数据库集群的安全性。

A database control method and system

The invention discloses a database control method and a system. Methods include accessing the database cluster based on load balancing, connecting all databases of the database cluster to obtain the corresponding binlog log, and generating a snapshot of the database matching the binlog log log. The system includes a database cluster composed of MySQL databases, a load balancing server and a binlog server, wherein the load balancing server accesses the database cluster based on load balancing, and the binlog server obtains corresponding binlog logs from all databases of the database cluster and generates binlog days. A snapshot of the database matching the database. The invention realizes the access of database cluster by load balancing, and ensures the security of database cluster by binlog log and snapshot.

【技术实现步骤摘要】
一种数据库控制方法和系统
本专利技术涉及数据库
,尤其涉及一种数据库控制方法和系统。
技术介绍
MySQL是当前应用最为广泛的开源数据库,该数据库本身提供了binlog的事务日志,并提供了一种主从的方式来进行数据的热备,但是这种热备方式存在非常多的弊端1.容易裂脑,当主数据库由于宕机,导致从数据库上线之后,没有一个良好的机制来进行数据的重新同步2.缺乏自动切换的机制3.默认提供的互为主从方案只能支持两台数据库服务器。
技术实现思路
为了解决上述问题,本专利技术提供一种数据库控制方法和系统。本专利技术采用的技术方案一方面为一种数据库控制方法,适用于MySQL数据库集群,包括:基于负载均衡的方式访问数据库集群;连接数据库集群的所有数据库获取对应binlog日志,生成与binlog日志匹配的数据库的快照。优选地,还包括:连接数据库集群的所有数据库并获取对应binlog日志,基于预设的存储规则修改binlog日志的serverID标识、文件信息和偏移信息,存储所述binlog日志。优选地,还包括:在预设的周期内,生成与binlog日志匹配的数据库的快照。本专利技术采用的技术方案一方面为一种本文档来自技高网...

【技术保护点】
1.一种数据库控制方法,适用于MySQL数据库集群,其特征在于,包括:基于负载均衡的方式访问数据库集群;连接数据库集群的所有数据库获取对应binlog日志,生成与binlog日志匹配的数据库的快照。

【技术特征摘要】
1.一种数据库控制方法,适用于MySQL数据库集群,其特征在于,包括:基于负载均衡的方式访问数据库集群;连接数据库集群的所有数据库获取对应binlog日志,生成与binlog日志匹配的数据库的快照。2.根据权利要求1所述的一种数据库控制方法,其特征在于,还包括:连接数据库集群的所有数据库并获取对应binlog日志,基于预设的存储规则修改binlog日志的serverID标识、文件信息和偏移信息,存储所述binlog日志。3.根据权利要求1或2所述的一种数据库控制方法,其特征在于,还包括:在预设的周期内,生成与binlog日志匹配的数据库的快照。4.一种数据库控制系统,适用于权利要求1所述的方法,其特征在于,包括:由MySQL数据库组成的数据库集群、负载均衡服务器和binlog服务器,其中,所述负载均衡服务器基于负载均衡的方式访问所述数据库集群;所述binlog服务器从所述数据库集群的所有数据库获取对应binlog日志,生成与binlog日志匹配...

【专利技术属性】
技术研发人员:刘杰史伟闵宇
申请(专利权)人:广东睿江云计算股份有限公司
类型:发明
国别省市:广东,44

网友询问留言 已有0条评论
  • 还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。

1