Database high availability implementation method, apparatus, database architecture, device and product

CN116781488BActive Publication Date: 2026-08-28CHINA MOBILE GROUP JIANGSU +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210225644.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-09
Publication Date
2026-08-28
Estimated Expiration
2042-03-09

AI Technical Summary

Technical Problem

[0003]然而,mysql主机CPU异常、内存异常、磁盘读写异常等情况,并不会触发mysql的主从切换,只有当mysql主机宕机或进程不可用时,才会触发主从切换;同时,现有技术中的数据库架构依赖keepalived的自动检测机制,一旦keepalived之间的心跳链接出现异常,那么会导致无法执行mysql切换脚本;Keepalived出现异常,但mysql数据库正常时,也会触发VIP的漂移以及mysql数据库的切换

Benefits of technology

[0043]本申请提供的数据库高可用实现方法、装置、数据库架构、设备和产品,该方法应用于数据库架构,数据库架构包括主节点集群和从节点集群,主节点集群包括主节点、备份主节点、第一主代理节点和第一备份代理节点,从节点集群包括多个从节点、第二主代理节点和第二备份代理节点,基于此,在数据库架构中引入备份主节点,以及在主节点集群和从节点集群中均引入代理节点,从而在弃用keepalived的情况下,仍可以实现VIP功能,进而实现keepalived与数据库的分离,以用来解决数据库与VIP之间的耦合关系,最终提高数据库高可用实现方法的准确率,且各集群中代理节点均采用主备方式部署,从而提高数据库高可用实现方法的容错率;通过获取数据库架构中各节点的状态信息,并对状态信息进行异常分析,得到异常分析结果,从而可以对数据库架构进行全面的异常分析,相比只对主节点的服务状态进行异常分析,本申请可以进一步提高数据库高可用实现方法的准确率和容错率;此外,节点切换的处理流程包括主节点的主备切换、主节点的主从切换、从节点集群内的切换、代理节点的主备切换和无节点切换中的至少一种,相对只对主节点进行主从切换,本申请可以进一步提高数据库高可用实现方法的准确率和容错率。综上,本申请可以实现高准确率和高容错率的数据库高可用方法。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116781488B_ABST
    Figure CN116781488B_ABST
Patent Text Reader

Abstract

The application provides a database high-availability implementation method and device, a database architecture, equipment and products. The method is applied to a database architecture, the database architecture comprises a master node cluster and a slave node cluster, the master node cluster comprises a master node, a backup master node, a first master proxy node and a first backup proxy node, the slave node cluster comprises a plurality of slave nodes, a second master proxy node and a second backup proxy node, and the method comprises the following steps: acquiring state information of each node in the database architecture; performing abnormality analysis on the state information to obtain an abnormality analysis result; and based on the abnormality analysis result, performing node switching on the database architecture, wherein the processing procedure of the node switching comprises at least one of master / backup switching of the master node, master / slave switching of the master node, switching within the slave node cluster, master / backup switching of the proxy node and node-free switching. The application can implement a database high-availability method with high accuracy and high fault tolerance.
Need to check novelty before this filing date? Find Prior Art

Claims

1. A method for implementing high availability of a database, characterized in that, This method is applied to a database architecture comprising a master node cluster and a slave node cluster. The master node cluster includes a master node, a backup master node, a first master proxy node, and a first backup proxy node. The slave node cluster includes multiple slave nodes, a second master proxy node, and a second backup proxy node. The load of the first master proxy node is directed to the master node, and the first master proxy node is temporarily bound to a VIP. The load of the second master proxy node is directed to each slave node in the slave node cluster, and the second master proxy node is temporarily bound to a VIP. Obtain the status information of each node in the database architecture; the status information includes service status information and host status information. Anomaly analysis is performed on the state information to obtain the anomaly analysis results; Based on the anomaly analysis results, node switching is performed on the database architecture. The node switching process includes at least one of the following: master-slave switching of master nodes, master-slave switching of master nodes, switching within the slave node cluster, master-slave switching of proxy nodes, and no-node switching. The anomaly analysis of the state information to obtain the anomaly analysis results includes: Anomaly analysis is performed on the service status information in the status information. If the service status of a certain node is abnormal, the anomaly analysis result is determined to be that the node is abnormal; or, Anomaly analysis is performed on the host status information in the status information. If a host of a certain node is abnormal, an alarm is generated based on the abnormal status of the host. If no convergence occurs in the alarm, the anomaly analysis result is determined to be that a certain node is abnormal.

2. The database high availability implementation method according to claim 1, characterized in that, If the anomaly analysis result indicates that the master node is abnormal, the node switching of the database architecture includes: Obtain the data synchronization status of the master node and the backup master node; Based on the data synchronization status, the master node is switched.

3. The database high availability implementation method according to claim 2, characterized in that, If the data synchronization status is fully synchronized, the node switch for the master node includes: Switch the master node to the backup master node and regenerate the master-slave relationship between the backup master node and the slave node cluster; The load of the first primary proxy node is redirected to the backup primary node, and the primary node is removed from the primary node cluster. If the data synchronization status is data asynchrony, the node switch for the master node includes: The master-slave relationship between the master node and the backup master node is terminated, and consistency processing is performed on the backup master node and the master node to synchronize the data between the backup master node and the master node; Switch the master node to the backup master node and regenerate the master-slave relationship between the backup master node and the slave node cluster; The load of the first primary proxy node is redirected to the backup primary node, and the primary node is removed from the primary node cluster. If the data synchronization status indicates a data synchronization problem, the node switch for the master node includes: In the slave node cluster, identify the target slave node whose data synchronization state is closest to that of the master node; Consistency processing is performed on the target slave node and the master node to synchronize the data between the target slave node and the master node; Switch the master node to the target slave node and regenerate the master-slave relationship between the target slave node and the slave node cluster; The load of the first master proxy node is redirected to the target slave node, and the master node and the backup master node are removed from the master node cluster.

4. The database high availability implementation method according to claim 1, characterized in that, If the anomaly analysis result indicates that an anomaly has occurred at a slave node, the node switching of the database architecture includes: The abnormal slave node is removed from the slave node cluster and removed from the load configuration of the second primary agent node and the second backup agent node.

5. The database high availability implementation method according to claim 1, characterized in that, If the anomaly analysis result indicates that the primary agent node is abnormal, the node switching of the database architecture includes: Stop the main agent node that malfunctions and clear the virtual IP bound to the main agent node that malfunctions. Configure the virtual IP to the backup agent node corresponding to the main agent node that experienced the anomaly.

6. The database high availability implementation method according to any one of claims 1 to 5, characterized in that, Each node in the database architecture is equipped with an agent module. The step of obtaining the status information of each node in the database architecture includes: Each agent module collects the status information of each node in the database architecture.

7. A database high availability implementation device, characterized in that, Deployed on a database architecture including a master node cluster and a slave node cluster, the master node cluster includes a master node, a backup master node, a first master proxy node, and a first backup proxy node; the slave node cluster includes multiple slave nodes, a second master proxy node, and a second backup proxy node; the load of the first master proxy node is directed to the master node, and the first master proxy node is temporarily bound to a VIP; the load of the second master proxy node is directed to each slave node in the slave node cluster, and the second master proxy node is temporarily bound to a VIP; the device includes: The acquisition module is used to acquire the status information of each node in the database architecture; the status information includes service status information and host status information. The analysis module is used to perform anomaly analysis on the status information and obtain anomaly analysis results; The switching module is used to switch nodes in the database architecture based on the anomaly analysis results. The node switching process includes at least one of the following: master-slave switching of master nodes, master-slave switching of master nodes, switching within a slave node cluster, master-slave switching of proxy nodes, and no-node switching. The anomaly analysis of the state information to obtain the anomaly analysis results includes: Anomaly analysis is performed on the service status information in the status information. If the service status of a certain node is abnormal, the anomaly analysis result is determined to be that the node is abnormal; or, Anomaly analysis is performed on the host status information in the status information. If a host of a certain node is abnormal, an alarm is generated based on the abnormal status of the host. If no convergence occurs in the alarm, the anomaly analysis result is determined to be that a certain node is abnormal.

8. A database architecture, characterized in that, The database architecture includes a master node cluster, a slave node cluster, and a database high availability implementation device. The master node cluster includes a master node, a backup master node, a first master proxy node, and a first backup proxy node. The slave node cluster includes multiple slave nodes, a second master proxy node, and a second backup proxy node. The load of the first master proxy node is directed to the master node, and the first master proxy node is temporarily bound to a VIP. The load of the second master proxy node is directed to each slave node in the slave node cluster, and the second master proxy node is temporarily bound to a VIP. The database high availability implementation device includes: The acquisition module is used to acquire the status information of each node in the database architecture; the status information includes service status information and host status information. The analysis module is used to perform anomaly analysis on the status information and obtain anomaly analysis results; The switching module is used to switch nodes in the database architecture based on the anomaly analysis results. The node switching process includes at least one of the following: master-slave switching of master nodes, master-slave switching of master nodes, switching within a slave node cluster, master-slave switching of proxy nodes, and no-node switching. The anomaly analysis of the state information to obtain the anomaly analysis results includes: Anomaly analysis is performed on the service status information in the status information. If the service status of a certain node is abnormal, the anomaly analysis result is determined to be that the node is abnormal; or, Anomaly analysis is performed on the host status information in the status information. If a host of a certain node is abnormal, an alarm is generated based on the abnormal status of the host. If no convergence occurs in the alarm, the anomaly analysis result is determined to be that a certain node is abnormal.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the database high availability implementation method as described in any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the database high availability implementation method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Distributive database high-availability method and system based on cluster manager

    CN104408071A