CN115757406A - Data storage method and device, electronic equipment and storage medium - Google Patents

Data storage method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115757406A
CN115757406A CN202211430267.5A CN202211430267A CN115757406A CN 115757406 A CN115757406 A CN 115757406A CN 202211430267 A CN202211430267 A CN 202211430267A CN 115757406 A CN115757406 A CN 115757406A
Authority
CN
China
Prior art keywords
data
database
character
hash value
stored
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211430267.5A
Other languages
Chinese (zh)
Inventor
刘佳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing IQIYI Science and Technology Co Ltd
Original Assignee
Beijing IQIYI Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing IQIYI Science and Technology Co Ltd filed Critical Beijing IQIYI Science and Technology Co Ltd
Priority to CN202211430267.5A priority Critical patent/CN115757406A/en
Publication of CN115757406A publication Critical patent/CN115757406A/en
Pending legal-status Critical Current

Links

Images

Abstract

The embodiment of the invention provides a data storage method, a data storage device, electronic equipment and a storage medium, wherein the method comprises the following steps: responding to a data storage request, and acquiring data to be stored and a first data identifier corresponding to the data to be stored; performing hash processing on the first data identifier to obtain a first hash value corresponding to the first data identifier; determining a preset database set, and determining a first database from the preset database set according to the first hash value; and storing the data to be stored and the first data identifier to the first database. Therefore, the data to be stored and the first data identification are dispersed into different databases of the preset database set according to the first hash value corresponding to the first data identification of the stored data, so that the pressure of mass data storage and high concurrency can be shared among different databases of the preset database set, and the problems of mass data storage, high concurrency and low delay can be solved.

Description

Data storage method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a data storage method and apparatus, an electronic device, and a storage medium.
Background
In the current advertisement putting scene, a media owner screens out proper flow for an advertiser, necessary information of the flow is synchronously sent to the advertiser through a Real Time application program interface (RTA), the advertiser determines whether to participate in bidding according to own data and models, the advertiser makes a judgment and feeds the judgment back to the media owner, and the media owner bids according to a strategy set by the advertisement so as to bid for showing the advertisement.
Such interaction between the media host and the advertiser results in large traffic, typically QPS (query per second), for example, in the order of millions, and requires low latency (e.g., within 50ms of response). In addition, the advertisement delivery scene has a large amount of advertiser data, so that for the advertisement delivery scene, the problems of mass data storage, high concurrency and low delay need to be solved.
In the related art, a mysql or the like is generally used to support a low-latency database to solve the problem of low latency in an advertisement placement scene. However, although the problem of low delay in the advertisement delivery scenario is solved, the problem of mass data storage and high concurrency is not solved, and therefore, a scheme capable of solving the problem of mass data storage, high concurrency and low delay is urgently needed.
Disclosure of Invention
In order to solve the problem of low latency in the advertisement delivery scenario, but the problem of mass data storage and high concurrency is not solved, so that a technical problem of a scheme capable of solving the problem of mass data storage, high concurrency and low latency is urgently needed. The specific technical scheme is as follows:
in a first aspect of the embodiments of the present invention, there is provided a data storage method, where the method includes:
responding to a data storage request, and acquiring data to be stored and a first data identifier corresponding to the data to be stored;
performing hash processing on the first data identifier to obtain a first hash value corresponding to the first data identifier;
determining a preset database set, and determining a first database from the preset database set according to the first hash value;
and storing the data to be stored and the first data identifier to the first database.
In an optional embodiment, the determining, from the preset database set, a first database according to the first hash value includes:
and extracting a first character in the first hash value, and determining a first database from the preset database set according to the first character.
In an optional embodiment, the extracting a first character in the first hash value includes:
and extracting first N-bit characters in the first hash value as first characters, wherein N is a positive integer.
In an optional embodiment, the determining a first database from the preset database set according to the first character includes:
and acquiring a corresponding relation between a preset character and a database, and searching a first database corresponding to the first character from the preset database set according to the corresponding relation.
In an optional embodiment, the correspondence relationship is obtained specifically by:
determining M databases according to the concurrency, wherein the M databases form a preset database set, and M is a positive integer;
determining a character range corresponding to the first character, and dividing characters in the character range into M character classifications;
and aiming at any character classification, determining the database corresponding to the character classification from the preset database set, and establishing the corresponding relation between the database and the characters in the character classification.
In an optional embodiment, the storing the data to be stored and the first data identifier to the first database includes:
determining a storage mode corresponding to the data to be stored, wherein the storage mode comprises static storage or dynamic storage;
and storing the data to be stored and the first data identifier to the first database according to the storage mode.
In an optional embodiment, the method further comprises:
responding to a data query request, acquiring a second data identifier, and performing hash processing on the second data identifier to obtain a second hash value corresponding to the second data identifier;
and according to the second hash value, determining a second database from the preset database set, and inquiring the data to be inquired corresponding to the second data identifier from the second database.
In an optional embodiment, the determining, from the preset database set, a second database according to the second hash value includes:
and extracting a second character in the second hash value, and determining a second database from the preset database set according to the second character.
In an optional embodiment, the extracting a second character in the second hash value includes:
and extracting the first N-bit characters in the second hash value as second characters, wherein N is a positive integer.
In an optional embodiment, the determining a second database from the preset database set according to the second character includes:
and acquiring a corresponding relation between a preset character and a database, and searching a second database corresponding to the second character from the preset database in a centralized manner according to the corresponding relation.
In a second aspect of embodiments of the present invention, there is also provided a data storage apparatus, comprising:
the data and identification acquisition module is used for responding to a data storage request and acquiring data to be stored and a first data identification corresponding to the data to be stored;
the identifier processing module is used for performing hash processing on the first data identifier to obtain a first hash value corresponding to the first data identifier;
the database set determining module is used for determining a preset database set;
the database determining module is used for determining a first database from the preset database set according to the first hash value;
and the data and identification storage module is used for storing the data to be stored and the first data identification to the first database.
In a third aspect of the embodiments of the present invention, there is further provided an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor configured to implement the data storage method according to any one of the first aspect described above when executing a program stored in the memory.
In a fourth aspect of the embodiments of the present invention, there is also provided a storage medium, in which instructions are stored, and when the storage medium is run on a computer, the storage medium causes the computer to execute the data storage method according to any one of the first aspect.
In a fifth aspect of the embodiments of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the data storage methods described above.
According to the technical scheme provided by the embodiment of the invention, the data to be stored and the first data identification corresponding to the data to be stored are obtained, the first data identification is subjected to Hash processing to obtain a first Hash value corresponding to the first data identification, a preset database set is determined, the first database is determined from the preset database set according to the first Hash value, and the data to be stored and the first data identification are stored in the first database. The method comprises the steps of carrying out Hash processing on a first data identifier corresponding to stored data to obtain a first Hash value, determining a first database according to the first Hash value, storing data to be stored and the first data identifier into the first database, and dispersing the data to be stored and the first data identifier into different databases of a preset database set according to the first Hash value corresponding to the first data identifier of the stored data, so that the mass data storage and the high concurrent pressure can be distributed into different databases of the preset database set, and the problems of mass data storage, high concurrency and low delay can be solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic flowchart illustrating an implementation flow of a data storage method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a data storage scenario shown in an embodiment of the present invention;
FIG. 3 is a schematic flow chart illustrating another implementation of a data storage method according to an embodiment of the present invention;
fig. 4 is a schematic flowchart illustrating an implementation flow of a method for establishing a correspondence relationship according to an embodiment of the present invention;
FIG. 5 is a schematic flow chart illustrating an implementation of a data query method according to an embodiment of the present invention;
FIG. 6 is a flow chart illustrating another implementation of a data query method according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating a scenario of data query according to an embodiment of the present invention;
FIG. 8 is a schematic structural diagram of a data storage device according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of another electronic device shown in the embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
In the embodiment of the invention, the applied database naturally supports the characteristic of low delay within a certain request amount, such as an open source Couchbase database, and mass data is encrypted by a hash algorithm and is evenly dispersed into different databases in high order, so that the storage and high concurrent pressure are distributed to each database. By combining the above description, the three problems of storage, high concurrency and low latency can be solved simultaneously.
Based on the above inventive concept, as shown in fig. 1, an implementation flow diagram of a data storage method provided in an embodiment of the present invention is shown, where the method is applied to a server, and specifically includes the following steps:
s101, responding to a data storage request, and acquiring data to be stored and a first data identifier corresponding to the data to be stored.
In the embodiment of the invention, a data storage request can be received, so that data to be stored and a first data identifier corresponding to the data to be stored can be acquired in response to the data storage request. For the first data identifier, for example, the first data identifier may be a key value, that is, a key, of the data to be stored, which is not limited in the embodiment of the present invention.
It should be noted that the data to be stored and the first data identifier of the data to be stored may be carried by the data storage request, which means that the data storage request may be analyzed, so as to obtain the data to be stored and the first data identifier corresponding to the data to be stored.
S102, carrying out hash processing on the first data identification to obtain a first hash value corresponding to the first data identification.
In the embodiment of the present invention, as for the first data identifier of the data to be stored, the first data identifier may be regarded as a string of character strings, so that hash processing may be performed on the first data identifier to obtain the first hash value corresponding to the first data identifier.
It should be noted that, in this embodiment of the present invention, an MD5 algorithm or the like may be used to perform hash processing on the first data identifier, so that the obtained first hash value corresponding to the first data identifier may be, for example, a character string with a fixed length of 32 bits, which is not limited in this embodiment of the present invention.
For example, for a key of data to be stored, where the data to be stored is value, the MD5 algorithm may be used to perform hash processing on the key of the data to be stored, where the hash processing is essentially encryption, and then a first hash value, that is, a 32-bit fixed-length character string, may be obtained.
S103, determining a preset database set, and determining a first database from the preset database set according to the first hash value.
In the embodiment of the present invention, a plurality of databases, for example, a plurality of Couchbase databases, may be determined by the concurrency amount, and the plurality of Couchbase databases form a preset database set, which means that the preset database set includes the plurality of Couchbase databases.
In order to implement the apportionment of the storage and the high concurrent pressure to the respective databases, the first database may be determined from a preset database set according to the first hash value, where the first database may be any one of the preset database set.
For example, the preset database set includes a Couchbase database 1, a Couchbase database 2, a Couchbase database 3, and a Couchbase database 4, and the first database, for example, the Couchbase database 4, is determined from the preset database set according to the first hash value.
And S104, storing the data to be stored and the first data identifier in a first database.
In the embodiment of the invention, the data to be stored and the first data identifier of the data to be stored can be stored in the first database, so that the aim of distributing the storage and the high concurrent pressure to each database is fulfilled. In addition, the database supports the characteristic of low delay, so that the problems of mass data storage, high concurrency, low delay and the like are solved.
It should be noted that the data to be stored may be used as Value, and the first data identifier of the data to be stored may be stored in the first database as Key, for example, stored in the Couchbase database 4, as shown in fig. 2, which is not limited in this embodiment of the present invention.
Through the above description of the technical solution provided by the embodiment of the present invention, the data to be stored and the first data identifier corresponding to the data to be stored are obtained, the first data identifier is subjected to hash processing to obtain a first hash value corresponding to the first data identifier, a preset database set is determined, a first database is determined from the preset database set according to the first hash value, and the data to be stored and the first data identifier are stored in the first database.
The method comprises the steps of carrying out Hash processing on a first data identifier corresponding to stored data to obtain a first Hash value, determining a first database according to the first Hash value, storing data to be stored and the first data identifier into the first database, and dispersing the data to be stored and the first data identifier into different databases of a preset database set according to the first Hash value corresponding to the first data identifier of the stored data, so that the mass data storage and the high concurrent pressure can be distributed into different databases of the preset database set, and the problems of mass data storage, high concurrency and low delay can be solved.
As shown in fig. 3, an implementation flow diagram of another data storage method provided in the embodiment of the present invention is shown, where the method is applied to a server, and specifically includes the following steps:
s301, responding to the data storage request, and acquiring the data to be stored and a first data identifier corresponding to the data to be stored.
In the embodiment of the present invention, this step is similar to the step S101, and the details of the embodiment of the present invention are not repeated herein.
S302, carrying out hash processing on the first data identification to obtain a first hash value corresponding to the first data identification.
In the embodiment of the present invention, this step is similar to the step S102, and details of the embodiment of the present invention are not repeated herein.
S303, determining a preset database set, extracting a first character in the first hash value, and determining a first database from the preset database set according to the first character.
In the embodiment of the present invention, a plurality of databases, for example, a plurality of Couchbase databases, may be determined by the concurrency amount, and a preset database set is composed of the plurality of Couchbase databases, which means that the preset database set includes the plurality of Couchbase databases.
In order to realize the sharing of storage and high concurrent pressure to each database, a first character in the first hash value is extracted, and the first database is determined from a preset database set according to the first character, wherein the first database can be any database in the preset database set.
In this embodiment of the present invention, the first N-bit character in the first hash value may be extracted as the first character, where N is a positive integer, for example, N may be equal to 1, which means that the first character in the first hash value is extracted as the first character.
It should be noted that, for the value range of each bit character in the first hash value is 16, i.e. 0 to 9 and a to f, the first N bit character is used as the first character, and the combination mode thereof has 16 N For example, if the first 1 bit is the first character, the first character can be combined in 16 ways.
Therefore, in the embodiment of the invention, the corresponding relation between the preset character and the database is obtained, and the first database corresponding to the first character is searched from the preset database in a centralized manner according to the corresponding relation between the preset character and the database.
For example, the correspondence relationship between the characters and the database is established in advance, as shown in table 1 below. The first 1 bits, that is, the first bits in the first hash value are extracted as a first character (for example, 0), and according to the correspondence between the characters and the database shown in table 1 below, the first database corresponding to the first character 0, that is, the Couchbase database 1, can be collectively searched from the database.
Database with a plurality of databases Character(s)
Couchbase database 1 0~3
Couchbase database 2 4~7
Couchbase database 3 8~b
Couchbase database 4 c~f
TABLE 1
In the embodiment of the present invention, the correspondence between the characters and the database may be obtained by referring to the method shown in fig. 4. As shown in fig. 4, an implementation flow diagram of a method for establishing a correspondence relationship according to an embodiment of the present invention is shown, where the method is applied to a server, and specifically includes the following steps:
s401, M databases are determined according to the concurrency quantity, a preset database set is formed by the M databases, and M is a positive integer.
In the embodiment of the invention, the concurrency can be estimated, or calculated in real time, so that M databases can be determined according to the concurrency, a preset database set is formed by the M databases, and M is a positive integer.
The self-concurrency amount of the database may be obtained, and the quotient obtained by dividing the self-concurrency amount of the database by the self-concurrency amount of the database is the M. For example, the concurrency amount of the database is 25 ten thousand, and the concurrency amount is 100 ten thousand, and the quotient obtained by dividing 100 ten thousand by 25 ten thousand is M, that is, M =4.
The concurrency amount is understood as QPS, and the present invention is not limited thereto.
S402, determining a character range corresponding to the first character, and dividing characters in the character range into M character categories.
In the embodiment of the present invention, for the first character, a character range corresponding to the first character may be determined, so that characters in the character range may be divided into M character classifications, which means that the number of character classifications is consistent with the number of databases in a database set.
For example, for the first character 0, the corresponding character range, i.e., 0 to f, is determined, so that the characters from 0 to f can be (on average) divided into 4 character classifications, as shown in table 2 below, where the number of character classifications matches the number of databases in the database set above.
Character classification Character(s)
Character classification 1 0~3
Character classification 2 4~7
Character classification 3 8~b
Character classification 4 c~f
TABLE 2
S403, aiming at any character classification, determining a database corresponding to the character classification from a preset database set, and establishing a corresponding relation between the database and the characters in the character classification.
In the embodiment of the invention, aiming at any character classification, the database corresponding to the character classification is determined from the preset database, so that the corresponding relation between the database and the characters in the character classification is established, and the corresponding relation between the characters and the database can be obtained.
The number of the character classifications is consistent with the number of the databases in the database set, so that the sequence of the character classifications in all the character classifications is determined according to any character classification, the database corresponding to the sequence is determined from the preset database set, and the corresponding relation between the database and the characters in the character classifications is established.
For example, for the character classifications 1.
S304, determining a storage mode corresponding to the data to be stored, wherein the storage mode comprises static storage or dynamic storage.
S305, storing the data to be stored and the first data identifier to a first database according to a storage mode.
In the embodiment of the invention, for the data to be stored, a service party has certain storage requirements, namely static storage or dynamic storage. For static storage, it is understood that data is generally not alterable after data storage, while for dynamic storage, it is understood that data can be subsequently altered after data storage.
Therefore, a storage mode corresponding to the data to be stored can be determined, wherein the storage mode comprises static storage or dynamic storage, and the data to be stored and the first data identifier corresponding to the data to be stored are stored in the first database according to the storage mode.
According to the technical scheme provided by the embodiment of the invention, the first data identifier corresponding to the stored data is subjected to hash processing to obtain the first hash value, the first character in the first hash value is extracted, the first database is determined from the preset database set according to the first character, and the data to be stored and the first data identifier are stored in the first database according to a certain storage mode. Therefore, the data to be stored and the first data identification are dispersed into different databases of the preset database set according to the first hash value corresponding to the first data identification of the stored data, so that the pressure of mass data storage and high concurrency can be shared among different databases of the preset database set, and the problems of mass data storage, high concurrency and low delay can be solved.
In addition, as shown in fig. 5, an implementation flow diagram of a data query method provided in the embodiment of the present invention is shown, where the method is applied to a server, and specifically includes the following steps:
s501, responding to the data query request, acquiring a second data identifier, and performing hash processing on the second data identifier to obtain a second hash value corresponding to the second data identifier.
In the embodiment of the present invention, a data query request may be received, so that the second data identifier may be obtained in response to the data query request. The second data identifier may be carried by the data query request, which means that the data query request may be parsed, so as to obtain the second data identifier.
For the second data identifier, the second data identifier may be regarded as a string of character strings, so that the second data identifier may be subjected to hash processing to obtain a second hash value corresponding to the second data identifier. The second data identifier may be hashed by using an MD5 algorithm, etc. to obtain a second hash value corresponding to the second data identifier, where the second hash value may be, for example, a character string with a fixed length of 32 bits, which is not limited in this embodiment of the present invention.
S502, according to the second hash value, a second database is determined from a preset database set, and data to be queried corresponding to the second data identification are queried from the second database.
In the embodiment of the present invention, for the second hash value, the second database may be determined from the preset database set according to the second hash value, and the data to be queried corresponding to the second data identifier is queried from the second database, so that the storage and high concurrency pressure may be distributed to each database.
For example, the preset database set includes a Couchbase database 1, a Couchbase database 2, a Couchbase database 3, and a Couchbase database 4, the second database, for example, the Couchbase database 4, is determined from the preset database set according to the second hash value, and the data to be queried corresponding to the second data identifier is queried from the Couchbase database 4.
According to the technical scheme provided by the embodiment of the invention, the second data identifier is subjected to hash processing to obtain a second hash value corresponding to the second data identifier, the second database is determined from the preset database set according to the second hash value, the data to be inquired corresponding to the second data identifier is inquired from the second database, and the data to be inquired is dispersed into different databases to be subjected to data inquiry according to the second hash value corresponding to the second data identifier, so that the inquiry and high concurrency pressure can be distributed into different databases of the preset database set.
As shown in fig. 6, which is a schematic diagram of an implementation flow of another data query method provided in the embodiment of the present invention, the method applied to a server may specifically include the following steps:
s601, responding to the data query request, obtaining a second data identifier, and performing hash processing on the second data identifier to obtain a second hash value corresponding to the second data identifier.
In the embodiment of the present invention, this step is similar to the step S501, and details of the embodiment of the present invention are not repeated herein.
S602, extracting a second character in the second hash value, determining a second database from a preset database set according to the second character, and inquiring data to be inquired corresponding to the second data identifier from the second database.
In the embodiment of the present invention, a second character in the second hash value may be extracted, and a second database may be determined from a preset database set according to the second character, where the second database may be any database in the preset database set, so that data to be queried corresponding to the second data identifier may be queried from the second database.
The first N-bit character in the second hash value may be extracted as the second character, where N is a positive integer, for example, N may be equal to 1, which means that the first character in the second hash value is extracted as the second character. It should be noted that, here, the second hash value is consistent with the extraction rule of the first hash value, and this is not limited in the embodiment of the present invention.
Therefore, in the embodiment of the invention, the corresponding relation between the preset character and the database is obtained, and the second database corresponding to the second character is searched in the preset database in a centralized manner according to the corresponding relation between the character and the database.
For example, according to the correspondence between the characters and the databases shown in table 1, the first character in the second hash value is extracted as the second character, for example, 0, and according to the correspondence between the characters and the databases shown in table 1, the second database corresponding to the second character 0, that is, the Couchbase database 1, may be searched from a preset database set, and the data to be queried corresponding to the second data identifier may be searched from the Couchbase database 1, where the second data identifier is used as a Key to query the data to be queried in the Couchbase database 1, as shown in fig. 7.
Through the above description of the technical solution provided by the embodiment of the present invention, the second data identifier is subjected to hash processing to obtain a second hash value corresponding to the second data identifier, a second character in the second hash value is extracted, a second database is determined from a preset database set according to the second character, data to be queried corresponding to the second data identifier is queried from the second database, and thus, the data to be queried corresponding to the second data identifier is dispersed into different databases according to the second hash value corresponding to the second data identifier to perform data query, so that query and high concurrency pressure can be distributed to different databases of the preset database set.
Corresponding to the foregoing method embodiment, an embodiment of the present invention further provides a data storage apparatus, as shown in fig. 8, where the apparatus may include: data, identification acquisition module 810, identification processing module 820, database set determination module 830, database determination module 840, data, identification storage module 850.
A data and identifier obtaining module 810, configured to, in response to a data storage request, obtain data to be stored and a first data identifier corresponding to the data to be stored;
the identifier processing module 820 is configured to perform hash processing on the first data identifier to obtain a first hash value corresponding to the first data identifier;
a database set determining module 830, configured to determine a preset database set;
a database determining module 840, configured to determine a first database from the preset database set according to the first hash value;
a data and identifier storing module 850, configured to store the data to be stored and the first data identifier in the first database.
An embodiment of the present invention further provides an electronic device, as shown in fig. 9, which includes a processor 91, a communication interface 92, a memory 93, and a communication bus 94, where the processor 91, the communication interface 92, and the memory 93 complete mutual communication through the communication bus 94,
a memory 93 for storing a computer program;
the processor 91, when executing the program stored in the memory 93, implements the following steps:
responding to a data storage request, and acquiring data to be stored and a first data identifier corresponding to the data to be stored; performing hash processing on the first data identifier to obtain a first hash value corresponding to the first data identifier; determining a preset database set, and determining a first database from the preset database set according to the first hash value; and storing the data to be stored and the first data identifier to the first database.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this is not intended to represent only one bus or type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, or discrete hardware components.
In yet another embodiment of the present invention, a storage medium is further provided, which stores instructions that, when executed on a computer, cause the computer to execute the data storage method described in any one of the above embodiments.
In a further embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the data storage method of any of the above embodiments.
In the above embodiments, all or part of the implementation may be realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a storage medium or transmitted from one storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The storage medium may be any available medium that can be accessed by a computer or a data storage device including one or more integrated servers, data centers, and the like. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the system embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (13)

1. A method of storing data, the method comprising:
responding to a data storage request, and acquiring data to be stored and a first data identifier corresponding to the data to be stored;
performing hash processing on the first data identifier to obtain a first hash value corresponding to the first data identifier;
determining a preset database set, and determining a first database from the preset database set according to the first hash value;
and storing the data to be stored and the first data identifier to the first database.
2. The method according to claim 1, wherein said determining a first database from said preset database set according to said first hash value comprises:
and extracting a first character in the first hash value, and determining a first database from the preset database set according to the first character.
3. The method of claim 2, wherein extracting the first character in the first hash value comprises:
and extracting first N-bit characters in the first hash value as first characters, wherein N is a positive integer.
4. The method of claim 2, wherein determining a first database from the set of predetermined databases based on the first character comprises:
and acquiring a corresponding relation between a preset character and a database, and searching a first database corresponding to the first character from the preset database set according to the corresponding relation.
5. The method according to claim 4, wherein the correspondence is obtained by:
determining M databases according to the concurrency, wherein the M databases form a preset database set, and M is a positive integer;
determining a character range corresponding to the first character, and dividing characters in the character range into M character classifications;
and aiming at any character classification, determining the database corresponding to the character classification from the preset database set, and establishing the corresponding relation between the database and the characters in the character classification.
6. The method of claim 1, wherein storing the data to be stored and the first data identifier to the first database comprises:
determining a storage mode corresponding to the data to be stored, wherein the storage mode comprises static storage or dynamic storage;
and storing the data to be stored and the first data identifier to the first database according to the storage mode.
7. The method of claim 1, further comprising:
responding to a data query request, acquiring a second data identifier, and performing hash processing on the second data identifier to obtain a second hash value corresponding to the second data identifier;
and according to the second hash value, determining a second database from the preset database set, and inquiring the data to be inquired corresponding to the second data identifier from the second database.
8. The method according to claim 7, wherein said determining a second database from the preset database set according to the second hash value comprises:
and extracting a second character in the second hash value, and determining a second database from the preset database set according to the second character.
9. The method of claim 8, wherein extracting the second character from the second hash value comprises:
and extracting the first N-bit characters in the second hash value as second characters, wherein N is a positive integer.
10. The method of claim 8, wherein said determining a second database from said predetermined set of databases based on said second character comprises:
and acquiring a corresponding relation between a preset character and a database, and searching a second database corresponding to the second character from the preset database in a centralized manner according to the corresponding relation.
11. A data storage device, the device comprising:
the data and identification acquisition module is used for responding to a data storage request and acquiring data to be stored and a first data identification corresponding to the data to be stored;
the identifier processing module is used for performing hash processing on the first data identifier to obtain a first hash value corresponding to the first data identifier;
the database set determining module is used for determining a preset database set;
the database determining module is used for determining a first database from the preset database set according to the first hash value;
and the data and identification storage module is used for storing the data to be stored and the first data identification to the first database.
12. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing the communication between the processor and the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 10 when executing a program stored in the memory.
13. A storage medium on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-10.
CN202211430267.5A 2022-11-15 2022-11-15 Data storage method and device, electronic equipment and storage medium Pending CN115757406A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211430267.5A CN115757406A (en) 2022-11-15 2022-11-15 Data storage method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211430267.5A CN115757406A (en) 2022-11-15 2022-11-15 Data storage method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115757406A true CN115757406A (en) 2023-03-07

Family

ID=85371746

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211430267.5A Pending CN115757406A (en) 2022-11-15 2022-11-15 Data storage method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115757406A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111144926A (en) * 2019-11-27 2020-05-12 泰康保险集团股份有限公司 Service request processing method, device, system, electronic equipment and readable medium
CN116432238B (en) * 2023-06-05 2023-09-08 全中半导体(深圳)有限公司 Data storage method and device and storage chip

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111144926A (en) * 2019-11-27 2020-05-12 泰康保险集团股份有限公司 Service request processing method, device, system, electronic equipment and readable medium
CN111144926B (en) * 2019-11-27 2023-07-18 泰康保险集团股份有限公司 Service request processing method, device, system, electronic equipment and readable medium
CN116432238B (en) * 2023-06-05 2023-09-08 全中半导体(深圳)有限公司 Data storage method and device and storage chip

Similar Documents

Publication Publication Date Title
US10073916B2 (en) Method and system for facilitating terminal identifiers
JP5575902B2 (en) Information retrieval based on query semantic patterns
CN115757406A (en) Data storage method and device, electronic equipment and storage medium
CN109885786B (en) Data caching processing method and device, electronic equipment and readable storage medium
CN107239701B (en) Method and device for identifying malicious website
CN110427386B (en) Data processing method, device and computer storage medium
CN110321480B (en) Recommendation information pushing method and device, computer equipment and storage medium
US11288274B1 (en) System and method for storing data for, and providing, rapid database join functions and aggregation statistics
CN111488626A (en) Data processing method, device, equipment and medium based on block chain
CN111080374A (en) Test method of advertisement delivery strategy, bidding server and advertisement delivery system
CN108154024B (en) Data retrieval method and device and electronic equipment
CN111625348A (en) Task allocation method, device, server and storage medium
CN111125240B (en) Distributed transaction realization method and device, electronic equipment and storage medium
CN112835885A (en) Processing method, device and system for distributed table storage
CN112437148B (en) Service request processing method and device, service server and system
CN110727895B (en) Sensitive word sending method and device, electronic equipment and storage medium
CN110020040B (en) Method, device and system for querying data
CN113163027B (en) Data identifier generation method, device, equipment and storage medium
US8281000B1 (en) Variable-length nonce generation
CN114490719A (en) Data query method and device, electronic equipment and storage medium
CN113868687A (en) Task processing progress management method and device
US11449499B1 (en) System and method for retrieving data
CN109033469B (en) Ranking method and device of search results, terminal and computer storage medium
CN113392138B (en) Statistical analysis method, device, server and storage medium for private data
CN111639103B (en) Service data processing method, device, computer system and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination