WO2021042993A1 - Redis protocol-based kv data storage method and apparatus - Google Patents

Redis protocol-based kv data storage method and apparatus Download PDF

Info

Publication number
WO2021042993A1
WO2021042993A1 PCT/CN2020/110076 CN2020110076W WO2021042993A1 WO 2021042993 A1 WO2021042993 A1 WO 2021042993A1 CN 2020110076 W CN2020110076 W CN 2020110076W WO 2021042993 A1 WO2021042993 A1 WO 2021042993A1
Authority
WO
WIPO (PCT)
Prior art keywords
keyword
data
value
protocol data
protocol
Prior art date
Application number
PCT/CN2020/110076
Other languages
French (fr)
Chinese (zh)
Inventor
陈景
杨军
黎君
陈晓峰
胡思文
卢道和
Original Assignee
深圳前海微众银行股份有限公司
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 深圳前海微众银行股份有限公司 filed Critical 深圳前海微众银行股份有限公司
Publication of WO2021042993A1 publication Critical patent/WO2021042993A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • G06F11/1464Management of the backup or restore process for networked environments
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Definitions

  • the invention relates to the field of distributed storage of financial technology (Fintech), in particular to a KV data storage method and device based on the Redis protocol.
  • Redis database a distributed storage database widely used by various enterprises, adopts a master-slave replication mode, that is, when one or more slave nodes are connected to the master node, the master node will copy the data to one or more From the node, multiple backups of data can be realized.
  • These backup data can greatly improve the read performance of the Redis service, and it is also the basis for ensuring the high availability and distribution of the Redis service.
  • the Redis database when data is backed up based on the Redis protocol, the data replication process from the master node to multiple slave nodes is performed asynchronously.
  • This asynchronous replication method may cause data inconsistency between the master and slave nodes, which cannot guarantee strong data consistency. For example, when the network is disconnected for a long time or the master node is down, the Redis database will elect a slave node as the new master node, but the original master node has not sent the latest data to the new master node for backup in time, resulting in The data in the new master node is incomplete.
  • the present invention provides a KV data storage method and device based on the Redis protocol to solve the problem of inconsistent data backup based on the Redis database.
  • an embodiment of the present invention provides a KV data storage method based on the Redis protocol, the method includes: obtaining Redis protocol data, obtaining a first keyword of the Redis protocol data and data corresponding to the first keyword , Wherein the data type of the data corresponding to the first keyword is a preset type; according to the data type of the data corresponding to the first keyword, the preset identification symbol corresponding to the data type is acquired; based on the first keyword A keyword and the preset identification symbol are used to obtain a second keyword; according to the data corresponding to the second keyword and the first keyword, KV protocol data is obtained, and the preset identification symbol is used to indicate The data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword; the KV protocol data is sent to the KV database for storage.
  • this solution converts the obtained Redis protocol data into KV protocol data and sends it to the KV database for storage, which is helpful To ensure strong data consistency between the master and slave nodes that apply Redis protocol data.
  • the data corresponding to the first keyword includes a first value
  • the preset identification symbol is the first identification character corresponding to the character string ;
  • Obtaining KV protocol data according to the data corresponding to the second keyword and the first keyword includes: obtaining the KV protocol data according to the second keyword and the first value.
  • the data corresponding to the first keyword includes a second value
  • the preset identification symbol is the second corresponding to the hash.
  • An identification character, or a third identification character corresponding to a set the second keyword includes a metadata keyword and an actual data keyword; the second keyword is obtained based on the first keyword and the preset identification symbol.
  • the step of keyword includes: obtaining the metadata keyword based on the first keyword and the preset identification symbol; obtaining the actual data key based on the first keyword and the preset identification symbol
  • the method further includes: according to the number of elements corresponding to the first keyword, determining that the data corresponding to the metadata keyword includes a third value; according to the second keyword and the first
  • the data corresponding to the keyword to obtain the KV protocol data includes: obtaining the KV protocol data according to the second keyword, the second value, and the third value, and the second value corresponds to the Describe the actual data keywords.
  • the preset type is a list
  • the data corresponding to the first keyword includes a fourth value
  • the preset identification symbol is the fourth identification character corresponding to the list
  • the second keyword includes a metadata keyword and an actual data keyword
  • the step of obtaining the second keyword based on the first keyword and the preset identification symbol includes: based on the first keyword and The fourth identification character obtains the metadata keyword
  • the actual data keyword is obtained based on the first keyword and the fourth identification character
  • the method further includes: according to the first key The number of elements corresponding to the word and the ordering of the elements, it is determined that the data corresponding to the metadata keyword includes the fifth value
  • the KV is obtained according to the data corresponding to the second keyword and the first keyword
  • the protocol data includes: obtaining the KV protocol data according to the second keyword, the fourth value, and the fifth value, and the fourth value corresponds to the actual data keyword.
  • the above three schemes convert the obtained Redis protocol data of multiple data types into the KV protocol of the corresponding data type
  • the data is sent to the KV database for storage, which helps to ensure strong data consistency between the master and slave nodes that apply the multiple data types of the Redis protocol data in the above three schemes, and realizes the conversion of multiple data types And storage, improving the flexibility and diversity of data storage.
  • the request message sent by the client is received; the first KV protocol data corresponding to the request message is obtained; the first KV protocol data is converted into the first Redis protocol data; The terminal sends the first Redis protocol data.
  • a client-based request can be realized, and the stored KV protocol data is converted into Redis protocol data and then sent to the client.
  • an embodiment of the present invention provides a KV data storage device based on the Redis protocol.
  • the device includes: a first obtaining unit configured to obtain Redis protocol data, and obtain a first keyword of the Redis protocol data and the The data corresponding to the first keyword, wherein the data type of the data corresponding to the first keyword is a preset type; the second obtaining unit is configured to obtain all the data according to the data type of the data corresponding to the first keyword The preset identification symbol corresponding to the data type; the conversion unit, based on the first keyword and the preset identification symbol, obtains a second keyword; according to the second keyword and the first keyword corresponding to Data to obtain KV protocol data, the preset identification symbol is used to indicate that the data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword; the communication unit is used to send the KV protocol data to KV database for storage.
  • this solution converts the obtained Redis protocol data into KV protocol data and sends it to the KV database for storage, which is helpful To ensure strong data consistency between the master and slave nodes that apply Redis protocol data.
  • the conversion unit is specifically configured to obtain the KV protocol data according to the second keyword and the first value.
  • the data corresponding to the first keyword includes a second value
  • the preset identification symbol is the second corresponding to the hash.
  • the identification character, or the third identification character corresponding to the set, the second keyword includes a metadata keyword and an actual data keyword;
  • the conversion unit is specifically configured to: based on the first keyword and the preset Set an identification symbol to obtain the metadata keyword; obtain the actual data keyword based on the first keyword and the preset identification symbol; determine according to the number of elements corresponding to the first keyword
  • the data corresponding to the metadata keyword includes a third value; the KV protocol data is obtained according to the second keyword, the second value, and the third value, and the second value Correspond to the actual data keyword.
  • the conversion unit is specifically configured to: obtain the metadata keyword based on the first keyword and the fourth identification character;
  • the first keyword and the fourth identification character are used to obtain the actual data keyword; according to the number of elements corresponding to the first keyword and the order of the elements, the metadata keyword corresponding to the
  • the data includes a fifth value;
  • the KV protocol data is obtained according to the second keyword, the fourth value, and the fifth value, and the fourth value corresponds to the actual data keyword.
  • the above three schemes convert the obtained Redis protocol data of multiple data types into the KV protocol of the corresponding data type
  • the data is sent to the KV database for storage, which helps to ensure strong data consistency between the master and slave nodes that apply the multiple data types of the Redis protocol data in the above three schemes, and realizes the conversion of multiple data types And storage, improving the flexibility and diversity of data storage.
  • the communication unit is further configured to receive a request message sent by the client; the first acquiring unit is further configured to acquire the first KV protocol data corresponding to the request message; The conversion unit is further configured to convert the first KV protocol data into first Redis protocol data; the communication unit is also configured to send the first Redis protocol data to the client.
  • a client-based request can be realized, and the stored KV protocol data is converted into Redis protocol data and then sent to the client.
  • an embodiment of the present invention provides a computing device, including:
  • Memory used to store program instructions
  • the processor is configured to call the program instructions stored in the memory, and execute the method according to any one of the above-mentioned first aspects according to the obtained program.
  • an embodiment of the present invention provides a computer storage medium that stores computer-executable instructions, and the computer-executable instructions are used to cause a computer to execute any one of the above-mentioned first aspects. method.
  • Figure 1 is a possible system architecture provided by an embodiment of the present invention
  • Figure 2 is a KV data storage method based on the Redis protocol provided by an embodiment of the present invention
  • Figure 3 is a method for invoking Redis protocol data stored in KV encoding format according to an embodiment of the present invention
  • Figure 4 is a KV data storage device based on the Redis protocol provided by an embodiment of the present invention.
  • the architecture includes a data storage device 102 and a database 103.
  • the architecture may also include the client 101.
  • the data storage device 102 is used to convert Redis protocol data into KV protocol data, and send the KV protocol data to the database 103 for storage; and, based on the request of the client 101, obtain the KV protocol data from the database 103 and The KV protocol data is converted into Redis protocol data, and then the Redis protocol data is sent to the client 101.
  • the database 103 is used to store data based on the KV protocol.
  • the client 101 is configured to send a request message to the data storage device 102 to request to obtain Redis protocol data, and to receive the Redis protocol data from the data storage device 102.
  • an embodiment of the present invention provides a KV data storage method based on the Redis protocol.
  • the method can be executed by the data storage device 102 in FIG. 1. As shown in FIG. 2, the method includes the following steps:
  • Step 201 Obtain Redis protocol data, and obtain a first keyword of the Redis protocol data and data corresponding to the first keyword, wherein the data type of the data corresponding to the first keyword is a preset type.
  • Redis protocol data include but are not limited to the following four types: string (String), hash (Hash), set (Set), and list (List). Among them, Redis protocol data can be represented by Key-Value values.
  • Step 202 Obtain a preset identification symbol corresponding to the data type according to the data type of the data corresponding to the first keyword.
  • Step 203 Obtain a second keyword based on the first keyword and the preset identification symbol; obtain KV protocol data according to the data corresponding to the second keyword and the first keyword.
  • the identification symbol is used to indicate that the data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword.
  • KV protocol data include but are not limited to the following four types: String, Hash, Set, List. Among them, KV protocol data can all be represented by Key-Value values.
  • the data type of the Redis protocol data is a string
  • the data type of the converted KV protocol data is also a string
  • the data type of the Redis protocol data is a hash
  • the conversion The data type of the subsequent KV protocol data is also a hash
  • the data type of the Redis protocol data is a collection
  • the data type of the converted KV protocol data is also a collection
  • the converted The data type of the KV protocol data is also a list.
  • Redis protocol data For Redis protocol data, String is a simple data type. Therefore, when the Redis protocol data whose data type is String is converted into KV protocol data, the converted KV protocol data includes a data item, that is, actual data. Hash, Set, and List are complex data types. Therefore, when the Redis protocol data with the data type of Hash, Set, or List is converted into KV protocol data, the converted KV protocol data includes at least two data items, namely metadata and Actual data. Metadata mainly records additional information about the three types of data: Hash, Set, or List.
  • the metadata information when the data type is Hash, Set, the metadata information includes data size (Size) and expiration time (Time to Live, TTL) , Flag (Flag), etc.; when the data type is List, the metadata information includes header information (Head), tail information (Tail), data capacity (Size), expiration time (Time to Live, TTL), flag bit (Flag) and so on.
  • Step 204 Send the KV protocol data to the KV database for storage.
  • this solution converts the obtained Redis protocol data into KV protocol data and sends it to the KV database for storage, which is helpful To ensure strong data consistency between the master and slave nodes that apply Redis protocol data. Therefore, when the Redis service is disconnected from the network for a long time or the master node is down and the data of the master and slave nodes are inconsistent, this solution helps to ensure the data consistency between the master and slave nodes that apply the Redis protocol data.
  • Redis protocol data According to the data type of Redis protocol data, the specific implementation method of converting Redis protocol data into KV protocol data is given below.
  • a string of Redis protocol data contains the key (Key) as alice_account and the value (Value) as 4300212333111110000.
  • the keyword (alice_account) here is also called the first keyword, and the value here (43000212333111110000) is also called the first value.
  • the second key is 1alice_account
  • this key 1alice_account may also be called the actual data key.
  • the second keyword 1alice_account is obtained based on the first keyword alice_account and the first identification character "1", that is, the first identification character "1" is added before the first keyword alice_account to obtain the second keyword 1alice_account, the first identification
  • the character "1" is used to indicate that the data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword alice_account, and both are String.
  • the value corresponding to the second keyword is 4300212333111110000, that is, the value corresponding to the second keyword is the same as the value corresponding to the first keyword, and both are the first value.
  • Case 2 The data type of the Redis protocol data is Hash, and the Redis protocol data includes the first keyword and the second value.
  • Hash the data type of the Redis protocol data is Hash.
  • a piece of Hash type Redis protocol data contains the key (Key) as alice, and the value (Key) is name (Alice), age (18), country (China) and birthday (2000/1/1).
  • the keyword (alice) here is also called the first keyword, and the value here (name (Alice), age (18), country (China) and birthday (2000/1/1)) is also called The second value.
  • the second keywords are 2alice, 25alicename, 25aliceage, 25alicecountry, and 25alicebirthday.
  • 2alice is a metadata keyword
  • 25alicename, 25aliceage, 25alicecountry, and 25alicebirthday are all actual data keywords.
  • the second identification character is used to indicate the data type of the KV protocol data and the data corresponding to the first keyword alice
  • the data types of are the same, all are Hash.
  • the second identification character "2" is added before the first keyword alice to obtain the second keyword 2alice.
  • the value corresponding to the second keyword includes 4201908081, where the first number "4" in 4201908081 indicates that the number of elements corresponding to the first keyword is 4, which means that the KV protocol data obtained after conversion is The number of elements corresponding to the actual data key is 4.
  • the number “4" can also be called the third value, and the third value is used as the data corresponding to the metadata key; the middle 8-digit number 20190808 represents TTL, the last one
  • the digit "1” means Flag, and Flag is usually pre-defined, such as “1” means valid, and "0" means expired.
  • the second keyword 25alicename that is, in the actual data keywords of the second keyword, the first keyword alice is included, and the name in the second value name (Alice) is also included; among them, the first place in 25alicename
  • the number "2" is the second identification character, which is used to indicate that the data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword alice, both of which are Hash; the second number "5" in 25alicename is used for Indicates that the string length of the first keyword alice is 5 characters. That is, the second keyword 25alicename is determined according to the first keyword alice, the name in the second value corresponding to the first keyword, the second identification symbol "2", and the string length of the first keyword alice.
  • the values corresponding to the second keywords 25alicename, 25aliceage, 25alicecountry, and 25alicebirthday include a part of the second value, which are Alice, 19, China, and 2000/1/1, respectively.
  • Case 3 The data type of the Redis protocol data is Set, and the Redis protocol data includes the first keyword and the second value.
  • Redis protocol data As shown in Table 5, it is an example of information when the data type of the Redis protocol data is Set.
  • a set of Redis protocol data contains the keyword (Key) as favorite_fruits, and the value (Value) is apple, banana, and pearl.
  • the keyword (favorite_fruits) here is also called the first keyword
  • the value (apple, banana, pear) here is also called the second value.
  • 3favorite_fruits is a metadata keyword
  • 315favorite_fruitsapple, 315favorite_fruitsbanana, and 315favorite_fruitspear are all actual data keywords.
  • the third identification character is used to indicate the data type of the KV protocol data and the data corresponding to the first keyword favorite_fruits
  • the data types of are the same, both are Set.
  • the third identification character "3" is added before the first keyword favorite_fruits to obtain the second keyword 3 favorite_fruits.
  • the value corresponding to the second keyword includes 3201908081, where the first digit "3" in 3201908081 indicates that the number of elements corresponding to the first keyword is 3, which means that the KV protocol data obtained after conversion is The number of elements corresponding to the actual data key is 3.
  • the number “3” can also be called the third value, and the third value is used as the data corresponding to the metadata key; the middle 8-digit number 20190808 represents TTL, the last one
  • the digit "1” means Flag, and Flag is usually pre-defined, such as “1” means valid, and "0" means expired.
  • the second keyword 315favorite_fruitsapple that is, the actual data keywords of the second keyword include the first keyword favorite_fruits and the second value apple; among them, the first digit "3" in 315favorite_fruitsapple is the third Identification character, used to indicate that the data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword favorite_fruits, both are Set; the second and third digits in 315 favorite_fruitsapple are combined with the number "15" for The length of the string representing the first keyword favorite_fruits is 15 characters. That is, the second keyword 315 favorite_fruitsapple is determined according to the first keyword favorite_fruits, the second value apple corresponding to the first keyword, the third identification character "3", and the string length of the first keyword favorite_fruits.
  • the values corresponding to the second keywords 315favorite_fruitsapple, 315favorite_fruitsbanana, and 315favorite_fruitspear include the second values, which are apple, banana, and pear, respectively.
  • Redis protocol data is List.
  • a piece of Redis protocol data of List type contains the keyword (Key) as students_class_one, and the value (Value) is Grace, David, Peter, Daniel and Mary.
  • the keyword here is also called the first keyword, and the value here (Grace, David, Peter, Daniel, Mary) is also called the fourth value.
  • 4students_class_one 418students_class_one1, 418students_class_one2, 418students_class_one3, 418students_class_one4 and 418students_class_one5.
  • 4students_class_one is a metadata keyword
  • 418students_class_one1, 418students_class_one2, 418students_class_one3, 418students_class_one4, and 418students_class_one5 are all actual data keywords.
  • the fourth identification character is used to indicate the data type of the KV protocol data and the data corresponding to the first keyword students_class_one
  • the data types are the same, both are List.
  • the fourth identification character "4" is added before the first keyword students_class_one to obtain the second keyword 4 students_class_one.
  • the value corresponding to the second keyword includes 155201908081, where the first digit "1" in 155201908081 indicates that the order of the elements corresponding to the first keyword starts from "1", and the second digit "5" indicates the first The sorting of the elements corresponding to the keyword ends with "5".
  • the third digit "5" indicates that the number of elements corresponding to the first keyword is 5, which means that the actual data keyword in the KV protocol data obtained after conversion is indicated.
  • the number of corresponding elements is 5.
  • the number “155" which is the combination of the first digit “1", the second digit "5" and the third digit "5" can also be called the fifth value, the fifth The value is taken as the data corresponding to the metadata keyword; the middle 8 digits 20190808 means TTL, and the last digit "1" means Flag.
  • Flag is predefined, such as “1” means valid, and "0" means expired.
  • the second keyword 418students_class_one1 that is, the actual data keywords of the second keyword include the first keyword students_class_one; among them, the first number "4" in 418students_class_one1 is the fourth identification character, which is used to indicate the KV
  • the data type of the protocol data is consistent with the data type of the data corresponding to the first keyword students_class_one, both are List; the number "18" combined with the second and third digits in 418students_class_one1 is used to represent the character of the first keyword students_class_one
  • the string length is 18 characters, and the last digit "1" in 418students_class_one1 is used to indicate that the fourth value Grace corresponding to the first keyword is ranked as 1. That is, the second keyword 418 students_class_one1 is determined according to the first keyword students_class_one, the ranking of the fourth value Grace corresponding to the first keyword, the fourth identification symbol "4", and the string length of the first keyword students_class_one.
  • the values corresponding to the second keywords 418students_class_one1, 418students_class_one2, 418students_class_one3, 418students_class_one4, and 418students_class_one5 include the fourth value, which are Grace, David, Peter, Daniel, and Mary, respectively.
  • the first identification character in the KV protocol data of the String data type is "1”
  • the second identification character in the KV protocol data of the Hash data type is "2”
  • the KV of the Set data type is "1”.
  • the third identification character in the protocol data is "3”
  • the fourth identification character in the KV protocol data of the List data type is "4".
  • the preset identification symbols in the KV protocol data of different data types can also adopt other methods, which can be determined according to actual needs.
  • the above example can also adopt the following methods: the preset identification symbols in the KV protocol data of the String data type, the Set data type, the List data type, and the Hash data type are "1", "2", "3", " 4" and so on.
  • the preset identification symbol may be located in the first position of the second keyword, may also be located in the last position of the second keyword, or may also be in other positions, which is not limited by the present invention.
  • a method for calling Redis protocol data stored in the KV encoding format is also provided. As shown in Figure 3, the method includes the following steps:
  • Step 301 Receive a request message from the client
  • Step 302 Obtain the first KV protocol data corresponding to the request message
  • Step 303 Convert the first KV protocol data into the first Redis protocol data
  • Step 304 Send the first Redis protocol data to the client.
  • a client-based request can be realized, and the stored KV protocol data is converted into Redis protocol data and then sent to the client.
  • an embodiment of the present invention also provides a KV data storage device based on the Redis protocol. As shown in FIG. 4, the device includes:
  • the first obtaining unit 401 is configured to obtain Redis protocol data, obtain a first keyword of the Redis protocol data and data corresponding to the first keyword, wherein the data type of the data corresponding to the first keyword is Preset type
  • the second obtaining unit 402 is configured to obtain a preset identification symbol corresponding to the data type according to the data type of the data corresponding to the first keyword;
  • the conversion unit 403 obtains a second keyword based on the first keyword and the preset identification symbol; obtains KV protocol data according to the data corresponding to the second keyword and the first keyword, and The preset identification symbol is used to indicate that the data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword;
  • the communication unit 404 is configured to send the KV protocol data to the KV database for storage.
  • the conversion unit 403 is specifically configured to obtain the KV protocol data according to the second keyword and the first value.
  • the conversion unit 403 is specifically configured to: based on the first keyword and the preset Identification symbol to obtain the metadata keyword; based on the first keyword and the preset identification symbol to obtain the actual data keyword; according to the number of elements corresponding to the first keyword, determine the The data corresponding to the metadata keyword includes a third value; according to the second keyword, the second value, and the third value, the KV protocol data is obtained, and the second value corresponds to The actual data key.
  • the conversion unit 403 is specifically configured to: obtain the metadata keyword based on the first keyword and the fourth identification character; The first keyword and the fourth identification character are used to obtain the actual data keyword; the data corresponding to the metadata keyword is determined according to the number of elements corresponding to the first keyword and the order of the elements It includes a fifth value; the KV protocol data is obtained according to the second keyword, the fourth value, and the fifth value, and the fourth value corresponds to the actual data keyword.
  • the communication unit 404 is further configured to receive a request message from the client; the first obtaining unit 401 is further configured to obtain the first KV protocol data corresponding to the request message; The conversion unit 403 is further configured to convert the first KV protocol data into first Redis protocol data; the communication unit 404 is also configured to send the first Redis protocol data to the client.
  • the embodiment of the present invention provides a computing device, and the computing device may specifically be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (Personal Digital Assistant, PDA), etc.
  • the computing device may include a central processing unit (CPU), a memory, an input/output device, etc.
  • the input device may include a keyboard, a mouse, a touch screen, etc.
  • an output device may include a display device, such as a liquid crystal display (Liquid Crystal Display, LCD), Cathode Ray Tube (CRT), etc.
  • the memory may include read-only memory (ROM) and random access memory (RAM), and provides the processor with program instructions and data stored in the memory.
  • ROM read-only memory
  • RAM random access memory
  • the memory can be used to store the program instructions of the KV data storage method based on the Redis protocol;
  • the processor is used to call the program instructions stored in the memory, and execute the KV data storage method based on the Redis protocol according to the obtained program.
  • the embodiment of the present invention provides a computer storage medium that stores computer executable instructions, and the computer executable instructions are used to make a computer execute a KV data storage method based on the Redis protocol.
  • the embodiments of the present invention can be provided as methods or computer program products. Therefore, the present invention may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
  • a computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.

Abstract

Provided in the present invention are a Redis protocol-based KV data storage method and apparatus. Redis protocol data is acquired, and a first keyword of the Redis protocol data and data corresponding to the first keyword are acquired; according to the data type of the data corresponding to the first keyword, a preset identification symbol corresponding to the data type is acquired; a second keyword is obtained on the basis of the first keyword and the preset identification symbol; KV protocol data is obtained according to the second keyword and the data corresponding to the first keyword; and the KV protocol data is sent to a KV database for storage. On the basis of the described solution, since the KV database may ensure data consistency between master and slave nodes in which the KV protocol data is applied, the present solution converts the acquired Redis protocol data into the KV protocol data and sends same to the KV database for storage, which helps to ensure strong data consistency between the master and slave nodes in which the Redis protocol data is applied.

Description

一种基于Redis协议的KV数据存储方法及装置KV data storage method and device based on Redis protocol
相关申请的交叉引用Cross-references to related applications
本申请要求在2019年09月04日提交中国专利局、申请号为201910830696.3、申请名称为“一种基于Redis协议的KV数据存储方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on September 4, 2019, the application number is 201910830696.3, and the application name is "A KV data storage method and device based on the Redis protocol", the entire content of which is incorporated by reference Incorporated in this application.
技术领域Technical field
本发明涉及金融科技(Fintech)的分布式存储领域,尤其涉及一种基于Redis协议的KV数据存储方法及装置。The invention relates to the field of distributed storage of financial technology (Fintech), in particular to a KV data storage method and device based on the Redis protocol.
背景技术Background technique
随着计算机的普及和信息技术的进步,特别是企业计算机网络的飞速发展,企业信息安全的重要性日趋明显,因而对作为企业信息安全的一项重要内容的数据备份提出了严格的要求。目前为各企业广泛使用的一种分布式存储数据库——Redis数据库,通过采用主从复制模式,即当一个或多个从节点连接上主节点时,主节点会将数据复制到一个或多个从节点上,从而实现对数据的多个备份。这些备份数据可以很大程度提高Redis服务的读性能,同时也是保证Redis服务高可用和分布式的基础。With the popularization of computers and the advancement of information technology, especially the rapid development of corporate computer networks, the importance of corporate information security has become increasingly obvious. Therefore, strict requirements have been placed on data backup as an important part of corporate information security. Currently, Redis database, a distributed storage database widely used by various enterprises, adopts a master-slave replication mode, that is, when one or more slave nodes are connected to the master node, the master node will copy the data to one or more From the node, multiple backups of data can be realized. These backup data can greatly improve the read performance of the Redis service, and it is also the basis for ensuring the high availability and distribution of the Redis service.
然而,在Redis数据库中,基于Redis协议的数据在进行数据备份时,主节点到多个从节点的数据复制过程是异步进行的。这种异步复制的方式可能会出现主从节点数据不一致的情况,从而不能保证较强的数据一致性。例如,在长时间断网或者主节点宕机时,Redis数据库就会选举某个从节点作为新的主节点,但原主节点还未及时将最新数据发送至该新的主节点进行备份,从而导致该新的主节点中的数据不完整。However, in the Redis database, when data is backed up based on the Redis protocol, the data replication process from the master node to multiple slave nodes is performed asynchronously. This asynchronous replication method may cause data inconsistency between the master and slave nodes, which cannot guarantee strong data consistency. For example, when the network is disconnected for a long time or the master node is down, the Redis database will elect a slave node as the new master node, but the original master node has not sent the latest data to the new master node for backup in time, resulting in The data in the new master node is incomplete.
发明内容Summary of the invention
本发明提供一种基于Redis协议的KV数据存储方法及装置,用以解决基于Redis数据库进行备份的数据不一致的问题。The present invention provides a KV data storage method and device based on the Redis protocol to solve the problem of inconsistent data backup based on the Redis database.
第一方面,本发明实施例提供一种基于Redis协议的KV数据存储方法,该方法包括:获取Redis协议数据,获取所述Redis协议数据的第一关键字和所述第一关键字对应的数据,其中,所述第一关键字对应的数据的数据类型为预设类型;根据所述第一关键字对应的数据的数据类型,获取所述数据类型对应的预设标识符号;基于所述第一关键字和所述 预设标识符号,得到第二关键字;根据所述第二关键字和所述第一关键字对应的数据,得到KV协议数据,所述预设标识符号用于指示所述KV协议数据的数据类型与第一关键字对应的数据的数据类型一致;将所述KV协议数据发送至KV数据库进行存储。In the first aspect, an embodiment of the present invention provides a KV data storage method based on the Redis protocol, the method includes: obtaining Redis protocol data, obtaining a first keyword of the Redis protocol data and data corresponding to the first keyword , Wherein the data type of the data corresponding to the first keyword is a preset type; according to the data type of the data corresponding to the first keyword, the preset identification symbol corresponding to the data type is acquired; based on the first keyword A keyword and the preset identification symbol are used to obtain a second keyword; according to the data corresponding to the second keyword and the first keyword, KV protocol data is obtained, and the preset identification symbol is used to indicate The data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword; the KV protocol data is sent to the KV database for storage.
基于该方案,由于KV数据库可以保证应用KV协议数据的主从节点之间的数据一致性,本方案将获取到的Redis协议数据转换为KV协议数据,并发送至KV数据库进行存储,因而有助于保证应用Redis协议数据的主从节点之间的数据强一致性。Based on this solution, since the KV database can ensure data consistency between the master and slave nodes that apply KV protocol data, this solution converts the obtained Redis protocol data into KV protocol data and sends it to the KV database for storage, which is helpful To ensure strong data consistency between the master and slave nodes that apply Redis protocol data.
在一种可能的实现方法中,若所述预设类型为字符串,则所述第一关键字对应的数据包括第一取值,所述预设标识符号为字符串对应的第一标识字符;根据所述第二关键字和所述第一关键字对应的数据,得到KV协议数据,包括:根据所述第二关键字和所述第一取值,得到所述KV协议数据。In a possible implementation method, if the preset type is a character string, the data corresponding to the first keyword includes a first value, and the preset identification symbol is the first identification character corresponding to the character string ; Obtaining KV protocol data according to the data corresponding to the second keyword and the first keyword includes: obtaining the KV protocol data according to the second keyword and the first value.
在一种可能的实现方法中,若所述预设类型为哈希或集合,则所述第一关键字对应的数据包括第二取值,所述预设标识符号为哈希对应的第二标识字符、或为集合对应的第三标识字符,所述第二关键字包括元数据关键字和实际数据关键字;所述基于所述第一关键字和所述预设标识符号,得到第二关键字的步骤包括:基于所述第一关键字和所述预设标识符号,得到所述元数据关键字;基于所述第一关键字和所述预设标识符号,得到所述实际数据关键字;所述方法还包括:根据所述第一关键字对应的元素的个数,确定所述元数据关键字对应的数据包括第三取值;根据所述第二关键字和所述第一关键字对应的数据,得到KV协议数据,包括:根据所述第二关键字、所述第二取值和所述第三取值,得到所述KV协议数据,所述第二取值对应所述实际数据关键字。In a possible implementation method, if the preset type is a hash or a set, the data corresponding to the first keyword includes a second value, and the preset identification symbol is the second corresponding to the hash. An identification character, or a third identification character corresponding to a set, the second keyword includes a metadata keyword and an actual data keyword; the second keyword is obtained based on the first keyword and the preset identification symbol The step of keyword includes: obtaining the metadata keyword based on the first keyword and the preset identification symbol; obtaining the actual data key based on the first keyword and the preset identification symbol The method further includes: according to the number of elements corresponding to the first keyword, determining that the data corresponding to the metadata keyword includes a third value; according to the second keyword and the first The data corresponding to the keyword to obtain the KV protocol data includes: obtaining the KV protocol data according to the second keyword, the second value, and the third value, and the second value corresponds to the Describe the actual data keywords.
在一种可能的实现方法中,若所述预设类型为列表,则所述第一关键字对应的数据包括第四取值,所述预设标识符号为列表对应的第四标识字符,所述第二关键字包括元数据关键字和实际数据关键字;所述基于所述第一关键字和所述预设标识符号,得到第二关键字的步骤包括:基于所述第一关键字和所述第四标识字符,得到所述元数据关键字;基于所述第一关键字和所述第四标识字符,得到所述实际数据关键字;所述方法还包括:根据所述第一关键字对应的元素的个数和所述元素的排序,确定所述元数据关键字对应的数据包括第五取值;根据所述第二关键字和所述第一关键字对应的数据,得到KV协议数据,包括:根据所述第二关键字、所述第四取值和所述第五取值,得到所述KV协议数据,所述第四取值对应所述实际数据关键字。In a possible implementation method, if the preset type is a list, the data corresponding to the first keyword includes a fourth value, and the preset identification symbol is the fourth identification character corresponding to the list, so The second keyword includes a metadata keyword and an actual data keyword; the step of obtaining the second keyword based on the first keyword and the preset identification symbol includes: based on the first keyword and The fourth identification character obtains the metadata keyword; the actual data keyword is obtained based on the first keyword and the fourth identification character; the method further includes: according to the first key The number of elements corresponding to the word and the ordering of the elements, it is determined that the data corresponding to the metadata keyword includes the fifth value; the KV is obtained according to the data corresponding to the second keyword and the first keyword The protocol data includes: obtaining the KV protocol data according to the second keyword, the fourth value, and the fifth value, and the fourth value corresponds to the actual data keyword.
基于上述三种方案,由于KV数据库可以保证应用KV协议数据的主从节点之间的数据一致性,上述三种方案将获取到的多种数据类型的Redis协议数据转换为对应数据类型的KV协议数据,并发送至KV数据库进行存储,因而有助于保证应用上述三种方案中多 种数据类型的Redis协议数据的主从节点之间的数据强一致性,并且实现了多种数据类型的转换和存储,提高了数据存储的灵活性和多样性。Based on the above three schemes, since the KV database can ensure the data consistency between the master and slave nodes that apply the KV protocol data, the above three schemes convert the obtained Redis protocol data of multiple data types into the KV protocol of the corresponding data type The data is sent to the KV database for storage, which helps to ensure strong data consistency between the master and slave nodes that apply the multiple data types of the Redis protocol data in the above three schemes, and realizes the conversion of multiple data types And storage, improving the flexibility and diversity of data storage.
在一种可能的实现方法中,接收客户端发送的请求消息;获取所述请求消息对应的第一KV协议数据;将所述第一KV协议数据转换为第一Redis协议数据;向所述客户端发送所述第一Redis协议数据。In a possible implementation method, the request message sent by the client is received; the first KV protocol data corresponding to the request message is obtained; the first KV protocol data is converted into the first Redis protocol data; The terminal sends the first Redis protocol data.
本发明实施例中,可以实现基于客户端的请求,将存储的KV协议数据转换为Redis协议数据后发送至客户端。In the embodiment of the present invention, a client-based request can be realized, and the stored KV protocol data is converted into Redis protocol data and then sent to the client.
第二方面,本发明实施例提供一种基于Redis协议的KV数据存储装置,该装置包括:第一获取单元,用于获取Redis协议数据,获取所述Redis协议数据的第一关键字和所述第一关键字对应的数据,其中,所述第一关键字对应的数据的数据类型为预设类型;第二获取单元,用于根据所述第一关键字对应的数据的数据类型,获取所述数据类型对应的预设标识符号;转换单元,基于所述第一关键字和所述预设标识符号,得到第二关键字;根据所述第二关键字和所述第一关键字对应的数据,得到KV协议数据,所述预设标识符号用于指示所述KV协议数据的数据类型与第一关键字对应的数据的数据类型一致;通信单元,用于将所述KV协议数据发送至KV数据库进行存储。In a second aspect, an embodiment of the present invention provides a KV data storage device based on the Redis protocol. The device includes: a first obtaining unit configured to obtain Redis protocol data, and obtain a first keyword of the Redis protocol data and the The data corresponding to the first keyword, wherein the data type of the data corresponding to the first keyword is a preset type; the second obtaining unit is configured to obtain all the data according to the data type of the data corresponding to the first keyword The preset identification symbol corresponding to the data type; the conversion unit, based on the first keyword and the preset identification symbol, obtains a second keyword; according to the second keyword and the first keyword corresponding to Data to obtain KV protocol data, the preset identification symbol is used to indicate that the data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword; the communication unit is used to send the KV protocol data to KV database for storage.
基于该方案,由于KV数据库可以保证应用KV协议数据的主从节点之间的数据一致性,本方案将获取到的Redis协议数据转换为KV协议数据,并发送至KV数据库进行存储,因而有助于保证应用Redis协议数据的主从节点之间的数据强一致性。Based on this solution, since the KV database can ensure data consistency between the master and slave nodes that apply KV protocol data, this solution converts the obtained Redis protocol data into KV protocol data and sends it to the KV database for storage, which is helpful To ensure strong data consistency between the master and slave nodes that apply Redis protocol data.
在一种可能实现的方法中,若所述预设类型为字符串,则所述第一关键字对应的数据包括第一取值,所述预设标识符号为字符串对应的第一标识字符;所述转换单元,具体用于根据所述第二关键字和所述第一取值,得到所述KV协议数据。In a possible implementation method, if the preset type is a character string, the data corresponding to the first keyword includes a first value, and the preset identification symbol is the first identification character corresponding to the character string The conversion unit is specifically configured to obtain the KV protocol data according to the second keyword and the first value.
在一种可能实现的方法中,若所述预设类型为哈希或集合,则所述第一关键字对应的数据包括第二取值,所述预设标识符号为哈希对应的第二标识字符、或为集合对应的第三标识字符,所述第二关键字包括元数据关键字和实际数据关键字;所述转换单元,具体用于:基于所述第一关键字和所述预设标识符号,得到所述元数据关键字;基于所述第一关键字和所述预设标识符号,得到所述实际数据关键字;根据所述第一关键字对应的元素的个数,确定所述元数据关键字对应的数据包括第三取值;根据所述第二关键字、所述第二取值和所述第三取值,得到所述KV协议数据,所述第二取值对应所述实际数据关键字。In a possible implementation method, if the preset type is a hash or a set, the data corresponding to the first keyword includes a second value, and the preset identification symbol is the second corresponding to the hash. The identification character, or the third identification character corresponding to the set, the second keyword includes a metadata keyword and an actual data keyword; the conversion unit is specifically configured to: based on the first keyword and the preset Set an identification symbol to obtain the metadata keyword; obtain the actual data keyword based on the first keyword and the preset identification symbol; determine according to the number of elements corresponding to the first keyword The data corresponding to the metadata keyword includes a third value; the KV protocol data is obtained according to the second keyword, the second value, and the third value, and the second value Correspond to the actual data keyword.
在一种可能实现的方法中,若所述预设类型为列表,则所述第一关键字对应的数据包括第四取值,所述预设标识符号为列表对应的第四标识字符,所述第二关键字包括元数据关键字和实际数据关键字;所述转换单元,具体用于:基于所述第一关键字和所述第四标 识字符,得到所述元数据关键字;基于所述第一关键字和所述第四标识字符,得到所述实际数据关键字;根据所述第一关键字对应的元素的个数和所述元素的排序,确定所述元数据关键字对应的数据包括第五取值;根据所述第二关键字、所述第四取值和所述第五取值,得到所述KV协议数据,所述第四取值对应所述实际数据关键字。In a possible implementation method, if the preset type is a list, the data corresponding to the first keyword includes a fourth value, and the preset identification symbol is the fourth identification character corresponding to the list, so The second keyword includes a metadata keyword and an actual data keyword; the conversion unit is specifically configured to: obtain the metadata keyword based on the first keyword and the fourth identification character; The first keyword and the fourth identification character are used to obtain the actual data keyword; according to the number of elements corresponding to the first keyword and the order of the elements, the metadata keyword corresponding to the The data includes a fifth value; the KV protocol data is obtained according to the second keyword, the fourth value, and the fifth value, and the fourth value corresponds to the actual data keyword.
基于上述三种方案,由于KV数据库可以保证应用KV协议数据的主从节点之间的数据一致性,上述三种方案将获取到的多种数据类型的Redis协议数据转换为对应数据类型的KV协议数据,并发送至KV数据库进行存储,因而有助于保证应用上述三种方案中多种数据类型的Redis协议数据的主从节点之间的数据强一致性,并且实现了多种数据类型的转换和存储,提高了数据存储的灵活性和多样性。Based on the above three schemes, since the KV database can ensure the data consistency between the master and slave nodes that apply the KV protocol data, the above three schemes convert the obtained Redis protocol data of multiple data types into the KV protocol of the corresponding data type The data is sent to the KV database for storage, which helps to ensure strong data consistency between the master and slave nodes that apply the multiple data types of the Redis protocol data in the above three schemes, and realizes the conversion of multiple data types And storage, improving the flexibility and diversity of data storage.
在一种可能实现的方法中,所述通信单元,还用于接收客户端发送的请求消息;所述第一获取单元,还用于获取所述请求消息对应的第一KV协议数据;所述转换单元,还用于将所述第一KV协议数据转换为第一Redis协议数据;所述通信单元,还用于向所述客户端发送所述第一Redis协议数据。In a possible implementation method, the communication unit is further configured to receive a request message sent by the client; the first acquiring unit is further configured to acquire the first KV protocol data corresponding to the request message; The conversion unit is further configured to convert the first KV protocol data into first Redis protocol data; the communication unit is also configured to send the first Redis protocol data to the client.
基于该方案,可以实现基于客户端的请求,将存储的KV协议数据转换为Redis协议数据后发送至客户端。Based on this solution, a client-based request can be realized, and the stored KV protocol data is converted into Redis protocol data and then sent to the client.
第三方面,本发明实施例提供了一种计算设备,包括:In a third aspect, an embodiment of the present invention provides a computing device, including:
存储器,用于存储程序指令;Memory, used to store program instructions;
处理器,用于调用所述存储器中存储的程序指令,按照获得的程序执行如上述第一方面任一项所述的方法。The processor is configured to call the program instructions stored in the memory, and execute the method according to any one of the above-mentioned first aspects according to the obtained program.
第四方面,本发明实施例提供了一种计算机存储介质,所述计算机存储介质存储有计算机可执行指令,所述计算机可执行指令用于使计算机执行如上述第一方面任一项所述的方法。In a fourth aspect, an embodiment of the present invention provides a computer storage medium that stores computer-executable instructions, and the computer-executable instructions are used to cause a computer to execute any one of the above-mentioned first aspects. method.
附图说明Description of the drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions in the embodiments of the present invention more clearly, the following will briefly introduce the drawings needed in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative labor, other drawings can be obtained based on these drawings.
图1为本发明实施例提供的一种可能的***架构;Figure 1 is a possible system architecture provided by an embodiment of the present invention;
图2为本发明实施例提供的一种基于Redis协议的KV数据存储方法;Figure 2 is a KV data storage method based on the Redis protocol provided by an embodiment of the present invention;
图3为本发明实施例提供的一种调用以KV编码格式进行存储的Redis协议数据的方 法;Figure 3 is a method for invoking Redis protocol data stored in KV encoding format according to an embodiment of the present invention;
图4为本发明实施例提供的一种基于Redis协议的KV数据存储装置。Figure 4 is a KV data storage device based on the Redis protocol provided by an embodiment of the present invention.
具体实施方式detailed description
为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明作进一步地详细描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。In order to make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of them. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.
下面结合说明书附图对本发明实施例作进一步详细描述。The embodiments of the present invention will be described in further detail below in conjunction with the accompanying drawings of the specification.
如图1所示,为本发明实施例一种可能的***架构,基于该***架构可实现对基于Redis协议的KV数据存储。该架构包括数据存储装置102和数据库103。可选地,该架构还可以包括客户端101。As shown in FIG. 1, it is a possible system architecture of an embodiment of the present invention. Based on this system architecture, KV data storage based on the Redis protocol can be realized. The architecture includes a data storage device 102 and a database 103. Optionally, the architecture may also include the client 101.
其中,数据存储装置102用于将Redis协议数据转换为KV协议数据,并将KV协议数据发送至数据库103进行存储;以及,用于基于客户端101的请求,从数据库103获取KV协议数据并将该KV协议数据转换为Redis协议数据,然后将Redis协议数据发送至客户端101。Among them, the data storage device 102 is used to convert Redis protocol data into KV protocol data, and send the KV protocol data to the database 103 for storage; and, based on the request of the client 101, obtain the KV protocol data from the database 103 and The KV protocol data is converted into Redis protocol data, and then the Redis protocol data is sent to the client 101.
数据库103,用于存储基于KV协议的数据。The database 103 is used to store data based on the KV protocol.
客户端101,用于向数据存储装置102发送请求消息,以请求获取Redis协议数据,并接收来自于数据存储装置102的Redis协议数据。The client 101 is configured to send a request message to the data storage device 102 to request to obtain Redis protocol data, and to receive the Redis protocol data from the data storage device 102.
基于图1中的***架构,本发明实施例提供了一种基于Redis协议的KV数据存储方法,该方法可由图1中的数据存储装置102执行,如图2所示,该方法包括以下步骤:Based on the system architecture in FIG. 1, an embodiment of the present invention provides a KV data storage method based on the Redis protocol. The method can be executed by the data storage device 102 in FIG. 1. As shown in FIG. 2, the method includes the following steps:
步骤201,获取Redis协议数据,获取所述Redis协议数据的第一关键字和所述第一关键字对应的数据,其中,所述第一关键字对应的数据的数据类型为预设类型。Step 201: Obtain Redis protocol data, and obtain a first keyword of the Redis protocol data and data corresponding to the first keyword, wherein the data type of the data corresponding to the first keyword is a preset type.
Redis协议数据的数据类型包括但不限于以下四种:字符串(String)、哈希(Hash)、集合(Set)、列表(List)。其中,Redis协议数据均可以通过Key-Value值来表示。The data types of Redis protocol data include but are not limited to the following four types: string (String), hash (Hash), set (Set), and list (List). Among them, Redis protocol data can be represented by Key-Value values.
步骤202,根据所述第一关键字对应的数据的数据类型,获取所述数据类型对应的预设标识符号。Step 202: Obtain a preset identification symbol corresponding to the data type according to the data type of the data corresponding to the first keyword.
步骤203,基于所述第一关键字和所述预设标识符号,得到第二关键字;根据所述第二关键字和所述第一关键字对应的数据,得到KV协议数据,所述预设标识符号用于指示所述KV协议数据的数据类型与所述第一关键字对应的数据的数据类型一致。Step 203: Obtain a second keyword based on the first keyword and the preset identification symbol; obtain KV protocol data according to the data corresponding to the second keyword and the first keyword. The identification symbol is used to indicate that the data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword.
KV协议数据的数据类型包括但不限于以下四种:字符串(String)、哈希(Hash)、集 合(Set)、列表(List)。其中,KV协议数据均可以通过Key-Value值来表示。The data types of KV protocol data include but are not limited to the following four types: String, Hash, Set, List. Among them, KV protocol data can all be represented by Key-Value values.
将Redis协议数据转换为KV协议数据时,若Redis协议数据的数据类型为字符串,则转换后的KV协议数据的数据类型也为字符串;若Redis协议数据的数据类型为哈希,则转换后的KV协议数据的数据类型也为哈希;若Redis协议数据的数据类型为集合,则转换后的KV协议数据的数据类型也为集合;若Redis协议数据的数据类型为列表,则转换后的KV协议数据的数据类型也为列表。When converting Redis protocol data to KV protocol data, if the data type of the Redis protocol data is a string, the data type of the converted KV protocol data is also a string; if the data type of the Redis protocol data is a hash, then the conversion The data type of the subsequent KV protocol data is also a hash; if the data type of the Redis protocol data is a collection, the data type of the converted KV protocol data is also a collection; if the data type of the Redis protocol data is a list, the converted The data type of the KV protocol data is also a list.
对于Redis协议数据,String属于简单数据类型,因而在将数据类型为String的Redis协议数据转换为KV协议数据时,转换得到的KV协议数据包括一个数据项,即实际数据。Hash、Set和List属于复杂数据类型,因而在将数据类型为Hash、Set或List的Redis协议数据转换为KV协议数据时,转换得到的KV协议数据包括至少两个数据项,分别为元数据和实际数据,其中元数据主要记录Hash、Set或List这三类数据的额外信息,比如当数据类型为Hash、Set时,元数据信息包括数据容量(Size)、过期时间(Time to Live,TTL)、标志位(Flag)等;当数据类型为List时,元数据信息包括头部信息(Head)、尾部信息(Tail)、数据容量(Size)、过期时间(Time to Live,TTL)、标志位(Flag)等。For Redis protocol data, String is a simple data type. Therefore, when the Redis protocol data whose data type is String is converted into KV protocol data, the converted KV protocol data includes a data item, that is, actual data. Hash, Set, and List are complex data types. Therefore, when the Redis protocol data with the data type of Hash, Set, or List is converted into KV protocol data, the converted KV protocol data includes at least two data items, namely metadata and Actual data. Metadata mainly records additional information about the three types of data: Hash, Set, or List. For example, when the data type is Hash, Set, the metadata information includes data size (Size) and expiration time (Time to Live, TTL) , Flag (Flag), etc.; when the data type is List, the metadata information includes header information (Head), tail information (Tail), data capacity (Size), expiration time (Time to Live, TTL), flag bit (Flag) and so on.
步骤204,将所述KV协议数据发送至KV数据库进行存储。Step 204: Send the KV protocol data to the KV database for storage.
基于该方案,由于KV数据库可以保证应用KV协议数据的主从节点之间的数据一致性,本方案将获取到的Redis协议数据转换为KV协议数据,并发送至KV数据库进行存储,因而有助于保证应用Redis协议数据的主从节点之间的数据强一致性。从而,当Redis服务在长时间断网或者主节点宕机而造成主从节点数据不一致时,通过该方案有助于保证应用Redis协议数据的主从节点之间的数据一致性。Based on this solution, since the KV database can ensure data consistency between the master and slave nodes that apply KV protocol data, this solution converts the obtained Redis protocol data into KV protocol data and sends it to the KV database for storage, which is helpful To ensure strong data consistency between the master and slave nodes that apply Redis protocol data. Therefore, when the Redis service is disconnected from the network for a long time or the master node is down and the data of the master and slave nodes are inconsistent, this solution helps to ensure the data consistency between the master and slave nodes that apply the Redis protocol data.
下面根据Redis协议数据的数据类型,给出将Redis协议数据转换为KV协议数据的具体实现方式。According to the data type of Redis protocol data, the specific implementation method of converting Redis protocol data into KV protocol data is given below.
情形一、Redis协议数据的数据类型为String,Redis协议数据包含第一关键字和第一取值。Case 1: The data type of the Redis protocol data is String, and the Redis protocol data includes the first keyword and the first value.
下面结合一个示例进行说明。如表1所示,是Redis协议数据的数据类型为String时的信息的示例。一条String类型的Redis协议数据,包含的关键字(Key)为alice_account,取值(Value)为43000212333111110000。Let's describe with an example. As shown in Table 1, it is an example of information when the data type of the Redis protocol data is String. A string of Redis protocol data contains the key (Key) as alice_account and the value (Value) as 4300212333111110000.
其中,这里的关键字(alice_account)也称为第一关键字,这里的取值(43000212333111110000)也称为第一取值。The keyword (alice_account) here is also called the first keyword, and the value here (43000212333111110000) is also called the first value.
表1Table 1
Figure PCTCN2020110076-appb-000001
Figure PCTCN2020110076-appb-000001
如表2所示,是对表1所示的Redis协议数据进行转换得到的KV协议数据。As shown in Table 2, it is the KV protocol data obtained by converting the Redis protocol data shown in Table 1.
表2Table 2
Figure PCTCN2020110076-appb-000002
Figure PCTCN2020110076-appb-000002
参考表2,其中,第二关键字为1alice_account,该关键字1alice_account也可以称为实际数据关键字。第二关键字1alice_account是根据第一关键字alice_account和第一标识字符“1”得到的,即在第一关键字alice_account之前添加第一标识字符“1”,得到第二关键字1alice_account,第一标识字符“1”用于指示该KV协议数据的数据类型与第一关键字alice_account对应的数据的数据类型一致,均为String。Refer to Table 2, where the second key is 1alice_account, and this key 1alice_account may also be called the actual data key. The second keyword 1alice_account is obtained based on the first keyword alice_account and the first identification character "1", that is, the first identification character "1" is added before the first keyword alice_account to obtain the second keyword 1alice_account, the first identification The character "1" is used to indicate that the data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword alice_account, and both are String.
该第二关键字对应的取值为43000212333111110000,即第二关键字对应的取值与第一关键字对应的取值相同,均为第一取值。The value corresponding to the second keyword is 4300212333111110000, that is, the value corresponding to the second keyword is the same as the value corresponding to the first keyword, and both are the first value.
情形二、Redis协议数据的数据类型为Hash,Redis协议数据包含第一关键字和第二取值。Case 2: The data type of the Redis protocol data is Hash, and the Redis protocol data includes the first keyword and the second value.
下面结合一个示例进行说明。如表3所示,是Redis协议数据的数据类型为Hash时的信息的示例。一条Hash类型的Redis协议数据,包含的关键字(Key)为alice,取值(Key)分别为name(爱丽丝)、age(18)、country(中国)和birthday(2000/1/1)。Let's describe with an example. As shown in Table 3, it is an example of information when the data type of the Redis protocol data is Hash. A piece of Hash type Redis protocol data contains the key (Key) as alice, and the value (Key) is name (Alice), age (18), country (China) and birthday (2000/1/1).
其中,这里的关键字(alice)也称为第一关键字,这里的取值(name(爱丽丝)、age(18)、country(中国)和birthday(2000/1/1))也称为第二取值。Among them, the keyword (alice) here is also called the first keyword, and the value here (name (Alice), age (18), country (China) and birthday (2000/1/1)) is also called The second value.
表3table 3
Figure PCTCN2020110076-appb-000003
Figure PCTCN2020110076-appb-000003
如表4所示,是对表3所示的Redis协议数据进行转换得到的KV协议数据。As shown in Table 4, it is the KV protocol data obtained by converting the Redis protocol data shown in Table 3.
表4Table 4
Figure PCTCN2020110076-appb-000004
Figure PCTCN2020110076-appb-000004
参考表4,其中,第二关键字为2alice、25alicename、25aliceage、25alicecountry和25alicebirthday。其中,2alice为元数据关键字,25alicename、25aliceage、25alicecountry和25alicebirthday均为实际数据关键字。Refer to Table 4, where the second keywords are 2alice, 25alicename, 25aliceage, 25alicecountry, and 25alicebirthday. Among them, 2alice is a metadata keyword, and 25alicename, 25aliceage, 25alicecountry, and 25alicebirthday are all actual data keywords.
针对第二关键字2alice,即在第二关键字的元数据关键字中,其中的“2”为第二标识字符,用于指示该KV协议数据的数据类型与第一关键字alice对应的数据的数据类型一致,均为Hash。具体地,在第一关键字alice之前添加第二标识字符“2”,得到第二关键字2alice。该第二关键字对应的取值包括4201908081,其中,4201908081中的第一位数字“4”表示第一关键字对应的元素的个数为4,也即表示转换后得到的KV协议数据中的实际数据关键字对应的元素的个数为4,该数字“4”也可以称为第三取值,第三取值作为元数据关键字对应的数据;中间8位数字20190808表示TTL,最后一位数字“1”表示Flag,通常Flag预先定义,如“1”表示有效,“0”表示过期。For the second keyword 2alice, that is, in the metadata keyword of the second keyword, "2" is the second identification character, which is used to indicate the data type of the KV protocol data and the data corresponding to the first keyword alice The data types of are the same, all are Hash. Specifically, the second identification character "2" is added before the first keyword alice to obtain the second keyword 2alice. The value corresponding to the second keyword includes 4201908081, where the first number "4" in 4201908081 indicates that the number of elements corresponding to the first keyword is 4, which means that the KV protocol data obtained after conversion is The number of elements corresponding to the actual data key is 4. The number "4" can also be called the third value, and the third value is used as the data corresponding to the metadata key; the middle 8-digit number 20190808 represents TTL, the last one The digit "1" means Flag, and Flag is usually pre-defined, such as "1" means valid, and "0" means expired.
针对第二关键字25alicename,即在第二关键字的实际数据关键字中,包括第一关键字alice,还包括第二取值name(爱丽丝)中的name;其中,25alicename中的第一位数字“2”为第二标识字符,用于指示该KV协议数据的数据类型与第一关键字alice对应的数据的数据类型一致,均为Hash;25alicename中的第二位数字“5”用于表示第一关键字alice的字符串长度是5个字符。即该第二关键字25alicename是根据第一关键字alice、第一关键字对应的第二取值中的name、第二标识符号“2”和第一关键字alice的字符串长度确定的。For the second keyword 25alicename, that is, in the actual data keywords of the second keyword, the first keyword alice is included, and the name in the second value name (Alice) is also included; among them, the first place in 25alicename The number "2" is the second identification character, which is used to indicate that the data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword alice, both of which are Hash; the second number "5" in 25alicename is used for Indicates that the string length of the first keyword alice is 5 characters. That is, the second keyword 25alicename is determined according to the first keyword alice, the name in the second value corresponding to the first keyword, the second identification symbol "2", and the string length of the first keyword alice.
针对其他第二关键字25aliceage、25alicecountry和25alicebirthday,其中各元素的含义,可以参考第二关键字25alicename的解释,不再赘述。For the other second keywords 25aliceage, 25alicecountry, and 25alicebirthday, the meaning of each element can be referred to the explanation of the second keyword 25alicename, which will not be repeated here.
上述第二关键字25alicename、25aliceage、25alicecountry和25alicebirthday对应的取值包括第二取值的一部分,分别为爱丽丝、19、中国和2000/1/1。The values corresponding to the second keywords 25alicename, 25aliceage, 25alicecountry, and 25alicebirthday include a part of the second value, which are Alice, 19, China, and 2000/1/1, respectively.
情形三、Redis协议数据的数据类型为Set,Redis协议数据包含第一关键字和第二取值。Case 3: The data type of the Redis protocol data is Set, and the Redis protocol data includes the first keyword and the second value.
下面结合一个示例进行说明。如表5所示,是Redis协议数据的数据类型为Set时的信息的示例。一条Set类型的Redis协议数据,包含的关键字(Key)为favorite_fruits,取值(Value)分别为apple、banana、和pear。Let's describe with an example. As shown in Table 5, it is an example of information when the data type of the Redis protocol data is Set. A set of Redis protocol data contains the keyword (Key) as favorite_fruits, and the value (Value) is apple, banana, and pearl.
其中,这里的关键字(favorite_fruits)也称为第一关键字,这里的取值(apple、banana、pear)也称为第二取值。Among them, the keyword (favorite_fruits) here is also called the first keyword, and the value (apple, banana, pear) here is also called the second value.
表5table 5
Figure PCTCN2020110076-appb-000005
Figure PCTCN2020110076-appb-000005
如表6所示,是对表5所示的Redis协议数据进行转换得到的KV协议数据。As shown in Table 6, it is the KV protocol data obtained by converting the Redis protocol data shown in Table 5.
表6Table 6
Figure PCTCN2020110076-appb-000006
Figure PCTCN2020110076-appb-000006
参考表6,其中,第二关键字为3favorite_fruits、315favorite_fruitsapple、315favorite_fruitsbanana和315favorite_fruitspear。其中,3favorite_fruits为元数据关键字,315favorite_fruitsapple、315favorite_fruitsbanana和315favorite_fruitspear均为实际数据关键字。Refer to Table 6, where the second keywords are 3favorite_fruits, 315favorite_fruitsapple, 315favorite_fruitsbanana, and 315favorite_fruitspear. Among them, 3favorite_fruits is a metadata keyword, and 315favorite_fruitsapple, 315favorite_fruitsbanana, and 315favorite_fruitspear are all actual data keywords.
针对第二关键字3favorite_fruits,即在第二关键字的元数据关键字中,其中的“3”为第三标识字符,用于指示该KV协议数据的数据类型与第一关键字favorite_fruits对应的数据的数据类型一致,均为Set。具体地,在第一关键字favorite_fruits之前添加第三标识字符“3”,得到第二关键字3favorite_fruits。该第二关键字对应的取值包括3201908081,其中,3201908081中的第一位数字“3”表示第一关键字对应的元素的个数为3,也即表示转换后得到的KV协议数据中的实际数据关键字对应的元素的个数为3,该数字“3”也可以称为第三取值,第三取值作为元数据关键字对应的数据;中间8位数字20190808表示TTL,最后一位数字“1”表示Flag,通常Flag预先定义,如“1”表示有效,“0”表示过期。For the second keyword 3favorite_fruits, that is, in the metadata keyword of the second keyword, "3" is the third identification character, which is used to indicate the data type of the KV protocol data and the data corresponding to the first keyword favorite_fruits The data types of are the same, both are Set. Specifically, the third identification character "3" is added before the first keyword favorite_fruits to obtain the second keyword 3 favorite_fruits. The value corresponding to the second keyword includes 3201908081, where the first digit "3" in 3201908081 indicates that the number of elements corresponding to the first keyword is 3, which means that the KV protocol data obtained after conversion is The number of elements corresponding to the actual data key is 3. The number "3" can also be called the third value, and the third value is used as the data corresponding to the metadata key; the middle 8-digit number 20190808 represents TTL, the last one The digit "1" means Flag, and Flag is usually pre-defined, such as "1" means valid, and "0" means expired.
针对第二关键字315favorite_fruitsapple,即在第二关键字的实际数据关键字中,包括 第一关键字favorite_fruits,还包括第二取值apple;其中,315favorite_fruitsapple中的第一位数字“3”为第三标识字符,用于指示该KV协议数据的数据类型与第一关键字favorite_fruits对应的数据的数据类型一致,均为Set;315favorite_fruitsapple中的第二和第三位数字合起来的数字“15”用于表示第一关键字favorite_fruits的字符串长度是15个字符。即该第二关键字315favorite_fruitsapple是根据第一关键字favorite_fruits、第一关键字对应的第二取值apple、第三标识字符“3”和第一关键字favorite_fruits的字符串长度确定的。For the second keyword 315favorite_fruitsapple, that is, the actual data keywords of the second keyword include the first keyword favorite_fruits and the second value apple; among them, the first digit "3" in 315favorite_fruitsapple is the third Identification character, used to indicate that the data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword favorite_fruits, both are Set; the second and third digits in 315 favorite_fruitsapple are combined with the number "15" for The length of the string representing the first keyword favorite_fruits is 15 characters. That is, the second keyword 315 favorite_fruitsapple is determined according to the first keyword favorite_fruits, the second value apple corresponding to the first keyword, the third identification character "3", and the string length of the first keyword favorite_fruits.
针对其他第二关键字315favorite_fruitsbanana和315favorite_fruitspear,其中各元素的含义,可以参考第二关键字315favorite_fruitsapple的解释,不再赘述。For the other second keywords 315favorite_fruitsbanana and 315favorite_fruitspear, the meaning of each element can be referred to the explanation of the second keyword 315favorite_fruitsapple, which will not be repeated here.
上述第二关键字315favorite_fruitsapple、315favorite_fruitsbanana和315favorite_fruitspear对应的取值包括第二取值,分别为apple、banana和pear。The values corresponding to the second keywords 315favorite_fruitsapple, 315favorite_fruitsbanana, and 315favorite_fruitspear include the second values, which are apple, banana, and pear, respectively.
情形四、Redis协议数据的数据类型为List,Redis协议数据包含第一关键字和第四取值。Case 4: The data type of the Redis protocol data is List, and the Redis protocol data includes the first keyword and the fourth value.
下面结合一个示例进行说明。如表7所示,是Redis协议数据的数据类型为List时的信息的示例。一条List类型的Redis协议数据,包含的关键字(Key)为students_class_one,取值(Value)分别为Grace、David、Peter、Daniel和Mary。Let's describe with an example. As shown in Table 7, it is an example of information when the data type of the Redis protocol data is List. A piece of Redis protocol data of List type contains the keyword (Key) as students_class_one, and the value (Value) is Grace, David, Peter, Daniel and Mary.
其中,这里的关键字(students_class_one)也称为第一关键字,这里的取值(Grace、David、Peter、Daniel、Mary)也称为第四取值。Among them, the keyword (students_class_one) here is also called the first keyword, and the value here (Grace, David, Peter, Daniel, Mary) is also called the fourth value.
表7Table 7
Figure PCTCN2020110076-appb-000007
Figure PCTCN2020110076-appb-000007
如表8所示,是对表7所示的Redis协议数据进行转换得到的KV协议数据。As shown in Table 8, it is the KV protocol data obtained by converting the Redis protocol data shown in Table 7.
表8Table 8
Figure PCTCN2020110076-appb-000008
Figure PCTCN2020110076-appb-000008
Figure PCTCN2020110076-appb-000009
Figure PCTCN2020110076-appb-000009
参考表8,其中,第二关键字为4students_class_one、418students_class_one1、418students_class_one2、418students_class_one3、418students_class_one4和418students_class_one5。其中,4students_class_one为元数据关键字,418students_class_one1、418students_class_one2、418students_class_one3、418students_class_one4和418students_class_one5均为实际数据关键字。Refer to Table 8, where the second keywords are 4students_class_one, 418students_class_one1, 418students_class_one2, 418students_class_one3, 418students_class_one4 and 418students_class_one5. Among them, 4students_class_one is a metadata keyword, and 418students_class_one1, 418students_class_one2, 418students_class_one3, 418students_class_one4, and 418students_class_one5 are all actual data keywords.
针对第二关键字4students_class_one,即在第二关键字的元数据关键字中,其中的“4”为第四标识字符,用于指示该KV协议数据的数据类型与第一关键字students_class_one对应的数据的数据类型一致,均为List。具体地,在第一关键字students_class_one之前添加第四标识字符“4”,得到第二关键字4students_class_one。该第二关键字对应的取值包括155201908081,其中,155201908081中的第一位数字“1”表示第一关键字对应的元素的排序从“1”开始,第二位数字“5”表示第一关键字对应的元素的排序到“5”结束,第三位数字“5”表示第一关键字对应的元素的个数为5,也即表示转换后得到的KV协议数据中的实际数据关键字对应的元素的个数为5,第一位数字“1”、第二位数字“5”和第三位数字“5”合起来的数字“155”也可以称为第五取值,第五取值作为元数据关键字对应的数据;中间8位数字20190808表示TTL,最后一位数字“1”表示Flag,通常Flag预先定义,如“1”表示有效,“0”表示过期。For the second keyword 4students_class_one, that is, in the metadata keyword of the second keyword, "4" is the fourth identification character, which is used to indicate the data type of the KV protocol data and the data corresponding to the first keyword students_class_one The data types are the same, both are List. Specifically, the fourth identification character "4" is added before the first keyword students_class_one to obtain the second keyword 4 students_class_one. The value corresponding to the second keyword includes 155201908081, where the first digit "1" in 155201908081 indicates that the order of the elements corresponding to the first keyword starts from "1", and the second digit "5" indicates the first The sorting of the elements corresponding to the keyword ends with "5". The third digit "5" indicates that the number of elements corresponding to the first keyword is 5, which means that the actual data keyword in the KV protocol data obtained after conversion is indicated. The number of corresponding elements is 5. The number "155" which is the combination of the first digit "1", the second digit "5" and the third digit "5" can also be called the fifth value, the fifth The value is taken as the data corresponding to the metadata keyword; the middle 8 digits 20190808 means TTL, and the last digit "1" means Flag. Usually, Flag is predefined, such as "1" means valid, and "0" means expired.
针对第二关键字418students_class_one1,即在第二关键字的实际数据关键字中,包括第一关键字students_class_one;其中,418students_class_one1中的第一位数字“4”为第四标识字符,用于指示该KV协议数据的数据类型与第一关键字students_class_one对应的数据的数据类型一致,均为List;418students_class_one1中的第二和第三位数字合起来的数字“18”用于表示第一关键字students_class_one的字符串长度是18个字符,418students_class_one1中的最后一位数字“1”用于表示第一关键字对应的第四取值Grace的排序为1。即该第二关键字418students_class_one1是根据第一关键字students_class_one、第一关键字对应的第四取值Grace的排序、第四标识符号“4”和第一关键字students_class_one的字符串长度确定的。For the second keyword 418students_class_one1, that is, the actual data keywords of the second keyword include the first keyword students_class_one; among them, the first number "4" in 418students_class_one1 is the fourth identification character, which is used to indicate the KV The data type of the protocol data is consistent with the data type of the data corresponding to the first keyword students_class_one, both are List; the number "18" combined with the second and third digits in 418students_class_one1 is used to represent the character of the first keyword students_class_one The string length is 18 characters, and the last digit "1" in 418students_class_one1 is used to indicate that the fourth value Grace corresponding to the first keyword is ranked as 1. That is, the second keyword 418 students_class_one1 is determined according to the first keyword students_class_one, the ranking of the fourth value Grace corresponding to the first keyword, the fourth identification symbol "4", and the string length of the first keyword students_class_one.
针对其他第二关键字418students_class_one2、418students_class_one3、 418students_class_one4和418students_class_one5,其中各元素的含义,可以参考第二关键字418students_class_one1的解释,不再赘述。For the other second keywords 418students_class_one2, 418students_class_one3, 418students_class_one4, and 418students_class_one5, the meaning of each element therein can be referred to the explanation of the second keyword 418students_class_one1, and will not be repeated.
上述第二关键字418students_class_one1、418students_class_one2、418students_class_one3、418students_class_one4和418students_class_one5对应的取值包括第四取值,分别为Grace、David、Peter、Daniel和Mary。The values corresponding to the second keywords 418students_class_one1, 418students_class_one2, 418students_class_one3, 418students_class_one4, and 418students_class_one5 include the fourth value, which are Grace, David, Peter, Daniel, and Mary, respectively.
需要说明的是,上述示例中,String数据类型的KV协议数据中的第一标识字符为“1”,Hash数据类型的KV协议数据中的第二标识字符为“2”,Set数据类型的KV协议数据中的第三标识字符为“3”,List数据类型的KV协议数据中的第四标识字符为“4”,在实际应用中,对于不同数据类型的KV协议数据中的预设标识符号的定义也可以采用其他方式,可根据实际需要而定。比如,上述示例也可以采用以下方式:String数据类型、Set数据类型、List数据类型和Hash数据类型的KV协议数据中的预设标识符号分别为“1”、“2”、“3”、“4”等等。It should be noted that in the above example, the first identification character in the KV protocol data of the String data type is "1", the second identification character in the KV protocol data of the Hash data type is "2", and the KV of the Set data type is "1". The third identification character in the protocol data is "3", and the fourth identification character in the KV protocol data of the List data type is "4". In practical applications, the preset identification symbols in the KV protocol data of different data types The definition of can also adopt other methods, which can be determined according to actual needs. For example, the above example can also adopt the following methods: the preset identification symbols in the KV protocol data of the String data type, the Set data type, the List data type, and the Hash data type are "1", "2", "3", " 4" and so on.
需要说明的是,预设标识符号可以位于第二关键字的首位,也可以位于第二关键字的末位,或者也还可以是其他位置,对此本发明不做限定。It should be noted that the preset identification symbol may be located in the first position of the second keyword, may also be located in the last position of the second keyword, or may also be in other positions, which is not limited by the present invention.
本发明实施例中,还提供了一种调用以KV编码格式进行存储的Redis协议数据的方法。如图3所示,该方法包括以下步骤:In the embodiment of the present invention, a method for calling Redis protocol data stored in the KV encoding format is also provided. As shown in Figure 3, the method includes the following steps:
步骤301,从客户端接收请求消息;Step 301: Receive a request message from the client;
步骤302,获取所述请求消息对应的第一KV协议数据;Step 302: Obtain the first KV protocol data corresponding to the request message;
步骤303,将所述第一KV协议数据转换为第一Redis协议数据;Step 303: Convert the first KV protocol data into the first Redis protocol data;
步骤304,向所述客户端发送所述第一Redis协议数据。Step 304: Send the first Redis protocol data to the client.
基于该方案,可以实现基于客户端的请求,将存储的KV协议数据转换为Redis协议数据后发送至客户端。Based on this solution, a client-based request can be realized, and the stored KV protocol data is converted into Redis protocol data and then sent to the client.
基于同样的构思,本发明实施例还提供一种基于Redis协议的KV数据存储装置,如图4所示,所述装置包括:Based on the same concept, an embodiment of the present invention also provides a KV data storage device based on the Redis protocol. As shown in FIG. 4, the device includes:
第一获取单元401,用于获取Redis协议数据,获取所述Redis协议数据的第一关键字和所述第一关键字对应的数据,其中,所述第一关键字对应的数据的数据类型为预设类型;The first obtaining unit 401 is configured to obtain Redis protocol data, obtain a first keyword of the Redis protocol data and data corresponding to the first keyword, wherein the data type of the data corresponding to the first keyword is Preset type
第二获取单元402,用于根据所述第一关键字对应的数据的数据类型,获取所述数据类型对应的预设标识符号;The second obtaining unit 402 is configured to obtain a preset identification symbol corresponding to the data type according to the data type of the data corresponding to the first keyword;
转换单元403,基于所述第一关键字和所述预设标识符号,得到第二关键字;根据所述第二关键字和所述第一关键字对应的数据,得到KV协议数据,所述预设标识符号用于指示所述KV协议数据的数据类型与所述第一关键字对应的数据的数据类型一致;The conversion unit 403 obtains a second keyword based on the first keyword and the preset identification symbol; obtains KV protocol data according to the data corresponding to the second keyword and the first keyword, and The preset identification symbol is used to indicate that the data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword;
通信单元404,用于将所述KV协议数据发送至KV数据库进行存储。The communication unit 404 is configured to send the KV protocol data to the KV database for storage.
进一步地,对于所述装置,若所述预设类型为字符串,则所述第一关键字对应的数据包括第一取值,所述预设标识符号为字符串对应的第一标识字符;所述转换单元403具体用于:根据所述第二关键字和所述第一取值,得到所述KV协议数据。Further, for the device, if the preset type is a character string, the data corresponding to the first keyword includes a first value, and the preset identification symbol is the first identification character corresponding to the character string; The conversion unit 403 is specifically configured to obtain the KV protocol data according to the second keyword and the first value.
进一步地,对于所述装置,若所述预设类型为哈希或集合,则所述第一关键字对应的数据包括第二取值,所述预设标识符号为哈希对应的第二标识字符、或为集合对应的第三标识字符,所述第二关键字包括元数据关键字和实际数据关键字;所述转换单元403具体用于:基于所述第一关键字和所述预设标识符号,得到所述元数据关键字;基于所述第一关键字和所述预设标识符号,得到所述实际数据关键字;根据所述第一关键字对应的元素的个数,确定所述元数据关键字对应的数据包括第三取值;根据所述第二关键字、所述第二取值和所述第三取值,得到所述KV协议数据,所述第二取值对应所述实际数据关键字。Further, for the device, if the preset type is a hash or a set, the data corresponding to the first keyword includes a second value, and the preset identification symbol is the second identification corresponding to the hash Character, or the third identifying character corresponding to the set, the second keyword includes metadata keywords and actual data keywords; the conversion unit 403 is specifically configured to: based on the first keyword and the preset Identification symbol to obtain the metadata keyword; based on the first keyword and the preset identification symbol to obtain the actual data keyword; according to the number of elements corresponding to the first keyword, determine the The data corresponding to the metadata keyword includes a third value; according to the second keyword, the second value, and the third value, the KV protocol data is obtained, and the second value corresponds to The actual data key.
进一步地,对于所述装置,若所述预设类型为列表,则所述第一关键字对应的数据包括第四取值,所述预设标识符号为列表对应的第四标识字符,所述第二关键字包括元数据关键字和实际数据关键字;所述转换单元403具体用于:基于所述第一关键字和所述第四标识字符,得到所述元数据关键字;基于所述第一关键字和所述第四标识字符,得到所述实际数据关键字;根据所述第一关键字对应的元素的个数和所述元素的排序,确定所述元数据关键字对应的数据包括第五取值;根据所述第二关键字、所述第四取值和所述第五取值,得到所述KV协议数据,所述第四取值对应所述实际数据关键字。Further, for the device, if the preset type is a list, the data corresponding to the first keyword includes a fourth value, the preset identification symbol is a fourth identification character corresponding to the list, and the The second keyword includes a metadata keyword and an actual data keyword; the conversion unit 403 is specifically configured to: obtain the metadata keyword based on the first keyword and the fourth identification character; The first keyword and the fourth identification character are used to obtain the actual data keyword; the data corresponding to the metadata keyword is determined according to the number of elements corresponding to the first keyword and the order of the elements It includes a fifth value; the KV protocol data is obtained according to the second keyword, the fourth value, and the fifth value, and the fourth value corresponds to the actual data keyword.
进一步地,对于所述装置,所述通信单元404,还用于从客户端接收请求消息;所述第一获取单元401,还用于获取所述请求消息对应的第一KV协议数据;所述转换单元403,还用于将所述第一KV协议数据转换为第一Redis协议数据;所述通信单元404,还用于向所述客户端发送所述第一Redis协议数据。Further, for the device, the communication unit 404 is further configured to receive a request message from the client; the first obtaining unit 401 is further configured to obtain the first KV protocol data corresponding to the request message; The conversion unit 403 is further configured to convert the first KV protocol data into first Redis protocol data; the communication unit 404 is also configured to send the first Redis protocol data to the client.
本发明实施例提供了一种计算设备,该计算设备具体可以为桌面计算机、便携式计算机、智能手机、平板电脑、个人数字助理(Personal Digital Assistant,PDA)等。该计算设备可以包括中央处理器(Center Processing Unit,CPU)、存储器、输入/输出设备等,输入设备可以包括键盘、鼠标、触摸屏等,输出设备可以包括显示设备,如液晶显示器(Liquid Crystal Display,LCD)、阴极射线管(Cathode Ray Tube,CRT)等。The embodiment of the present invention provides a computing device, and the computing device may specifically be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (Personal Digital Assistant, PDA), etc. The computing device may include a central processing unit (CPU), a memory, an input/output device, etc. The input device may include a keyboard, a mouse, a touch screen, etc., and an output device may include a display device, such as a liquid crystal display (Liquid Crystal Display, LCD), Cathode Ray Tube (CRT), etc.
存储器,可以包括只读存储器(ROM)和随机存取存储器(RAM),并向处理器提供存储器中存储的程序指令和数据。在本发明实施例中,存储器可以用于存储基于Redis协议的KV数据存储方法的程序指令;The memory may include read-only memory (ROM) and random access memory (RAM), and provides the processor with program instructions and data stored in the memory. In the embodiment of the present invention, the memory can be used to store the program instructions of the KV data storage method based on the Redis protocol;
处理器,用于调用所述存储器中存储的程序指令,按照获得的程序执行基于Redis协 议的KV数据存储方法。The processor is used to call the program instructions stored in the memory, and execute the KV data storage method based on the Redis protocol according to the obtained program.
本发明实施例提供了一种计算机存储介质,所述计算机存储介质存储有计算机可执行指令,所述计算机可执行指令用于使计算机执行基于Redis协议的KV数据存储方法。The embodiment of the present invention provides a computer storage medium that stores computer executable instructions, and the computer executable instructions are used to make a computer execute a KV data storage method based on the Redis protocol.
本领域内的技术人员应明白,本发明的实施例可提供为方法、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present invention can be provided as methods or computer program products. Therefore, the present invention may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
本发明是参照根据本发明实施例的方法、设备(***)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowcharts and/or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and/or block in the flowchart and/or block diagram, and the combination of processes and/or blocks in the flowchart and/or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing equipment to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing equipment are generated It is a device that realizes the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device. The device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment. The instructions provide steps for implementing the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications to these embodiments once they learn the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. In this way, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these modifications and variations.

Claims (12)

  1. 一种基于Redis协议的KV数据存储方法,其特征在于,包括:A KV data storage method based on the Redis protocol is characterized in that it includes:
    获取Redis协议数据,获取所述Redis协议数据的第一关键字和所述第一关键字对应的数据,其中,所述第一关键字对应的数据的数据类型为预设类型;Acquiring Redis protocol data, acquiring a first keyword of the Redis protocol data and data corresponding to the first keyword, wherein the data type of the data corresponding to the first keyword is a preset type;
    根据所述第一关键字对应的数据的数据类型,获取所述数据类型对应的预设标识符号;Obtaining a preset identification symbol corresponding to the data type according to the data type of the data corresponding to the first keyword;
    基于所述第一关键字和所述预设标识符号,得到第二关键字;根据所述第二关键字和所述第一关键字对应的数据,得到KV协议数据,所述预设标识符号用于指示所述KV协议数据的数据类型与所述第一关键字对应的数据的数据类型一致;A second keyword is obtained based on the first keyword and the preset identification symbol; KV protocol data is obtained according to the data corresponding to the second keyword and the first keyword, the preset identification symbol Used to indicate that the data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword;
    将所述KV协议数据发送至KV数据库进行存储。The KV protocol data is sent to the KV database for storage.
  2. 如权利要求1所述的方法,其特征在于,若所述预设类型为字符串,则所述第一关键字对应的数据包括第一取值,所述预设标识符号为字符串对应的第一标识字符;The method of claim 1, wherein if the preset type is a character string, the data corresponding to the first keyword includes a first value, and the preset identification symbol is corresponding to the character string The first identification character;
    根据所述第二关键字和所述第一关键字对应的数据,得到KV协议数据,包括:According to the data corresponding to the second keyword and the first keyword, obtaining KV protocol data includes:
    根据所述第二关键字和所述第一取值,得到所述KV协议数据。According to the second keyword and the first value, the KV protocol data is obtained.
  3. 如权利要求1所述的方法,其特征在于,若所述预设类型为哈希或集合,则所述第一关键字对应的数据包括第二取值,所述预设标识符号为哈希对应的第二标识字符、或为集合对应的第三标识字符,所述第二关键字包括元数据关键字和实际数据关键字;The method of claim 1, wherein if the preset type is a hash or a set, the data corresponding to the first keyword includes a second value, and the preset identification symbol is a hash The corresponding second identification character, or the third identification character corresponding to the set, where the second keyword includes a metadata keyword and an actual data keyword;
    所述基于所述第一关键字和所述预设标识符号,得到第二关键字的步骤包括:The step of obtaining a second keyword based on the first keyword and the preset identification symbol includes:
    基于所述第一关键字和所述预设标识符号,得到所述元数据关键字;Obtaining the metadata keyword based on the first keyword and the preset identification symbol;
    基于所述第一关键字和所述预设标识符号,得到所述实际数据关键字;Obtaining the actual data keyword based on the first keyword and the preset identification symbol;
    所述方法还包括:The method also includes:
    根据所述第一关键字对应的元素的个数,确定所述元数据关键字对应的数据包括第三取值;Determining, according to the number of elements corresponding to the first keyword, that the data corresponding to the metadata keyword includes a third value;
    根据所述第二关键字和所述第一关键字对应的数据,得到KV协议数据,包括:According to the data corresponding to the second keyword and the first keyword, obtaining KV protocol data includes:
    根据所述第二关键字、所述第二取值和所述第三取值,得到所述KV协议数据,所述第二取值对应所述实际数据关键字。According to the second keyword, the second value, and the third value, the KV protocol data is obtained, and the second value corresponds to the actual data keyword.
  4. 如权利要求1所述的方法,其特征在于,若所述预设类型为列表,则所述第一关键字对应的数据包括第四取值,所述预设标识符号为列表对应的第四标识字符,所述第二关键字包括元数据关键字和实际数据关键字;The method of claim 1, wherein if the preset type is a list, the data corresponding to the first keyword includes a fourth value, and the preset identification symbol is the fourth value corresponding to the list. Identifying characters, where the second keyword includes a metadata keyword and an actual data keyword;
    所述基于所述第一关键字和所述预设标识符号,得到第二关键字的步骤包括:The step of obtaining a second keyword based on the first keyword and the preset identification symbol includes:
    基于所述第一关键字和所述第四标识字符,得到所述元数据关键字;Obtaining the metadata keyword based on the first keyword and the fourth identification character;
    基于所述第一关键字和所述第四标识字符,得到所述实际数据关键字;Obtaining the actual data keyword based on the first keyword and the fourth identification character;
    所述方法还包括:The method also includes:
    根据所述第一关键字对应的元素的个数和所述元素的排序,确定所述元数据关键字对应的数据包括第五取值;Determining that the data corresponding to the metadata keyword includes a fifth value according to the number of elements corresponding to the first keyword and the ranking of the elements;
    根据所述第二关键字和所述第一关键字对应的数据,得到KV协议数据,包括:According to the data corresponding to the second keyword and the first keyword, obtaining KV protocol data includes:
    根据所述第二关键字、所述第四取值和所述第五取值,得到所述KV协议数据,所述第四取值对应所述实际数据关键字。According to the second keyword, the fourth value, and the fifth value, the KV protocol data is obtained, and the fourth value corresponds to the actual data keyword.
  5. 如权利要求1-4任一所述的方法,其特征在于,还包括:The method according to any one of claims 1 to 4, further comprising:
    接收客户端发送的请求消息;Receive the request message sent by the client;
    获取所述请求消息对应的第一KV协议数据;Acquiring the first KV protocol data corresponding to the request message;
    将所述第一KV协议数据转换为第一Redis协议数据;Converting the first KV protocol data into the first Redis protocol data;
    向所述客户端发送所述第一Redis协议数据。Sending the first Redis protocol data to the client.
  6. 一种基于Redis协议的KV数据存储装置,其特征在于,包括:A KV data storage device based on the Redis protocol is characterized in that it comprises:
    第一获取单元,用于获取Redis协议数据,获取所述Redis协议数据的第一关键字和所述第一关键字对应的数据,其中,所述第一关键字对应的数据的数据类型为预设类型;The first obtaining unit is configured to obtain Redis protocol data, obtain the first keyword of the Redis protocol data and the data corresponding to the first keyword, wherein the data type of the data corresponding to the first keyword is pre- Set type;
    第二获取单元,用于根据所述第一关键字对应的数据的数据类型,获取所述数据类型对应的预设标识符号;The second acquiring unit is configured to acquire the preset identification symbol corresponding to the data type according to the data type of the data corresponding to the first keyword;
    转换单元,基于所述第一关键字和所述预设标识符号,得到第二关键字;根据所述第二关键字和所述第一关键字对应的数据,得到KV协议数据,所述预设标识符号用于指示所述KV协议数据的数据类型与所述第一关键字对应的数据的数据类型一致;The conversion unit obtains a second keyword based on the first keyword and the preset identification symbol; obtains KV protocol data according to the data corresponding to the second keyword and the first keyword, and the preset Let the identification symbol be used to indicate that the data type of the KV protocol data is consistent with the data type of the data corresponding to the first keyword;
    通信单元,用于将所述KV协议数据发送至KV数据库进行存储。The communication unit is used to send the KV protocol data to the KV database for storage.
  7. 如权利要求6所述的装置,其特征在于,若所述预设类型为字符串,则所述第一关键字对应的数据包括第一取值,所述预设标识符号为字符串对应的第一标识字符;The device according to claim 6, wherein if the preset type is a character string, the data corresponding to the first keyword includes a first value, and the preset identification symbol is corresponding to the character string The first identification character;
    所述转换单元,具体用于根据所述第二关键字和所述第一取值,得到所述KV协议数据。The conversion unit is specifically configured to obtain the KV protocol data according to the second keyword and the first value.
  8. 如权利要求6所述的装置,其特征在于,若所述预设类型为哈希或集合,则所述第一关键字对应的数据包括第二取值,所述预设标识符号为哈希对应的第二标识字符、或为集合对应的第三标识字符,所述第二关键字包括元数据关键字和实际数据关键字;The device according to claim 6, wherein if the preset type is a hash or a set, the data corresponding to the first keyword includes a second value, and the preset identification symbol is a hash The corresponding second identification character, or the third identification character corresponding to the set, the second keyword includes a metadata keyword and an actual data keyword;
    所述转换单元,具体用于:基于所述第一关键字和所述预设标识符号,得到所述元数据关键字;基于所述第一关键字和所述预设标识符号,得到所述实际数据关键字;根据所述第一关键字对应的元素的个数,确定所述元数据关键字对应的数据包括第三取值;根据 所述第二关键字、所述第二取值和所述第三取值,得到所述KV协议数据,所述第二取值对应所述实际数据关键字。The conversion unit is specifically configured to: obtain the metadata keyword based on the first keyword and the preset identification symbol; obtain the metadata keyword based on the first keyword and the preset identification symbol The actual data key; according to the number of elements corresponding to the first key, it is determined that the data corresponding to the metadata key includes a third value; according to the second key, the second value, and The third value obtains the KV protocol data, and the second value corresponds to the actual data keyword.
  9. 如权利要求6所述的装置,其特征在于,若所述预设类型为列表,则所述第一关键字对应的数据包括第四取值,所述预设标识符号为列表对应的第四标识字符,所述第二关键字包括元数据关键字和实际数据关键字;The device of claim 6, wherein if the preset type is a list, the data corresponding to the first keyword includes a fourth value, and the preset identification symbol is the fourth value corresponding to the list. Identifying characters, where the second keyword includes a metadata keyword and an actual data keyword;
    所述转换单元,具体用于:基于所述第一关键字和所述第四标识字符,得到所述元数据关键字;基于所述第一关键字和所述第四标识字符,得到所述实际数据关键字;根据所述第一关键字对应的元素的个数和所述元素的排序,确定所述元数据关键字对应的数据包括第五取值;根据所述第二关键字、所述第四取值和所述第五取值,得到所述KV协议数据,所述第四取值对应所述实际数据关键字。The conversion unit is specifically configured to: obtain the metadata keyword based on the first keyword and the fourth identification character; obtain the metadata keyword based on the first keyword and the fourth identification character The actual data key; according to the number of elements corresponding to the first key and the order of the elements, it is determined that the data corresponding to the metadata key includes the fifth value; according to the second key, The fourth value and the fifth value are used to obtain the KV protocol data, and the fourth value corresponds to the actual data keyword.
  10. 如权利要求6-9任一所述的装置,其特征在于,所述通信单元,还用于接收客户端发送的请求消息;9. The device according to any one of claims 6-9, wherein the communication unit is further configured to receive a request message sent by the client;
    所述第一获取单元,还用于获取所述请求消息对应的第一KV协议数据;The first obtaining unit is further configured to obtain the first KV protocol data corresponding to the request message;
    所述转换单元,还用于将所述第一KV协议数据转换为第一Redis协议数据;The conversion unit is further configured to convert the first KV protocol data into the first Redis protocol data;
    所述通信单元,还用于向所述客户端发送所述第一Redis协议数据。The communication unit is further configured to send the first Redis protocol data to the client.
  11. 一种计算设备,其特征在于,包括:A computing device, characterized in that it comprises:
    存储器,用于存储程序指令;Memory, used to store program instructions;
    处理器,用于调用所述存储器中存储的程序指令,按照获得的程序执行如权利要求1至5任一项所述的方法。The processor is configured to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 5 according to the obtained program.
  12. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有计算机可执行指令,所述计算机可执行指令用于使计算机执行如权利要求1至5任一项所述的方法。A computer storage medium, wherein the computer storage medium stores computer-executable instructions, and the computer-executable instructions are used to make a computer execute the method according to any one of claims 1 to 5.
PCT/CN2020/110076 2019-09-04 2020-08-19 Redis protocol-based kv data storage method and apparatus WO2021042993A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910830696.3A CN110609766A (en) 2019-09-04 2019-09-04 KV data storage method and device based on Redis protocol
CN201910830696.3 2019-09-04

Publications (1)

Publication Number Publication Date
WO2021042993A1 true WO2021042993A1 (en) 2021-03-11

Family

ID=68892171

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/110076 WO2021042993A1 (en) 2019-09-04 2020-08-19 Redis protocol-based kv data storage method and apparatus

Country Status (2)

Country Link
CN (1) CN110609766A (en)
WO (1) WO2021042993A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110609766A (en) * 2019-09-04 2019-12-24 深圳前海微众银行股份有限公司 KV data storage method and device based on Redis protocol

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2631819A1 (en) * 2012-02-23 2013-08-28 Fujitsu Limited Database controller, method, and system for storing encoded triples
CN105302889A (en) * 2015-10-16 2016-02-03 北京奇虎科技有限公司 Conversion method and apparatus for data storage structure
CN109408507A (en) * 2018-09-27 2019-03-01 中国联合网络通信集团有限公司 Processing method, device, equipment and the readable storage medium storing program for executing of multiattribute data
CN110609766A (en) * 2019-09-04 2019-12-24 深圳前海微众银行股份有限公司 KV data storage method and device based on Redis protocol

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2631819A1 (en) * 2012-02-23 2013-08-28 Fujitsu Limited Database controller, method, and system for storing encoded triples
CN105302889A (en) * 2015-10-16 2016-02-03 北京奇虎科技有限公司 Conversion method and apparatus for data storage structure
CN109408507A (en) * 2018-09-27 2019-03-01 中国联合网络通信集团有限公司 Processing method, device, equipment and the readable storage medium storing program for executing of multiattribute data
CN110609766A (en) * 2019-09-04 2019-12-24 深圳前海微众银行股份有限公司 KV data storage method and device based on Redis protocol

Also Published As

Publication number Publication date
CN110609766A (en) 2019-12-24

Similar Documents

Publication Publication Date Title
US11030276B2 (en) Methods and apparatus for sorting data
US20210232558A1 (en) Data isolation in a blockchain network
AU2014262240B2 (en) Entity resolution from documents
AU2007336337B2 (en) System and method for optimizing changes of data sets
US20200387490A1 (en) Hash Composite Indexes
CN108897874B (en) Method and apparatus for processing data
US20140222902A1 (en) Web services access to content items stored by collaboration systems
CN110941598A (en) Data deduplication method, device, terminal and storage medium
CN108846753B (en) Method and apparatus for processing data
US10042849B2 (en) Simplifying invocation of import procedures to transfer data from data sources to data targets
WO2016101811A1 (en) Information arrangement method and apparatus
WO2022105119A1 (en) Training corpus generation method for intention recognition model, and related device thereof
US11468107B2 (en) Enhance a mail application to format a long email conversation for easy consumption
CN111209120A (en) Data synchronization method and device for microservice and computer readable storage medium
CN111694792A (en) Identification generation method and device based on snowfly
WO2021042993A1 (en) Redis protocol-based kv data storage method and apparatus
WO2023061180A1 (en) Multi frequency-based data sending method and apparatus, multi frequency-based data receiving method and apparatus, and device
CN113761565A (en) Data desensitization method and apparatus
CN116069725A (en) File migration method, device, apparatus, medium and program product
CN115495658A (en) Data processing method and device
US20170161359A1 (en) Pattern-driven data generator
CN112073395A (en) File distribution method and device
CN110705935A (en) Logistics document processing method and device
US11423109B2 (en) Information processing method, server and computer program product
CN112148705A (en) Data migration method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20860225

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 20.07.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20860225

Country of ref document: EP

Kind code of ref document: A1