Main and auxiliary database synchronization method and device

A primary database and database technology, applied in the field of data processing, can solve the problems of low synchronization efficiency of the primary and standby databases, and achieve the effects of improving synchronization efficiency, reducing delay, and increasing availability

Active Publication Date: 2014-06-25
ALIBABA GRP HLDG LTD
View PDF5 Cites 35 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0006] The technical problem to be solved in this application is to provide a method and device for synchronizing active and standby databases to solve the problem of low efficiency of existing active and standby database synchronization

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
  • Main and auxiliary database synchronization method and device
  • Main and auxiliary database synchronization method and device
  • Main and auxiliary database synchronization method and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0033] The method for synchronizing the active and standby databases in the embodiment of the present application, such as figure 1 As shown, it is used for data synchronization between the primary database and the standby database, and the method includes:

[0034] Step 101: a transaction dispatching step, sequentially dispatching each transaction or the identifier of each transaction read from the main database to the write queue;

[0035] The order in which the transactions read from the master database in this embodiment of the present application are read out is the order in which they are committed in the master database and written into a log.

[0036] The transaction dispatch step is implemented by a dispatch thread.

[0037] In the transaction dispatch step, the write queue is selected for the current transaction according to the shortest write queue principle or the transaction hash value.

[0038] Preferably, the shortest write queue principle is adopted, that is,...

Embodiment 2

[0044] The method for synchronizing the master and standby databases in this application, such as figure 2 As shown, it is used for data synchronization between the primary database and the standby database, and the method includes:

[0045] Step 201: a preprocessing step, sequentially extracting the primary key of each transaction read from the master database, creating a primary key list for each transaction, and sequentially putting the identification of each transaction into the primary key transaction corresponding to the primary key of each transaction according to the primary key list of each transaction In the queue, the virtual record lock corresponding to the primary key of the transaction at the head of the primary key transaction queue;

[0046] In this paper, a primary key corresponds to a primary key transaction queue, and different primary keys correspond to different primary key transaction queues. Before a transaction is written to the standby database, it n...

Embodiment 3

[0059] The method for synchronizing the master and standby databases in this application, such as image 3 As shown, it is used for data synchronization between the primary database and the standby database, and the method includes:

[0060] Step 301: a preprocessing step, sequentially extracting the primary keys of each transaction read from the main database, and removing duplicate primary keys, creating a list of primary keys for each transaction; Put it into the primary key transaction queue corresponding to each primary key of the transaction, and the transaction whose transaction ID is at the head of the primary key transaction queue obtains the virtual record lock corresponding to the primary key;

[0061] In step 301, the primary key is sequentially extracted from each row record of the transaction, and after duplicate primary keys are removed, one primary key corresponds to one or several row records.

[0062] The virtual record locks of each primary key are maintain...

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 relates to a main and auxiliary database synchronization method and device for data synchronization between a main database and an auxiliary database. The method includes a transaction distributing step, namely distributing each transaction or transaction identifier read from the main database to writing queues; a transaction writing step, namely writing transactions or transactions with corresponding identifiers, in each writing thread corresponding to each writing thread through multiple writing thread parallel. According to the method, multiple writing threads are adopted to perform writing operations parallelly and simultaneously, delay is reduced, main and auxiliary database synchronization can be realized timely, and synchronization efficiency is improved.

Description

technical field [0001] The present application relates to the field of data processing, in particular to a method and device for synchronizing active and standby databases. Background technique [0002] MySQL is an open source database software widely used in the Internet industry. Many large websites are using MySQL databases. As the business scale continues to grow, a MySQL database will not be able to support a huge amount of visits. [0003] An effective solution is to establish a MySQL active and standby cluster, and the standby database is a complete mirror image of the primary database. Write requests only fall on the primary database, and read requests are evenly distributed to all databases, so that the entire cluster can provide larger-capacity read-write services. After the MySQL primary database receives the newly added changed data, it uses the synchronization tool to synchronize the changed data to the standby database in real time. [0004] Mysql binlog log...

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/30
CPCG06F16/27
Inventor 叶晖俊
Owner ALIBABA GRP HLDG LTD
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