Database switching method and system, and computer readable storage medium

A technology for switching systems and databases, which is applied in computing, electrical digital data processing, and special data processing applications. Ensure the data consistency between the original master database and the new master database

Pending Publication Date: 2018-12-11
金篆信科有限责任公司
View PDF4 Cites 27 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0006] These two master-slave switching methods have obvious limitations:
[0007] 1) Data consistency between the old and new primary databases cannot be reliably guaranteed
In the first method, after the log information of the original master database is overwritten to the slave database, the data of the original master database and the new master database are not checked. If an exception occurs during the overwriting process, the original master database and the new master database cannot be reliably guaranteed. consistent data
In the second method, the slave database is directly switched to the master database, and the original master database and the slave database may be inconsistent when switching, so that the data consistency between the original master database and the new master database cannot be guaranteed.
[0008] 2) Unable to handle database master-slave role exception
The master-slave switch will only be performed when the proxy server or the database is down. If the master-slave role of the database is abnormal, the master-slave data cannot be synchronized, which may further cause data inconsistency in the subsequent master-slave switch

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Database switching method and system, and computer readable storage medium
  • Database switching method and system, and computer readable storage medium
  • Database switching method and system, and computer readable storage medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0034] Such as figure 1 As shown, a database switching method provided in an embodiment of the present invention, the database switching method of this embodiment includes:

[0035] Step S110, in the nodes of the distributed database, acquire the state of the master database from the resource manager corresponding to the master database.

[0036] The technical solution in this embodiment can be realized on the cluster manager in the distributed data, and the structure of the distributed database is as follows figure 2 Shown:

[0037] 1. Cluster manager: Receive related requests from upper-level business for distributed database clusters, manage distributed database clusters, coordinate resource managers to report database status, and notify resource managers to perform commands such as switching, backup, and redistribution.

[0038] 2. Explorer. It is usually used as the upper agent of the database, and it is a local database monitoring program that performs complex operat...

Embodiment 2

[0059] Such as image 3 As shown, a database switching method provided in an embodiment of the present invention, the database switching method of this embodiment includes:

[0060] Step S310, in the nodes of the distributed database, obtain the state of the master database from the resource manager corresponding to the master database.

[0061] Step S320, notifying the proxy server of the information that the node no longer receives new services.

[0062] Step S330, when the abnormal state of the master database is acquired, the log information of the master database is acquired from the resource manager corresponding to the master database.

[0063] In this embodiment, after the cluster manager confirms that the proxy server has successfully stopped the failed node server, it obtains the database log information it manages from each resource manager, and the resource manager sends the log information to the cluster manager after the database playback is completed. , the cl...

Embodiment 3

[0084] Such as Figure 5 As shown, a database switching method provided in an embodiment of the present invention, the database switching method of this embodiment includes:

[0085] Step S510, in the node of the distributed database, obtain the state of the master database from the resource manager corresponding to the master database.

[0086] Step S520, notifying the proxy server of the information that the node no longer receives new services.

[0087] Step S530, when the status of the master database cannot be obtained from the resource manager corresponding to the master database, log information of the backed up master database is obtained from a preset log server.

[0088] In this embodiment, if the original master resource manager is down, the cluster manager sends a supplementary data request to each slave resource manager, and each slave resource manager uses the log information stored on the binlog server to synchronize data. After the completion of data suppleme...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a database switching method and system and a computer readable storage medium. The database switching method comprises the following steps: acquiring a state of a master database from a resource manager corresponding to a master database in a node of a distributed database; and obtaining a state of the master database from a resource manager corresponding to the master database; when the normal state of the master database cannot be obtained, obtaining the log information of the master database; according to the log information of the master database, supplying data toone or more of the nodes from the slave database; selecting one from one or more slave databases as a new master database and treating the master database as a new slave database; sending requests updating the master-slave relationship to all resource managers in the node According to the invention, the state of each node of the distributed database is detected to be abnormal in time, and after the slave database is synchronized according to the log information of the master database, the slave database is selected as a new master database to ensure the consistency of the data of the originalmaster database and the new master database, so the normal master-slave relationship in the distributed database is maintained.

Description

technical field [0001] The present invention relates to the field of computer technology, in particular to a database switching method, system and computer-readable storage medium. Background technique [0002] Distributed databases involve a large number of scattered nodes. Once a node fails, it will affect the normal execution of transactions. Therefore, when a node is abnormal, it is necessary to quickly find a suitable database instance as a new host to carry the node's transactions. [0003] At present, when a distributed database cluster handles node failures, there are two situations: [0004] 1) If the proxy server is not down but the database instance is down, the log information of the original master database instance will be overwritten to the slave database, and then the slave database will be switched to the master database. [0005] 2) If both the proxy server and the database instance are down, the slave database will be directly switched to the master datab...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F17/30G06F11/14
CPCG06F11/1469G06F11/1471
Inventor 聂志
Owner 金篆信科有限责任公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products