Unlock instant, AI-driven research and patent intelligence for your innovation.

Database access method and device with read-write separation

A read-write separation and database technology is applied in the field of database access methods and devices with read-write separation, and can solve the problems of low query result accuracy, inconsistent latest data, etc.

Active Publication Date: 2020-04-07
CHINA UNITED NETWORK COMM GRP CO LTD
View PDF4 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] The present invention provides a database access with read-write separation, which is used to solve the problem that the data read from the database and the latest data in the master database are caused by the synchronization delay between the slave database and the master database in the prior art. Inconsistencies, and ultimately lead to the problem of low accuracy of query results provided to users

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 access method and device with read-write separation
  • Database access method and device with read-write separation
  • Database access method and device with read-write separation

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0032] figure 1 It is a flow chart of the database access method with read-write separation provided in Embodiment 1 of the present invention. The embodiment of the present invention aims at the fact that in the prior art, when the synchronization delay between the slave database and the master database is relatively large, the data read from the slave database is inconsistent with the latest data in the master database, and finally the query provided to the user As a result, the problem of low accuracy rate provides a database access method that separates reading and writing. Such as figure 1 , the specific steps of the method are as follows:

[0033] Step S101, before executing the data reading operation instruction, determine whether the slave database is in a synchronization delay state.

[0034] Wherein, the data read operation instruction includes the latest storage time of the target data to be queried.

[0035] In practical applications, when receiving the data que...

Embodiment 2

[0058] figure 2 It is a flow chart of the database access method with read-write separation provided in Embodiment 2 of the present invention. On the basis of the first embodiment above, in this embodiment, when the data read operation instruction is received, before determining whether the slave database is in the synchronization delay state, it also includes: periodically calculating the synchronization delay of the slave database; The synchronization delay of the slave database within the first preset number of cycles, calculate the synchronization delay of the slave database at the preset time in the future; if the synchronization delay of the slave database at the preset time is greater than or equal to the preset delay at the preset time Threshold, the slave is set to the sync-delayed state. Such as figure 2 As shown, before determining whether the slave database is in a synchronization delay state, the method further includes the following steps:

[0059] Step S201...

Embodiment 3

[0097] image 3 It is a flow chart of the database access method with read-write separation provided in Embodiment 3 of the present invention. On the basis of the second embodiment above, in this embodiment, after periodically calculating the synchronization delay of the slave database, it also includes: periodically calculating the increment of the data change message generated by the producer service and the data change message generated by the consumer service The processing volume of change messages; calculate the average increment and average processing volume of data change messages in each period according to the increment of data change messages generated by the producer service of the first preset number of cycles; calculate the future preset time The number of cycles between the interval from the latest cycle; the number of cycles according to the interval between the preset time and the latest cycle, the average increment and average processing volume of data change...

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 provides a read / write splitting type database accessing method and device. The method provided by the invention comprises the following steps: before executing a data reading operation instruction, determining whether a slave database is at a synchronization delay state or not; if the slave database is not at a non-synchronization delay state, reading data from the slave database; ifthe data is at the synchronization delay state, acquiring the newest time stamp of the slave database and the latest storage time of target data which is read at the present time; if the newest timestamp of the slave database is later than or equal to the latest storage time, reading the data from the slave database; if the newest time stamp of the slave database is earlier than the latest storage time, reading the data from a master database according to the data reading operation instruction; switching to read the data from the master database when the synchronization delay between the slave database and the master database is relatively long. By adopting the read / write splitting type database accessing method and device, the problem that the data read from the slave database and the newest data in the master database are inconsistent is avoided and the accuracy of a query result provided by a user is greatly improved.

Description

technical field [0001] The invention relates to the technical field of data access and storage, in particular to a database access method and device with read-write separation. Background technique [0002] In order to ensure the stability of database products, many databases have a dual-machine hot backup function, that is, using read-write separation technology, by setting the master database and slave database, and synchronizing the data changes in the master database to the slave database in real time through the synchronization service. [0003] The existing database access method using read-write separation technology, through the combination of ogg (Oracle GoldenGate) message synchronization mechanism service and the synchronization server of kafka message middleware technology, the data changes in the original oracle database (main database) are passed through the message Synchronously write to the Hbase database (slave library) in real time. During the use of the d...

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 Patents(China)
IPC IPC(8): G06F16/2455G06F16/2458G06F16/27
CPCG06F16/2455G06F16/2471G06F16/27
Inventor 周文卿张加伟于晓虹李学政黄群
Owner CHINA UNITED NETWORK COMM GRP CO LTD
Features
  • R&D
  • Intellectual Property
  • Life Sciences
  • Materials
  • Tech Scout
Why Patsnap Eureka
  • Unparalleled Data Quality
  • Higher Quality Content
  • 60% Fewer Hallucinations
Social media
Patsnap Eureka Blog
Learn More