Method and device for storing and reading data

A technology for data storage and data reading, which is applied in the storage field and can solve problems such as the complexity of the data storage process

CN105094707AActive Publication Date: 2015-11-25HUAWEI CLOUD COMPUTING TECH CO LTD
4 Cites 14 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Publication Date
2015-11-25

Smart Images

  • Figure 1
    Figure 1
  • Figure 2
    Figure 2
  • Figure 3
    Figure 3
Patent Text Reader

Abstract

The invention discloses a method and device for storing and reading data. The method and device are used for solving the technical problem that the data storing process is complicated. The data storing method comprises the steps of receiving first data which are of a first format, to be written in and sent by an application layer; acquiring the first mapping relation between the data of the first format and the data of a second format, wherein the second format is a KeyValue format, and the first mapping relation is used for representing the line attribute and column attribute of each Value obtained through conversion of the data of the first format; converting the format of the first data into the second format according to the first mapping relation, so that second data are obtained; storing the second data.
Need to check novelty before this filing date? Find Prior Art

Description

technical field

[0001] The invention relates to the field of storage technology, in particular to a data storage and reading method and device. Background technique

[0002] In a distributed database, data is generally stored in the form of KeyValue (key-value). Among them, the Key part is used to uniquely identify a row of data, and is also information used to quickly retrieve data. For example, by searching the Key of a data, the data can be searched. The Key part is usually a specific structure defined by the user. The Value part is used to store the actual data. It can be considered that Key is an identification information used to distinguish different data, and the value part stores the real data content.

[0003] When using the KeyValue format to store data, there can be different storage methods. For example, if only one Value is stored in one row, then if one data includes multiple Values, it may be divided into multiple rows for storage. This storage method can ...

Examples

example 1

[0107] KeyValue distributed database can be used to store web page information. For example, Key can be used to store the URL (UniformResoureLocator, Uniform Resource Locator) of the webpage, and the actual content of the webpage indicated by the URL can be stored in the Value part, as follows:

[0108]Key(URL)->Value(PageContent(page content))

example 2

[0110] KeyValue distributed database can be used to store some basic information of users.

[0111] Suppose the user's basic information contains the following fields:

[0112] {ID (Identity, identification number), Name (name), Address (address), Age (age), Gender (sex), Phone (telephone), Education (education)}

[0113] When using the KeyValue distributed database to store the basic information, the ID can be used as the content of the Key part, and the others can be used as the content of the Value part. And it can be considered that the basic information contains multiple Values, that is, Name, Address, Age, Gender, Phone, and Education can be regarded as a Value respectively. When storing this type of information, a row of data records in the KeyValue distributed database may include only one Value, or may include multiple Values. If a row of data records includes only one Value, then such information may be stored in multiple rows, and if a row of data records includes...

example 3

[0126] Assume that the initial basic information of a user includes the following fields:

[0127] {ID, Name, Address, Age, Gender, Phone, Education}

[0128] According to the format that a row of data records includes a Value, the basic information is stored in the KeyValue distributed database, and the specific storage method is as described above.

[0129] After a period of time, the user adds another attribute to the basic information, that is, adds a field, which is Company (company). At this point, the basic information becomes:

[0130] {ID, Name, Address, Age, Gender, Phone, Education, Company}

[0131] At this point, you only need to add a new row of data records for the basic information in the KeyValue distributed database. The added row of data records is as follows:

[0132] Key(ID)->Value(Company)

[0133] Added content has no effect on existing data records.

[0134] Generally speaking, each row of data records in the KeyValue distributed database (in the e...