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

Memory data persistence method and apparatus for Redis database

A technology of in-memory data and database, applied in the direction of electrical digital data processing, special data processing applications, instruments, etc., can solve the problems of lost data, unable to ensure data security well, occupying storage space, etc., to ensure security Effect

Inactive Publication Date: 2016-10-05
DATANG SOFTWARE TECH
View PDF5 Cites 16 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] Snapshot (snapshot) periodically saves the data in the memory to the disk. However, because the data is saved periodically, once a failure occurs, all the data from the last data save to the failure will be lost. Visible , Snapshot (snapshot) does not guarantee data security very well, and there is still a risk of losing some data
[0006] Incremental file AOF is to save each write operation of the Redis database to an AOF file. Since each write operation is saved in the AOF file, the security of the data can be well ensured. However, the AOF file is continuously accumulated The write operation of the Redis database, as time goes by, the AOF file will become larger and larger, taking up a lot of storage space

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
  • Memory data persistence method and apparatus for Redis database
  • Memory data persistence method and apparatus for Redis database
  • Memory data persistence method and apparatus for Redis database

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0054] refer to figure 1 , which shows a flow chart of the steps of an embodiment of a method for persisting memory data for a Redis database according to the present invention, which may specifically include the following steps:

[0055] Step 101, when there is update data that needs to be written into the memory, sequentially add the first write instruction corresponding to the update data to the incremental file AOF;

[0056] The Redis database is an in-memory database. It is an open-source, log-type, Key-Value database that is written in ANSI C language, supports the network, and can be memory-based or persistent.

[0057] The Redis database stores data in the memory, and directly reads the data in the memory for corresponding operation processing. Since the data reading and writing speed of the memory is several orders of magnitude higher than that of the disk, the Redis database can greatly improve the data efficiency by storing the data in the memory. Processing efficien...

Embodiment 2

[0086] refer to figure 2 , which shows a flow chart of the steps of an embodiment of a method for recovering memory data for a Redis database according to the present invention, which may specifically include the following steps:

[0087] Step 201, when there is disk data that needs to be restored to the memory, extract the data in the snapshot file RDB, and write the extracted data into the memory;

[0088] In the embodiment of the present invention, the Redis database includes an incremental file AOF and a snapshot file RDB located on the disk.

[0089] The snapshot file RDB saves the data in the memory when the failure occurs. Usually, the data is saved to the snapshot file RDB in the form of Snapshot.

[0090] The incremental file AOF stores the first write instruction corresponding to the updated data written in the memory during the period from saving the memory data to the snapshot file RDB to the failure, and the first write instruction corresponding to the same data...

Embodiment 3

[0127] refer to image 3 , which shows a structural block diagram of an embodiment of an in-memory data persistence device for a Redis database of the present invention, the Redis database includes an incremental file AOF and a snapshot file RDB located on a disk, and the device includes:

[0128] The first write instruction adding module 301 is used to sequentially add the first write instruction corresponding to the update data to the incremental file AOF when there is update data that needs to be written into the memory;

[0129] A memory data adding module 302, configured to add existing data in the memory to the snapshot file RDB when the size of the incremental file AOF is greater than or equal to a preset threshold;

[0130] An incremental file AOF clearing module 303, configured to clear the incremental file AOF.

[0131] In a preferred embodiment of the present invention, the memory data adding module 302 may include the following submodules:

[0132] The first memo...

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

Embodiments of the invention provide a memory data persistence method and apparatus for a Redis database. The Redis database comprises an AOF (Append Only File) and a snapshot file in a format of RDB, which are located in a disk. The method comprises the steps of sequentially adding first write instructions corresponding to update data into the AOF when the update data needs to be written in a memory; adding existing data in the memory into the snapshot file in the format of RDB when the size of the AOF is greater than or equal to a preset threshold; and emptying the AOF. According to the memory data persistence method and apparatus, the memory data security can be ensured only by taking up few storage spaces.

Description

technical field [0001] The invention relates to the technical field of mobile communication, in particular to a memory data persistence method for a Redis database and a memory data persistence device for a Redis database. Background technique [0002] With the launch of 4G services, the complexity and intensity of data processing has increased dramatically, resulting in an exponential increase in the amount of data processing, which puts forward high requirements for data processing speed. [0003] At present, the Redis database is usually used to improve the data processing efficiency. By storing the data in the memory and storing the processing results in the disk after the processing is completed, the frequent I / O operations between the memory and the disk in the data interaction process are reduced. The data processing efficiency is greatly improved. [0004] However, since the data in the memory is temporarily stored, it is easy to cause data loss when a failure occur...

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
Inventor 张维
Owner DATANG SOFTWARE TECH