CN105491149A - Data storage method and terminal - Google Patents

Data storage method and terminal Download PDF

Info

Publication number
CN105491149A
CN105491149A CN201510998390.0A CN201510998390A CN105491149A CN 105491149 A CN105491149 A CN 105491149A CN 201510998390 A CN201510998390 A CN 201510998390A CN 105491149 A CN105491149 A CN 105491149A
Authority
CN
China
Prior art keywords
target
storage node
storage
node
user
Prior art date
Application number
CN201510998390.0A
Other languages
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 深圳市金立通信设备有限公司
Priority to CN201510998390.0A priority Critical patent/CN105491149A/en
Publication of CN105491149A publication Critical patent/CN105491149A/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network-specific arrangements or communication protocols supporting networked applications
    • H04L67/10Network-specific arrangements or communication protocols supporting networked applications in which an application is distributed across nodes in the network
    • H04L67/1097Network-specific arrangements or communication protocols supporting networked applications in which an application is distributed across nodes in the network for distributed storage of data in a network, e.g. network file system [NFS], transport mechanisms for storage area networks [SAN] or network attached storage [NAS]

Abstract

The invention provides a data storage method and a terminal. The data storage method comprises steps of receiving a data storage request, wherein the data storage request carries a target user identifier and user data, performing operation on a target user identifier according to a preset mapping algorithm, inquiring a target unloading node corresponding to a target user identifier according to an operation result, wherein the target unloading node corresponds to a plurality of user identifiers, inquiring a target storage node corresponding to the target unloading node in a storage mapping table, wherein an one-to-one correspondence relation or a several-for-one correspondence relation between the unloading node and the storage unloading node is recorded in the storage mapping table, and storing the user data carried by the data storage request in a storage position corresponding to the target user identifier in the target storage node. Through the embodiment, the invention avoids the generation of a large mapping table in the process of substantial data distribution storage, and improves the target storage node efficiency corresponding to the inquiry target user.

Description

-种数据存储方法及终端 - kind of data storage method and a terminal

技术领域 FIELD

[0001 ]本发明设及计算机技术领域,具体设及一种数据存储方法及终端。 Invention is provided [0001] The field of computer technology and, in particular, and provided a data storage method and a terminal.

背景技术 Background technique

[0002] 分布式数据库系统是逻辑上属于同一系统,物理上分布在用计算机网络连接的多个节点(Node)上的数据集合。 [0002] The distributed database system is logically part of the same system, the distribution of the data set in the plurality of nodes (Node) connected to the computer network physically. 节点在计算机网络中连接在一起,每个节点都是一个独立的数据库系统。 The nodes are connected together, each node is an independent database in a computer network system. 在分布式数据库系统中,用户数据按照一定的分布规则分布在不同的存储节点中,用户每次访问或修改用户数据时需要先定位用户数据所在的存储节点,然后再从该存储节点中存取用户数据。 In a distributed database system, user profile data according to certain rules in different storage nodes, storage node need to be positioned where the user data each time a user accessing or modifying user data, and then accessed from the storage node User data.

[0003] 目前,常见的分布规则有按记录标识分布、按用户活跃度分布等。 [0003] Currently, there are common rules of distribution by record identification profile, according to user activity distribution. 其中,按记录标识分布需要业务服务器维护一张映射表,在映射表中记录有记录标识和存储节点的对应关系,当用户数据量很大时,映射表也将变的很大,导致业务服务器在映射表中查询目标用户所对应的存储节点的效率降低;按用户活跃度分布也需要业务服务器维护一张映射表,在映射表中记录有用户活跃度和存储节点的对应关系,当用户数据量很大时,映射表也将变的很大,并且并非所有数据库系统均支持用户活跃度的统计测量,导致此种分布规则的应用受限。 Wherein, by recording identification profile service server needs to maintain a mapping table in the mapping table records correspondence between the storage node and the identifier of the record, when a large amount of user data, the mapping table also becomes large, resulting in the service server query the storage node corresponding to the target user to reduced efficiency in the mapping table; activity according to the user profile need service server maintains a mapping table in the mapping table records correspondence between the storage node and the user activity when the user data when a large amount, the mapping table will also become great, and not all database systems support statistical measure user activity, resulting in limited applications such distribution rules.

发明内容 SUMMARY

[0004] 本发明实施例提供了一种数据存储方法及终端,可W避免在进行大量用户数据的分布式存储时产生记录条数过多的映射表,提高查询目标用户所对应的目标存储节点的效率,从而提高用户数据的存储效率。 [0004] Example embodiments provide a data storage method and a terminal of the present invention, W may be performed to avoid excessive number of records distributed large mapping table for storing user data, increasing the target storage node corresponding to the target user query efficiency, thereby improving efficiency of user data is stored.

[0005] 第一方面,本发明实施例提供了一种数据存储方法,包括: [0005] In a first aspect, the present invention provides a data storage method, comprising:

[0006] 接收数据存储请求,所述数据存储请求携带目标用户标识和用户数据; [0006] The received data storage request, the data storage request carries the user identifier and the target user data;

[0007] 将所述目标用户标识按照预设的映射算法进行运算,并根据运算结果查询所述目标用户标识对应的目标转存节点,其中,所述目标转存节点对应多个用户标识; [0007] The user identification calculates the target according to a preset mapping algorithm and queries the target user identifier corresponding to the target operation node according to the result of rollover, wherein the target nodes corresponding to a plurality of dump user identifier;

[000引在存储映射表中查询所述目标转存节点对应的目标存储节点,所述存储映射表中记录有转存节点与存储所述转存节点对应用户数据的存储节点之间的一一对应关系或多对一对应关系; [000 primer query target storage node corresponding to the target node in dump storage mapping table, the mapping table stored in the node is recorded and stored to the dump dump eleven nodes corresponding to the node between the user data stored or many correspondence relationship corresponding relation;

[0009] 将所述数据存储请求携带的所述用户数据存储至所述目标存储节点中对应所述目标用户标识的存储位置。 [0009] storing the data request carries the user data storage to the target storage node corresponding to the storage location of the target user ID.

[0010] 第二方面,本发明实施例提供了一种终端,包括: [0010] In a second aspect, the present invention provides a terminal, comprising:

[0011] 接收单元,用于接收数据存储请求,所述数据存储请求携带目标用户标识和用户数据; [0011] a receiving unit, configured to receive a data storage request, the data storage request carries the user identifier and the target user data;

[0012] 第一查询单元,用于将所述目标用户标识按照预设的映射算法进行运算,并根据运算结果查询所述目标用户标识对应的目标转存节点,其中,所述目标转存节点对应多个用户标识; [0012] a first query unit, for identifying the target user for operation according to a preset mapping algorithm, and dump the target node query identifier corresponding to the target user based on the calculation result, wherein the target node dump corresponding to a plurality of user identification;

[0013] 第二查询单元,用于在存储映射表中查询所述目标转存节点对应的目标存储节点,所述存储映射表中记录有转存节点与存储所述转存节点对应用户数据的存储节点之间的一一对应关系或多对一对应关系; [0013] The second query unit configured to query the target storage node of the storage node corresponding to the target revolution storage mapping table, the mapping table stored in the node is recorded and stored to the dump dump node corresponding to the user data many-to-one relationship or correspondence between the storage node;

[0014] 存储单元,用于将所述数据存储请求携带的所述用户数据存储至所述目标存储节点中对应所述目标用户标识的存储位置。 [0014] a storage unit for storing the position of the target corresponding to the user identification data storage request carries the user data storage to the target storage node.

[0015] 通过实施本发明实施例,终端接收数据存储请求,将数据存储请求中携带的目标用户标识按照预设的映射算法进行运算,并根据运算结果查询目标用户标识对应的目标转存节点,并在存储映射表中查询目标转存节点对应的目标存储节点,进而将数据存储请求中携带的用户数据存储至目标存储节点中对应目标用户标识的存储位置。 [0015] Example embodiments of the present invention through the embodiments, the terminal receives a data storage request, the data storage request carries user identifier calculates a target according to a preset mapping algorithm, the target user ID and queries a corresponding target operation node according to the result of rollover, and querying the target storage node of the storage node corresponding to the target revolution storage mapping table, and then stores the data request carries user data stored in the target storage node to a storage location corresponding to the target user ID. 因此在终端将大量用户数据按照分布式数据存储方式存储到多个存储节点时,可W避免映射表中用户标识与存储节点的对应关系过多,提高终端在映射表中查询目标用户所对应的目标存储节点的效率,从而提高用户数据的存储效率。 Therefore, when a large amount of user data stored in the terminal to the plurality of storage nodes in a distributed data storage, can avoid excessive W corresponding relationship mapping table and the user identifier of the storage node, to improve the terminal queries the user in the mapping table corresponding to the target efficiency of the target storage node, thereby improving the efficiency of user data is stored.

附图说明 BRIEF DESCRIPTION

[0016] 为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可W根据运些附图获得其他的附图。 [0016] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, briefly describes the accompanying drawings required for describing the embodiments used in the following embodiments will be apparent in the following description of the drawings Some embodiments of the present invention are embodiment, those of ordinary skill in the art is concerned, without any creative effort, these may be transported in accordance with W drawings other drawings.

[0017] 图1是本发明实施例提供的一种数据存储方法的流程示意图; [0017] FIG. 1 is a schematic view of a data storage process method according to an embodiment of the present invention;

[0018] 图2是本发明实施例提供的另一种数据存储方法的流程示意图; [0018] FIG. 2 is a schematic diagram of another flow of data storing method according to an embodiment of the present invention;

[0019] 图3是本发明实施例提供的一种终端的结构示意图; [0019] FIG. 3 is a block diagram of a terminal according to an embodiment of the present invention;

[0020] 图4是本发明实施例提供的另一种终端的结构示意图; [0020] FIG. 4 is a schematic diagram of another embodiment of the terminal according to the present invention;

[0021] 图5是本发明实施例提供的一种分布式数据库系统的结构示意图; [0021] FIG. 5 is a schematic structural diagram of a distributed database system according to an embodiment of the present invention;

[0022] 图6是本发明实施例提供的另一种分布式数据库系统的结构示意图; [0022] FIG. 6 is a schematic structural diagram of another distributed database system according to an embodiment of the present invention;

[0023] 图7是本发明实施例提供的另一种终端的结构示意图。 [0023] FIG. 7 is a schematic view of another embodiment of the terminal according to the present invention.

具体实施方式 Detailed ways

[0024] 下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。 [0024] below in conjunction with the present invention in the accompanying drawings, technical solutions of embodiments of the present invention are clearly and completely described, obviously, the described embodiments are part of the embodiments of the present invention rather than all embodiments . 基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。 Based on the embodiments of the present invention, all other embodiments of ordinary skill in the art without any creative effort shall fall within the scope of the present invention.

[0025] 请参见图1,图1是本发明实施例提供的一种数据存储方法的流程示意图。 [0025] Referring to FIG. 1, FIG. 1 is a flow diagram of a data storing method according to an embodiment of the present invention. 如图1所示,该数据存储方法可W包括但不限于W下步骤。 As shown in FIG. 1, the data storage method may include, but are not limited to, W W next step.

[0026] S101、接收数据存储请求,数据存储请求携带目标用户标识和用户数据。 [0026] S101, a received data storage request, the data storage request carries the user identifier and the target user data.

[0027] 本发明实施例中,终端接收用户输入的数据存储请求,该数据存储请求携带目标用户标识和用户数据,终端提取数据存储请求中携带的目标用户标识和用户数据,具体的, 该目标用户标识可为QQ号码、微信号码等,该目标用户标识还可W为QQ号码、微信号码等各种号码转换后的二进制值。 [0027] The embodiments of the present invention, the terminal receives a data storage request input by the user, the data storage request carries the target user identifier and the user data, terminal extracting a target user identifier and a user data storage request carried in. Specifically, the target It may be a user ID number QQ, micro-channel number, etc., of the target user identification binary value W may be converted to various numbers QQ number, the micro-channel number. 具体的,用户可W通过终端中安装的数据库APP(Application, 应用程序)中的选项触发该数据存储请求。 Specifically, the user can request W to the data storage is triggered by the database installed in the terminal APP (the Application, application) options.

[00%] S103、将目标用户标识按照预设的映射算法进行运算,并根据运算结果查询目标用户标识对应的目标转存节点,其中,目标转存节点对应多个用户标识。 [00%] S103, the target user ID according to a preset mapping algorithm for calculation, and querying the target dump node identifier corresponding to the target user based on the calculation result, wherein the target nodes corresponding to a plurality of dump user ID.

[0029] 本发明实施例中,终端提取出数据存储请求中携带的目标用户标识后,将目标用户标识按照预设的映射算法进行运算,其中,该预设的映射算法可包括但不限于哈希算法, 例如:MD5算法(Message-Digest Algorithm 5,信息-摘要算法5)、除留取余算法、平方取中算法等。 After the [0029] embodiment of the present invention, the target terminal extracts the user identification data carried in the request is stored, calculates the target user ID according to a preset mapping algorithm, wherein the predetermined mapping algorithm may include but are not limited to, Ha Xi algorithm, for example: MD5 algorithm (message-digest algorithm 5, information - digest algorithm 5), in addition to specimens congruence algorithm, the algorithm takes the square. 终端采用哈希算法将目标用户标识对应的任意长度的二进制值映射为较短的固定长度的二进制值,得到哈希值,并根据运算结果(即哈希值)查询目标用户标识对应的目标转存节点,其中,若终端所对应的分布式数据库系统包括多个转存节点,则每个转存节点对应一个或多个用户标识,且多个转存节点中至少有一个转存节点对应多个用户标识,且多个转存节点各自对应的用户标识的个数可W相同,也可W不同。 Hashing algorithm using the terminal arbitrary length binary value corresponding to the target user ID is mapped to a short fixed length binary value to obtain a hash value, and the target user query identifier corresponding to the target revolution speed based on the calculation result (i.e., hash value) storage node, wherein, if the terminal corresponding to the distributed database system comprising a plurality of dump nodes, each node corresponds to a dump or more user identification, and a plurality of nodes at least dump dump node corresponding to a plurality user identification, user identification number and a plurality of nodes each corresponding to dump W may be the same as or different from W. 例如,第一转存节点对应一个用户标识,第二转存节点对应两个用户标识,第Ξ转存节点对应Ξ个用户标识;或者,第一转存节点、第二转存节点和第Ξ转存节点各自对应两个用户标识,等等。 For example, a first node corresponds to a dump user identifier, the second node corresponding to two dump user identifier, the first node corresponding to Ξ Ξ dump user identifier; or dump a first node, a second node and a dump Ξ corresponding to two dump nodes each user ID, and the like. 需要说明的是, 若终端采用的映射算法为MD5算法,则多个转存节点各自对应的用户标识的个数相同。 Incidentally, if the mapping algorithm MD5 algorithm is used by the terminal, the same number of a plurality of dump user identifier corresponding to each node. 因此将用户标识进行哈希运算之后,可将多个用户标识分别映射到不同的转存节点上,也可W 将不同用户标识映射到同一个转存节点上,因此,一个转存节点可对应多个用户标识,转存节点的数量小于用户标识的数量,从而避免了将用户标识直接映射到存储节点时产生的大映射表,缩减了映射条数。 So after hashing the user identification, user identification may be mapped to a plurality of different dump nodes, W may be a different user ID mapped to the same node of a dump, therefore, may correspond to a dump node a plurality of user identification, the number of nodes is less than the number of dump user identification, thereby avoiding large mapping table generated when the user ID is mapped directly to the storage node, the reduced number of mapping.

[0030] 举例来说,若终端所对应的分布式数据库系统中存储有12个用户对应的用户数据,该12个用户的用户标识分别为1、3、5、6、8、9、12、14、16、17、19和20,终端所采用的预设的哈希算法为除留取余法,且运算的参数为%11,则将上述12个用户的用户标识分别进行哈希运算,即1 % 11 = 1,3% 11 = 3,5% 11 = 5,6% 11 =6,8% 11 =8,9% 11 = 9,12% 11 = 1, 14% 11 = 3,16% 11 = 5,17% 11 = 6,19% 11 = 8,20% 11 = 9,因此进行哈希运算之后得到的12个哈希值分别为1、3、5、6、8、9、1、3、5、6、8和9,则可知哈希值为1的用户标识1和用户标识12对应的目标转存节点为哈希值1指示的转存节点L1,哈希值为3的用户标识3和用户标识14对应的目标转存节点为哈希值3指示的转存节点L3,哈希值为5的用户标识5和用户标识16对应的目标转存节点为哈希值5指示的转存节点L5,哈希值为6的用户标识6和用户标识17对应的 [0030] For example, if the distributed database system corresponding to a terminal is stored in the user data 12 corresponding to the user, the user's user ID 12 were 1,3,5,6,8,9,12, 14,16,17,19 and 20, the default hash algorithm used for the terminal in addition to specimens I, parameters and operations is 11%, then the above-described identifier of the user 12 are hashed, i.e., 1 = 11% 11 = 1,3% 3,5% 5,6% 11 = 11 = 11 = 6,8% 8,9% 9,12% 11 = 11 = 1, 11 = 14% 3,16 11% 11% = 5,17 6,19 = 8,20 = 11% = 11% 9, thus obtained after hashing the hash values ​​12 are 1,3,5,6,8,9, 1,3,5,6,8 and 9, it is found that the user is a hash of the target and identifies a dump node 12 corresponding to the user identifier is a hash value L1 dump node 1 indicates the hash value of 3 3 the target user ID and a user identifier 14 corresponding to the target node is a hash value dump 3 indicative of the user node dump L3, the hash value of the identifier 5 and 5 corresponding to the user ID 16 is a hash value of the node dump 5 L5 dump node indicated by the hash value of the user's identity 6 and 6 corresponding to the user identifier 17 标转存节点为哈希值6指示的转存节点L6,哈希值为8的用户标识8和用户标识19对应的目标转存节点为哈希值8指示的转存节点L8,哈希值为9的用户标识9和用户标识20对应的目标转存节点为哈希值9指示的转存节点L9。 Standard dump node hash value 6 indicates the dump nodes L6, 8 hash value of the user identification and the user identifier 19 8 dump target node corresponding to L8, a hash value of a hash value of the node 8 rollover indication 9 and the destination identification dump node 20 corresponding to the user ID of the user 9 as a hash value indicating the dump node 9 L9.

[0031 ] S105、在存储映射表中查询目标转存节点对应的目标存储节点,存储映射表中记录有转存节点与存储转存节点对应用户数据的存储节点之间的一一对应关系或多对一对应关系。 The target storage node [0031] S105, the query is stored in the mapping table corresponding to the target revolution storage node, the storage mapping table recorded in the storage node dump dump node corresponds to one correspondence between the storage node or user data on a correspondence.

[0032] 本发明实施例中,终端读取存储映射表,在存储映射表中查询目标转存节点对应的目标存储节点,该存储映射表中记录有转存节点标识与存储该转存节点对应用户数据的存储节点的标识之间的一一对应关系或多对一对应关系,其中,每个存储节点对应一个或多个转存节点。 [0032] The embodiments of the present invention, the terminal reads the stored mapping table, querying the target nodes corresponding to the dump destination storage node stores a mapping table, the mapping table storage dump node identifier is recorded and stored in the node corresponding to dump one correspondence between the identification of the user data storage node or one mapping relationship, wherein each storage node corresponds to one or more dump nodes. 为了提高终端读取存储映射表的效率,可W将存储映射表缓存在分布式数据库系统的内存中,终端直接从分布式数据库系统的内存中读取存储映射表,不再通过分布式数据库系统的磁盘读取存储映射表,大大提高了终端读取存储映射表的效率。 In order to improve the mapping table stored in the terminal read efficiency, W may be a mapping table stored in the cache memory in a distributed database system, the terminal reads the stored mapping table directly from the memory in a distributed database system, not by a distributed database system the storage disk reads mapping table, greatly improving the terminal reads the mapping table storage efficiency.

[0033] 具体来说,存储映射表可采用例如但不限于如下表1结构: [0033] Specifically, the mapping table can be stored, for example, but not limited to, the following structures in Table 1:

[0034] 表1 [0034] TABLE 1

[0035] [0035]

Figure CN105491149AD00071

[0036] 由表1可知,转存节点标识为L1和L3的转存节点对应存储节点502,转存节点标识为L5和L6的转存节点对应存储节点504,转存节点标识为L8和L9的转存节点对应存储节点506,由此可知,用户标识为1、3、12和14的用户对应存储节点502,用户标识为5、6、16和17的用户对应存储节点504,用户标识为8、9、19和20的用户对应存储节点506。 [0036] From Table 1, dump node identified as L1 and L3 dump node corresponds to storage node 502, dump node identifier to dump node L5 and L6 corresponds to storage node 504, dump node identified as L8 and L9 storage node corresponding to the user corresponding to the user of the storage node corresponding to the node dump storage node 506, can be seen, a user identified as 1,3,12 and 14 502, a user identified as 5,6,16 and 17 504, a user identified as 8,9,19 and 20 corresponding to the user node 506 is stored. 其中,存储节点的数量小于转存节点的数量,因此存储节点的数量更加小于用户标识的数量,从而避免了将用户标识直接映射到存储节点时产生的映射条数过多的映射表,缩减了映射表中的映射条数。 Wherein the number of storage nodes is smaller than the number of dump nodes, the number of storage nodes is more smaller than the number of user identification, thereby avoiding an excessive number of pieces generated when mapping the user ID is mapped directly to the storage node mapping table, reduced Article number mapping table mapping.

[0037] S107、将数据存储请求携带的用户数据存储至目标存储节点中对应目标用户标识的存储位置。 [0037] S107, the data storage request carries the user data stored in a storage location corresponding to the target storage node identified by the target user.

[0038] 本发明实施例中,存储节点502-506中的每一个存储节点都存储有多个用户数据, 每一个用户数据由该用户数据的数据标识唯一标识,该数据标识可W包括但不限于用户标识和数据项标识。 [0038] The embodiments of the present invention, each node 502-506 in the storage node is stored a plurality of data users, each user is uniquely identified by the data identification data of the user data, the identification data may include, but are not W limited to the user identification and the identification data items. 例如,存储节点502中存储有用户1的年龄"18岁",则"18岁"即为存储节点502中存储的用户数据,该用户数据由用户标识"Γ和数据项标识"年龄"唯一标识。 For example, the storage node 502 is stored in the age of the user 1 "18 years", the "18 years" is the user data stored in the storage node 502, the user data by the user ID "Gamma] and identification data item" age "unique identification .

[0039] 具体来说,每一存储节点都维护一张数据映射表,数据映射表中记录有每个用户数据的数据标识与该用户数据在存储节点中的存储位置之间的对应关系,其中数据标识可唯一标识该数据标识对应的用户数据。 [0039] Specifically, each storage node maintains a mapping data table, the data is recorded in the mapping table of correspondence between a storage location in the storage node of each user data in the data identifying the user data, wherein identification data uniquely identifies the user data of the data corresponding to the identifier. 在具体实现过程中,当存储节点502采用数据表来存储用户数据时,数据映射表可采用例如但不限于如下表2所示结构: In a specific implementation process, when the storage node 502 using a data table storing user data, the mapping table may be employed such as, but not limited to the structure shown in the following Table 2:

[0040] 表2 [0040] TABLE 2

[0041] [0041]

Figure CN105491149AD00072

[0042] 由表2可知,数据标识为"用户1、年龄"的用户数据保存在存储节点502中存储的数据表1中,数据标识为"用户3、身高"的用户数据保存在存储节点502中存储的数据表2中。 User data [0042] 2 shows that table, the data identified as "user 1, age" stored in the stored in the storage node 502 data of Table 1, the data identified as "user 3, the height" is stored in the storage node 502 data stored in the table 2 below.

[0043] 终端通过上述映射算法和存储映射表查询到目标用户标识对应的目标存储节点后,将数据存储请求中携带的用户数据存储至目标存储节点中对应目标用户标识的存储位置,例如,若终端查询到目标存储节点为存储节点502,且具体为存储节点502中的数据表1, 且数据存储请求中携带的用户数据为用户1的身高"180cm",则终端将用户数据"180cm"存储到存储节点502中的数据表1中。 After [0043] the terminal queries the target user identifier corresponding to the target storage node via the mapping algorithm and storing a mapping table, the data storage request carries user data storage to the target storage node corresponding to the storage location of the target user ID, for example, if the terminal inquiry to the target storage node to storage node 502, and specifically the storage node 502 in the data in table 1, the user data and the data stored carried in the request for the height of the user 1 "180cm", the terminal user data "180cm" stored storage node 502 to the data in table 1.

[0044] 需要说明的是,本发明实施例描述的为数据存储时的应用场景,用户通过终端从存储节点中读取用户数据时,终端根据用户标识查询用户标识对应的存储节点的执行操作同上,此处不再寶述。 [0044] Incidentally, embodiments described embodiment of the present invention is applied when a scene data storage, the user reads the user data from the storage node by the terminal, the terminal queries the user according to the user identifier corresponding to the identifier of the storage node to perform operations as above here is no longer Bao said.

[0045] 可见,在图1所描述的方法中,终端接收数据存储请求,将数据存储请求中携带的目标用户标识按照预设的映射算法进行运算,并根据运算结果查询目标用户标识对应的目标转存节点,并在存储映射表中查询目标转存节点对应的目标存储节点,进而将数据存储请求中携带的用户数据存储至目标存储节点中对应目标用户标识的存储位置。 [0045] visible, in the method described in FIG. 1, the terminal receives a data storage request, the data storage request carries user identifier calculates a target according to a preset mapping algorithm and queries the user identifier corresponding to the target based on the calculation result of the target dump node, the target node and the query dump destination storage node corresponding to the mapping table in the memory, and further to store the data request carries user data stored in the target storage node to a storage location corresponding to the target user ID. 因此在终端将大量用户数据按照分布式数据存储方式存储到多个存储节点时,可W避免映射表中用户标识与存储节点的对应关系过多,提高终端在映射表中查询目标用户所对应的目标存储节点的效率,从而提高用户数据的存储效率。 Therefore, when a large amount of user data stored in the terminal to the plurality of storage nodes in a distributed data storage, can avoid excessive W corresponding relationship mapping table and the user identifier of the storage node, to improve the terminal queries the user in the mapping table corresponding to the target efficiency of the target storage node, thereby improving the efficiency of user data is stored.

[0046] 请参见图2,图2是本发明实施例提供的另一种数据存储方法的流程示意图。 [0046] Referring to FIG. 2, FIG. 2 is a schematic flow diagram of another data storage method according to an embodiment of the present invention. 如图2 所示,该数据存储方法可W包括但不限于W下步骤。 2, the W data storage method may include, but are not limited to the W step.

[0047] S201、接收数据存储请求,数据存储请求携带目标用户标识和用户数据。 [0047] S201, a received data storage request, the data storage request carries the user identifier and the target user data.

[0048] S203、将目标用户标识按照预设的映射算法进行运算,并根据运算结果查询目标用户标识对应的目标转存节点,其中,目标转存节点对应多个用户标识。 [0048] S203, the target user ID according to a preset mapping algorithm for calculation, and querying the target dump node identifier corresponding to the target user based on the calculation result, wherein the target nodes corresponding to a plurality of dump user ID.

[0049] S205、在存储映射表中查询目标转存节点对应的目标存储节点,存储映射表中记录有转存节点与存储转存节点对应用户数据的存储节点之间的一一对应关系或多对一对应关系。 The target storage node [0049] S205, the query is stored in the mapping table corresponding to the target revolution storage node, the storage mapping table recorded in the storage node dump dump node corresponds to one correspondence between the storage node or user data on a correspondence.

[0050] S207、将数据存储请求携带的用户数据存储至目标存储节点中对应目标用户标识的存储位置。 [0050] S207, the data storage request carries the user data stored in a storage location corresponding to the target storage node identified by the target user.

[0化1] 本发明实施例中的S201-S207可参见图1所示实施例的S101-S107,此处不再寶述。 [0 of 1] S201-S207 of the embodiment 1 can be found in the embodiment shown in S101-S107 in FIG embodiment of the present invention, not described here Po.

[0052] S209、根据目标存储节点中存储的用户数据判断目标存储节点是否过负荷,若是, 执行步骤S211;若否,结束本流程。 [0052] S209, the user determines the target storage node data stored in the target storage node is overloaded, if yes, performs step S211; if NO, the process ends.

[0053] 本发明实施例中,终端根据目标存储节点中存储的用户数据判断目标存储节点是否过负荷,若判断出目标存储节点过负荷,则执行步骤S211;若否,结束本流程。 [0053] The embodiments of the present invention, the terminal determines whether the target storage node overload the subscriber data stored in the target storage node, if it is determined that the target storage node overload, step S211 is performed; if not, the process ends.

[0054] 作为一种可选的实施方式,根据目标存储节点中存储的用户数据判断目标存储节点是否过负荷,包括: [0054] As an alternative embodiment, the user data stored in the target storage node determines whether the target node memory overload, comprising:

[0055] 持续统计目标存储节点在每一时间周期内的用户数据增长速度,在用户数据增长速度超过预设增长速度阔值时判定目标存储节点过负荷。 [0055] Statistics Length user data storage node target growth rate in each time period, the overload determination target storage node when the user data rate exceeds a predetermined increase width growth values.

[0056] 具体的,终端持续统计目标存储节点在每一时间周期内的用户数据增长速度,在用户数据增长速度超过预设增长速度阔值时判定目标存储节点过负荷。 Determining a target load through the storage node [0056] Specifically, the terminal count continued growth target user data is stored in a node for each time period, the growth rate in the user data exceeds a preset value width growth. 其中,该时间周期可根据终端的具体应用环境进行设置。 Wherein, the time period can be set according to the specific application environment of the terminal. 不难理解,周期时长越短,算得的用户数据增长速度越准确。 Understandably, the shorter the time period, the more accurate user data calculated growth rate. 预设增长速度阔值也可根据终端的具体应用环境进行设置。 Preset value width growth rate can also be set according to the specific application environment of the terminal.

[0057] 在具体实现过程中,可采用例如但不限于下列公式来计算目标存储节点的用户数据增长速度:用户数据增长速度=(当前周期统计的用户数据的数据量前一周期统计的用户数据的数据量)/周期时长。 [0057] In a specific implementation, may be employed for example but not limited to the following equation to calculate the target user data storage node growth: growth rate of user data = (data amount of the current period statistical user data of the previous cycle statistical user data when the amount of data length) / cycle. 上述周期时长可根据终端的具体应用环境进行设置。 Length can be set according to the specific application environment of the terminal when said period. 用户数据增长速度为正值,表明目标存储节点中用户数据在增长,且值越大表明目标存储节点中用户数据的增长速度越快,为负表明目标存储节点中用户数据在减少。 Positive growth rate of user data, the user indicates that the target data storage node is growing, the growth rate and the higher number indicates a target storage node user data faster, the storage node is negative indicates that the target user data is reduced.

[0058] 作为另一种可选的实施方式,根据目标存储节点中存储的用户数据判断目标存储节点是否过负荷,包括: [0058] As another alternative embodiment, the user data stored in the target storage node determines whether the target node memory overload, comprising:

[0059] 统计目标存储节点中存储的用户数据的数量,在目标存储节点中用户数据的数量超过预设容量阔值时判定目标存储节点过负荷。 [0059] The statistical amount of user data stored in the target storage node, in the target storage node exceeds a preset amount of user data capacity of the storage node determines a target value width is overloaded.

[0060] 具体的,终端统计目标存储节点中存储的用户数据的数量,在目标存储节点中用户数据的数量超过预设容量阔值时判定目标存储节点过负荷。 Determining a target load through the storage node [0060] Specifically, the terminal count the number of user data stored in the target storage node, in the target storage node exceeds a preset amount of user data capacity width value. 其中,预设容量阔值可根据目标存储节点的具体存储容量进行设置,例如,若目标存储节点的存储容量为200GB,则将目标存储节点对应的预设容量阔值设置为180GB等。 The preset capacity value width can be set depending on the storage capacity of the target storage node, e.g., if the storage capacity of 200GB to the target storage node, then the node corresponding to the target storage capacity width preset value is set to 180GB like.

[0061 ] S211、从目标存储节点所存储的多个转存节点对应的用户数据中选择部分转存节点对应的用户数据作为待迁移用户数据,并从尚未过负荷的存储节点中选择至少一个存储节点作为待迁移存储节点,或从新增的存储节点中选择至少一个存储节点作为待迁移存储节点,其中,待迁移存储节点的剩余总存储容量大于待迁移用户数据的数据量。 [0061] S211, user data from a plurality of nodes dump destination storage node corresponding to the stored selected portion dump node corresponding user data as the user data to be migrated and select at least one storage node from a storage medium has not been overloaded node as a storage node to be migrated, or selecting at least one additional storage node from a storage node to be migrated as a storage node, wherein the remaining total storage capacity of the storage node to be migrated is greater than the amount of data the user data to be migrated.

[0062] 本发明实施例中,若终端判断出目标存储节点过负荷,则终端从目标存储节点所存储的多个转存节点对应的用户数据中选择部分转存节点对应的用户数据作为待迁移用户数据,并从尚未过负荷的存储节点中选择至少一个存储节点作为待迁移存储节点,或从新增的存储节点中选择至少一个存储节点作为待迁移存储节点,其中,待迁移存储节点的剩余总存储容量大于待迁移用户数据的数据量。 User data Embodiment [0062] In the present invention, the plurality of nodes corresponding to the dump if the user terminal determines that the target data storage node overload, the target storage node from the terminal of the stored selected portion corresponding to a dump node to be migrated user data, select at least one storage node and the storage node has not been overloaded as a storage node to be migrated, or selecting at least one additional storage node from a storage node to be migrated as a storage node, wherein the storage node to be migrated remaining data amount greater than the total storage capacity of user data to be migrated. 其中,待迁移存储节点的数量可W为一个, 也可W为多个,本发明实施例W待迁移存储节点为一个为例进行说明。 Wherein the number of storage nodes may be migrated to a W, W may be a plurality of, for example, W embodiment of the present invention to be migrated to a storage node as an example.

[0063] 具体的,若终端判断出目标存储节点过负荷,则需要将目标存储节点中的部分用户数据进行数据迁移,即需要对分布式数据库系统进行扩容,或对分布式数据库系统的负载进行均衡,W使目标存储节点中的用户数据不再过负荷,从而影响系统性能。 [0063] Specifically, if the terminal determines that the target storage node overload, the target needs to be part of the user data in the data storage node migration, the need for expansion of the distributed database system, or the load is distributed database system balanced, W of the user data in the target storage node is no longer overloaded, thus affecting the system performance. 终端从尚未过负荷的存储节点中选择至少一个存储节点,或从系统新增加的存储节点中选择至少一个,或从尚未过负荷的存储节点W及新增加的存储节点中选择至少一个尚未过负荷的存储节点W及至少一个新增加的存储节点作为待迁移存储节点,若待迁移存储节点为一个,贝U 该待迁移存储节点的剩余总存储容量需大于待迁移用户数据的数据量,若待迁移存储节点为多个,则多个待迁移存储节点的剩余总存储容量需大于待迁移用户数据的数据量。 The terminal selecting at least one storage node from the storage node has not been overloaded, or select at least one slave system, new storage node, or select from a storage node W and the newly added storage node has not been overloaded at least one has not been overloaded the storage node W and at least one newly added storage node as to be migrated storage node, if to be migrated storage node of a remaining total storage capacity shellfish U-be migrated storage node must be greater than the amount of data to be migrated user data, if to be the remaining total storage capacity of a plurality of storage node migration, the migration of a plurality of storage nodes need to be greater than the amount of data to migrate user data.

[0064] S213、将待迁移用户数据迁移到待迁移存储节点中,并更新存储映射表。 [0064] S213, the user will be migrated to a data migration to be migrated in the storage node, and updates the stored map.

[0065] 本发明实施例中,终端将待迁移用户数据迁移到待迁移存储节点中,并更新存储映射表。 Embodiment [0065] of the present invention, the user terminal will be migrated to a data migration to be migrated in the storage node, and updates the stored map.

[0066] 例如,若目标存储节点为存储节点502,终端从存储节点502中存储的转存节点L1 和L3对应的用户数据中选择转存节点L1对应的用户1和用户12对应的所有用户数据作为待迁移用户数据,用户1和用户12对应的所有用户数据的数据量为50GB(Gigabyte,吉字节), 终端从新增加的存储节点中选择一个标识为512的存储节点作为待迁移存储节点,该待迁移存储节点的存储容量为200GB,可容纳待迁移用户数据。 [0066] For example, 502, the terminal from the storage node 502 in the dump node storing L1 and L3 corresponding to the user data, select L1 corresponding user dump node 1 and all user data 12 corresponding to the user if the target storage node to storage node as the user data to be migrated, all the user 1 and the amount of user data corresponding to the user 12 is 50GB (Gigabyte, gigabytes), the terminal increases from the new storage node selects one storage node 512 is identified as a storage node to be migrated, storage capacity of the storage node to be migrated is 200GB, the user can receive data to be migrated. 因此,终端将待迁移用户数据迁移至待迁移存储节点512上,即实现了多个用户的用户数据的批量迁移,不再针对每一个用户数据进行单独迁移,提高了用户数据的迁移效率。 Thus, the user terminal will be migrated to a data migration to be migrated on the storage node 512, i.e., to achieve a batch migration of multiple users of user data, no separate data migration for each user, improving the efficiency of user data migration. 终端将待迁移用户数据迁移至待迁移存储节点后,更新存储映射表,将存储映射表中转存节点L1对应存储节点标识修改为待迁移存储节点的标识512,后续若需对用户1和用户12对应的用户数据进行存取,则需从存储节点512中存取用户1和用户12对应的用户数据。 After the user terminal to be migrated for migration data migration to the storage node, update the storage mapping table, the mapping table storage memory relay node identifier corresponding to L1 storage node to be migrated modified to identify the storage node 512, for subsequent For user 1 and user 12 corresponds to user data access, the user is required to access the user data corresponding to user 1 and 12 from the storage node 512.

[0067] 可见,在图2所描述的方法中,当终端判断出目标存储节点过负荷时,从目标存储节点中存储的多个转存节点对应的用户数据中选择部分转存节点对应的用户数据作为待迁移用户数据,并从尚未过负荷的存储节点中选择至少一个存储节点作为待迁移存储节点,或从新增的存储节点中选择至少一个存储节点作为待迁移存储节点,进而将待迁移用户数据迁移至待迁移存储节点中,因此可W针对多个用户标识对应的用户数据进行批量迁移,无需针对单独用户的用户数据进行逐次迁移,减少了用户数据迁移的次数和时间,提高了用户数据的迁移效率。 [0067] visible, in the method described in FIG. 2, when the user terminal determines that the target data storage node is overloaded, the target from the storage node corresponding to the plurality of nodes stored in the dump dump portion corresponding to the node selected by the user data as user data to be migrated and select at least one storage node from the storage node has not been overloaded as a storage node to be migrated, or selecting at least one additional storage node from a storage node to be migrated as a storage node, and thus to be migrated user data migration to the storage node to be migrated, thus W bulk mobility for a plurality of user identification data corresponding to the user, without the need for individual users sequentially migrate user data, and reducing the number of times the user data migration, improving user efficiency of data migration.

[0068] 上述详细阐述了本发明实施例的方法,下面为了便于更好地实施本发明实施例的上述方案,相应地,下面还提供用于配合实施上述方案的相关终端。 [0068] The embodiment explained in detail how the present embodiment of the invention, following the above-described embodiment in order to facilitate a better solution of the embodiment of the present invention, accordingly, also the following embodiments provide a terminal for engaging the above-described embodiment.

[0069] 请参见图3,图3是本发明实施例提供的一种终端的结构示意图。 [0069] Referring to FIG. 3, FIG. 3 is a schematic structural diagram of a terminal according to an embodiment of the present invention. 如图3所示,该终端30包括:接收单元301、第一查询单元303、第二查询单元305和存储单元307,其中, As shown in FIG 3, the terminal 30 comprises: a receiving unit 301, a first query unit 303, a second query unit 305 and a storage unit 307, wherein,

[0070] 接收单元301,用于接收数据存储请求,数据存储请求携带目标用户标识和用户数据; [0070] The receiving unit 301 for receiving data storage request, the data storage request carries the user identifier and the target user data;

[0071] 第一查询单元303,用于将目标用户标识按照预设的映射算法进行运算,并根据运算结果查询目标用户标识对应的目标转存节点,其中,目标转存节点对应多个用户标识; [0071] The first query unit 303, a user identification for the target calculation performed according to a preset mapping algorithm, the target user ID and queries a corresponding target operation node according to the result of rollover, wherein the target nodes corresponding to a plurality of dump user identification ;

[0072] 第二查询单元305,用于在存储映射表中查询目标转存节点对应的目标存储节点, 存储映射表中记录有转存节点与存储转存节点对应用户数据的存储节点之间的一一对应关系或多对一对应关系; [0072] The second query unit 305, a mapping table for storing target query dump destination storage node corresponding to the storage mapping table recorded in the storage node dump dump storage node corresponding to the node between the user data or many-to-one correspondence between the correspondence relationship;

[0073] 存储单元307,用于将数据存储请求携带的用户数据存储至目标存储节点中对应目标用户标识的存储位置。 [0073] The storage unit 307, a data storage request for storing user data carried in the target storage node to a storage location corresponding to the target user ID.

[0074] 可理解的是,本实施例的终端30的各功能单元的功能可参见图1所示实施例的相关描述,此处不再寶述。 [0074] understood that the functions of each functional unit 30 of the terminal according to the present embodiment may refer to the related description of the embodiment shown in FIG. 1, not Po described herein.

[0075] 请一并参见图4,图4是本发明实施例提供的另一种终端的结构示意图。 [0075] Please also refer to FIG. 4, FIG. 4 is a schematic structural diagram of another terminal according to an embodiment of the present invention. 其中,图4 所示的终端30是由图3所示的终端30进行优化得到的。 Wherein, the terminal 30 shown in FIG. 4 is obtained by optimizing the terminal 30 shown in Figure 3. 与图3相比,图4所描述的终端30包括接收单元301、第一查询单元303、第二查询单元305和存储单元307外,还包括判断单元309、 选择单元311和迁移单元313,其中, Compared with FIG. 3, FIG. 4 described terminal 30 includes a receiving unit 301, a first query unit 303, a second query unit 305 and a storage unit 307, the determining unit 309 further includes a selection unit 311 and the migration unit 313, wherein ,

[0076] 判断单元309,用于根据目标存储节点中存储的用户数据判断目标存储节点是否过负荷; [0076] determination unit 309, according to the user data stored in the target storage node determines whether the target storage node overload;

[0077] 作为一种可选的实施方式,判断单元309具体用于: [0077] As an alternative embodiment, the determining unit 309 is specifically configured to:

[0078] 持续统计目标存储节点在每一时间周期内的用户数据增长速度,在用户数据增长速度超过预设增长速度阔值时判定目标存储节点过负荷;或, Determining a target load through the storage node [0078] Statistics Length user data storage node target growth rate in each time period, the growth rate in the user data exceeds a preset value width growth; or,

[0079] 统计目标存储节点中存储的用户数据的数量,在目标存储节点中用户数据的数量超过预设容量阔值时判定目标存储节点过负荷。 [0079] The statistical amount of user data stored in the target storage node, in the target storage node exceeds a preset amount of user data capacity of the storage node determines a target value width is overloaded.

[0080] 选择单元311,用于若判断单元309判断出目标存储节点过负荷,则从目标存储节点所存储的多个转存节点对应的用户数据中选择部分转存节点对应的用户数据作为待迁移用户数据,并从尚未过负荷的存储节点中选择至少一个存储节点作为待迁移存储节点, 或从新增的存储节点中选择至少一个存储节点作为待迁移存储节点,其中,待迁移存储节点的剩余总存储容量大于待迁移用户数据的数据量; [0080] The selecting unit 311, a plurality of nodes if rollover determination unit 309 determines the target storage node overload, from the target storage node corresponding to the stored user data stored in the selected portion corresponding to the node forwarding user data to be used as migrating user data, select at least one storage node and the storage node has not been overloaded as a storage node to be migrated, or selecting at least one additional storage node from a storage node to be migrated as a storage node, wherein the storage node to be migrated the remaining amount of data is greater than the total storage capacity of user data to be migrated;

[0081] 迁移单元313,用于将待迁移用户数据迁移到待迁移存储节点中,并更新存储映射表。 [0081] The migration unit 313, the user data to be migrated for migration to be migrated to the storage node, and updates the stored map.

[0082] 可理解的是,本实施例的终端30的各功能单元的功能参见图2所示实施例的相关描述,此处不再寶述。 [0082] understood that the illustrated embodiments described embodiments related functions of each functional unit Referring to FIG terminal 30 of the present embodiment 2, Po is no longer described here.

[0083] 请参见图5,图5是本发明实施例提供的一种分布式数据库系统的结构示意图。 [0083] Referring to FIG. 5, FIG. 5 is a schematic structural diagram of a distributed database system according to an embodiment of the present invention. 如图5所示,分布式数据库系统500包括多个存储节点502-506和业务服务器508。 5, a distributed database system 500 includes a plurality of storage nodes 502-506 and the service server 508. 其中,存储节点502-506与业务服务器508之间可通过总线或者其它方式连接,其中,图5中W通过总线510连接为例。 Wherein the storage node and the service server 502-506 may be connected by a bus 508 or other means between, wherein W in FIG. 5 Example 510 connected by a bus. 存储节点502-506中的每一个存储节点都存储有多个用户数据,每一个用户数据由该用户数据的数据标识唯一标识,该数据标识可W包括但不限于用户标识和数据项标识。 Each node 502-506 in the storage node is stored a plurality of data users, each user is uniquely identified by the data identification data of the user data, the identification data may include, but are not limited to W, and the user identification data item identifier. 例如,存储节点502中存储有用户1的年龄"18岁",则"18岁"即为存储节点502中存储的用户数据,该用户数据由用户标识"Γ和数据项标识"年龄"唯一标识。业务服务器508可用于实现用户的注册、数据上传、数据下载等业务,业务服务器508还用于根据用户发送的数据存储请求将用户需要存储的用户数据存储到存储节点502-506中,或根据用户发送的数据访问请求从存储节点502-506中获取用户需要的用户数据,本实施例中业务服务器508 可具体为上述实施例中的终端30。 For example, the storage node 502 is stored in the age of the user 1 "18 years", the "18 years" is the user data stored in the storage node 502, the user data by the user ID "Gamma] and identification data item" age "unique identification the service server 508 may be used to achieve a registered user, to upload data, download data, and other services, the service server 508 is further configured to store user data according to the data storage request sent by the user to the user to be stored in the storage node 502-506, or according to data sent by a user access request to obtain the user data required by the user from the storage node 502-506 in the present embodiment, the service server 508 may be embodied as a terminal 30 of the above-described embodiments.

[0084] 具体来说,每一存储节点都维护一张数据映射表,数据映射表中记录有每个用户数据的数据标识与该用户数据在存储节点中的存储位置之间的对应关系,其中数据标识可唯一标识该数据标识对应的用户数据。 [0084] Specifically, each storage node maintains a mapping data table, the data is recorded in the mapping table of correspondence between a storage location in the storage node of each user data in the data identifying the user data, wherein identification data uniquely identifies the user data of the data corresponding to the identifier. 在具体实现过程中,当存储节点502采用数据表来存储用户数据时,数据映射表可采用例如但不限于表2所示结构。 In a specific implementation process, when the storage node 502 using a data table storing user data, the mapping table may be employed, for example, but not limited to the structure shown in Table 2.

[0085] 需要说明的是,为提高业务服务器508从存储节点502-506中存取用户数据的效率,可使用内存数据库来实现上述存储节点502-506中的至少一个,即将用户数据放在内存中,W提高业务服务器508的业务性能。 [0085] Incidentally, the service server 508 in order to improve the access efficiency of the storage nodes 502-506 from the user data, the storage node may be implemented in at least one of 502-506 using memory database, i.e. the user data in memory , W is to improve business performance business server 508.

[0086] 应注意,本领域的技术人员应当明白,在具体实现过程中,存储节点的数量可根据实际需要进行设置,而并非局限于图5中所示的数量。 [0086] It should be noted, those skilled in the art will appreciate that, in the specific implementation, the number of storage nodes may be set according to the number of actual needs, and not be limited to 5 shown in FIG.

[0087] 业务服务器508用于接收数据存储请求,该数据存储请求携带目标用户标识和用户数据,业务服务器508提取数据存储请求中携带的目标用户标识和用户数据,具体的,该目标用户标识可为QQ号码、微信号码等,该目标用户标识还可W为QQ号码、微信号码等各种号码转换后的二进制值。 [0087] The service server 508 is configured to receive a data storage request, the data storage request carries the user identifier and the target user data, service server 508 extracts the target user and the user identification data carried in the request is stored, particularly, the destination user identification may as QQ number, the micro-channel number, etc., of the target user identification binary value W may be converted to various numbers QQ number, the micro-channel number. 业务服务器508将目标用户标识按照预设的映射算法进行运算,其中,该预设的映射算法可包括但不限于哈希算法,例如:MD5算法、除留取余算法、平方取中算法等。 The service server 508 calculates the target user ID according to a preset mapping algorithm, wherein the predetermined mapping algorithm may include but are not limited to, hash algorithm, for example: MD5 algorithm, in addition to specimens congruence algorithm, the algorithm takes the square. 业务服务器508采用哈希算法将目标用户标识对应的任意长度的二进制值映射为较短的固定长度的二进制值,得到哈希值,并根据运算结果(即哈希值)查询目标用户标识对应的目标转存节点,其中,若终端所对应的分布式数据库系统包括多个转存节点,则每个转存节点对应一个或多个用户标识,且多个转存节点中至少有一个转存节点对应多个用户标识,且多个转存节点各自对应的用户标识的个数可W相同,也可W不同。 The service server 508 uses a hashing algorithm to the target user ID corresponding mapping arbitrary length binary value to a shorter fixed-length binary value to obtain a hash value, and query the user identifier corresponding to the target based on the calculation result (i.e., hash value) dump target node, wherein, if the terminal corresponding to the distributed database system comprising a plurality of dump nodes, each node corresponds to a dump or more user identification, and a plurality of nodes at least dump a dump node corresponding to a plurality of user identification, a user identification number and a plurality of nodes each corresponding to dump W may be the same as or different from W. 例如,第一转存节点对应一个用户标识,第二转存节点对应两个用户标识,第Ξ转存节点对应Ξ个用户标识;或者,第一转存节点、第二转存节点和第Ξ转存节点各自对应两个用户标识,等等。 For example, a first node corresponds to a dump user identifier, the second node corresponding to two dump user identifier, the first node corresponding to Ξ Ξ dump user identifier; or dump a first node, a second node and a dump Ξ corresponding to two dump nodes each user ID, and the like. 需要说明的是,若终端采用的映射算法为MD5算法,则多个转存节点各自对应的用户标识的个数相同。 Incidentally, if the mapping algorithm MD5 algorithm is used by the terminal, the same number of a plurality of dump user identifier corresponding to each node.

[008引业务服务器508还用于读取存储映射表,在存储映射表中查询目标转存节点对应的目标存储节点,该存储映射表中记录有转存节点标识与存储该转存节点对应用户数据的存储节点的标识之间的一一对应关系或多对一对应关系,其中,每个存储节点对应一个或多个转存节点。 [008 cited service server 508 is further configured to store a mapping table reading, querying the target nodes corresponding to the dump destination storage node stores a mapping table, the mapping table storage dump node identifier is recorded and stored in the corresponding user node dump one correspondence between the data storage node identifier or one mapping relationship, wherein each storage node corresponds to one or more dump nodes. 为了提高业务服务器508读取存储映射表的效率,可W将存储映射表缓存在分布式数据库系统500的内存中,业务服务器508直接从分布式数据库系统500的内存中读取存储映射表,不再通过分布式数据库系统500的磁盘读取存储映射表,大大提高了业务服务器508读取存储映射表的效率。 In order to improve the mapping table 508 reads the stored service server efficiency, W may be a mapping table stored in the cache memory 500 in a distributed database system, the service server 508 to read directly from the memory storage mapping table 500 in the distributed database system, is not by then distributed database system reads the disk storage mapping table 500, greatly improving the efficiency of the business server 508 reads the stored mapping table. 具体来说,存储映射表可采用例如但不限于表1结构。 Specifically, the mapping table can be stored, for example, but not limited to a structure of the table.

[0089] 业务服务器508还用于将数据存储请求携带的用户数据存储至目标存储节点中对应目标用户标识的存储位置。 [0089] The server 508 further service data storage request for storing user data carried in the target storage node to a storage location corresponding to the target user ID. 具体的,业务服务器508通过上述映射算法和存储映射表查询到目标用户标识对应的目标存储节点后,将数据存储请求中携带的用户数据存储至目标存储节点中对应目标用户标识的存储位置,例如,若业务服务器508查询到目标存储节点为存储节点502,且具体为存储节点502中的数据表1,且数据存储请求中携带的用户数据为用户1的身高"180cm",则业务服务器508将用户数据"180cm"存储到存储节点502中的数据表1 中。 Specifically, after the service server 508 a query to the target user ID corresponding to the target storage node via the mapping algorithm and storing a mapping table, the data storage request carries user data storage to the target storage node corresponding to the storage location of the target user ID, e.g. when the service server 508 a query to the target storage node to storage node 502, and specifically the storage node 502 in the data in table 1, the user data and the data stored carried in the request for the height of the user 1 "180cm", the service server 508 user data "180cm" stored in the storage node 502 in a data table.

[0090] 需要说明的是,本发明实施例描述的为数据存储时的应用场景,用户通过业务服务器508从存储节点中读取用户数据时,业务服务器508根据用户标识查询用户标识对应的存储节点的执行操作同上,此处不再寶述。 [0090] Incidentally, embodiments described embodiment of the present invention is applied when a scene data storage, when the user reads the user data from the storage node 508 by the service server, the service server 508 queries the user identifier corresponding to the storage node according to the user identifier operation is performed as above, here is no longer Bao said.

[0091] 可见,在图5所描述的分布式数据库系统中,业务服务器接收数据存储请求,将数据存储请求中携带的目标用户标识按照预设的映射算法进行运算,并根据运算结果查询目标用户标识对应的目标转存节点,并在存储映射表中查询目标转存节点对应的目标存储节点,进而将数据存储请求中携带的用户数据存储至目标存储节点中对应目标用户标识的存储位置。 [0091] visible, in distributed database system described in FIG. 5, the service server receives a data storage request, the data storage request carries user identifier calculates a target according to a preset mapping algorithm and queries the target user based on the calculation result dump identifier corresponding target node, the target node and the query dump destination storage node corresponding to the mapping table in the memory, and further to store the data carried in the request to the target user data is stored in the corresponding memory location of the storage node identified by the target user. 因此在业务服务器将大量用户数据按照分布式数据存储方式存储到多个存储节点时,可W避免映射表中用户标识与存储节点的对应关系过多,提高业务服务器在映射表中查询目标用户所对应的目标存储节点的效率,从而提高用户数据的存储效率。 Thus a large amount of the service server to the user data stored in a plurality of storage nodes in a distributed data storage, W can avoid excessive correspondence relationship between the user identifier and the mapping table in the storage node, the target to improve the service server queries the user in the mapping table efficiency storage node corresponding to the target, thereby improving the efficiency of user data is stored.

[0092] 请参见图6,图6是本发明实施例提供的另一种分布式数据库系统的结构示意图。 [0092] Referring to FIG. 6, FIG. 6 is a schematic structural diagram of another distributed database system according to an embodiment of the present invention. 如图6所示,分布式数据库系统500包括多个存储节点502-506、业务服务器508和待迁移存储节点512,其中,存储节点502-506和待迁移存储节点512与业务服务器508之间可通过总线或者其它方式连接,其中,图5中W通过总线510连接为例。 6, a distributed database system 500 includes a plurality of storage nodes 502-506, the service server 508 and storage node 512 to be migrated, which may be between the storage nodes 502-506, and a storage node 512 to be migrated with the service server 508 or otherwise connected by a bus, wherein W in FIG. 5 Example 510 connected by a bus. 存储节点502-506和业务服务器508的结构和功能可参见图5所示实施例中存储节点502-506和业务服务器508的相关描述,此处不再寶述。 Storage node structure and function of the service server 508 and 502-506, see example storage node 502-506 and related service server 508 described in FIG. 5, not described herein Po. 其中,业务服务器508还用于在存储节点502-506过负荷时,将存储节点502-506中的部分用户数据迁移到待迁移存储节点512中,待迁移存储节点512用于对从存储节点502-506中迁移出的用户数据进行存储。 Wherein, the service server 508 when the storage node is further configured to 502-506 overload, the part of the user to migrate data storage node 502-506 is to be migrated to the storage node 512, storage node 512 to be migrated from the storage node 502 for -506 migrating the user data is stored.

[0093] 业务服务器508还用于根据目标存储节点中存储的用户数据判断目标存储节点是否过负荷,若判断出目标存储节点过负荷,则业务服务器508从目标存储节点所存储的多个转存节点对应的用户数据中选择部分转存节点对应的用户数据作为待迁移用户数据,并从尚未过负荷的存储节点中选择至少一个存储节点作为待迁移存储节点512,或从新增的存储节点中选择至少一个存储节点作为待迁移存储节点512,其中,待迁移存储节点512的剩余总存储容量大于待迁移用户数据的数据量;业务服务器508将待迁移用户数据迁移到待迁移存储节点512中,并更新存储映射表。 [0093] The service server 508 further determines a plurality of dump destination storage node according to the user data stored in the target storage node overload, if it is determined that the target storage node overload, the service server 508 stores the target storage node dump selecting section corresponding to the node corresponding to the node of the user data as the user data in the user data to be migrated and select at least one storage node from the storage node has not been overloaded as to be migrated in the storage node 512, storage node or added from selecting at least one storage node as to be migrated storage node 512, which, to be migrated storage node remaining total storage capacity 512 is greater than the amount of data to migrate user data; service server 508 to be migrated migrate user data to be migrated storage node 512, and updates the memory map table. 其中,待迁移存储节点512的数量可W为一个,也可W为多个,本发明实施例W待迁移存储节点512为一个为例进行说明。 Wherein the number of storage node 512 to be migrated may be a W, W may be a plurality of, for example, W embodiment of the present invention to be migrated to a storage node 512 as an example.

[0094] 具体的,若业务服务器508判断出目标存储节点过负荷,则需要将目标存储节点中的部分用户数据进行数据迁移,即需要对分布式数据库系统500进行扩容,或对分布式数据库系统500的负载进行均衡,W使目标存储节点中的用户数据不再过负荷,从而影响系统性能。 [0094] Specifically, if the service server 508 determines that the target storage node overload, the target needs to be part of the user data in the data storage node migration, the need for expansion of the distributed database system 500, or distributed database system load 500 will be equalized, W of the user data in the target storage node is no longer overloaded, thus affecting the system performance. 业务服务器508从尚未过负荷的存储节点中选择至少一个存储节点,或从系统新增加的存储节点中选择至少一个,或从尚未过负荷的存储节点W及新增加的存储节点中选择至少一个尚未过负荷的存储节点W及至少一个新增加的存储节点作为待迁移存储节点512,若待迁移存储节点512为一个,则该待迁移存储节点512的剩余总存储容量需大于待迁移用户数据的数据量,若待迁移存储节点512为多个,则多个待迁移存储节点512的剩余总存储容量需大于待迁移用户数据的数据量,例如,若目标存储节点为存储节点502,业务服务器508 从存储节点502中存储的转存节点L1和L3对应的用户数据中选择转存节点L1对应的用户1 和用户12对应的所有用户数据作为待迁移用户数据,用户1和用户12对应的所有用户数据的数据量为50GB(Gigabyte,吉字节),业务服务器508从新增加的存储节点中选 The service server 508 selects from the storage node has not been overloaded in the at least one storage node, or selecting at least one from the newly added storage nodes in the system, or selecting at least one yet from storage node W and the newly added storage node has not been overloaded in overload storage node W and at least one newly added storage node as to be migrated storage node 512, if to be migrated storage node 512 is one, the to be migrated storage node remaining total storage capacity of 512 must be greater than to be migrated user data in the data the amount, if the storage node 512 to be migrated as a plurality, the plurality of the amount of data to be migrated total storage capacity of the remaining storage node 512 must be greater than the user data to be migrated, e.g., if the target storage node to storage node 502, from the service server 508 selecting Move node stored stored in the node 502 L1 and L3 corresponding user data L1 corresponding to the user dump node 1 and the user 12 corresponding to all user data as for migration of user data, user 1 and user 12 corresponding to all user data the amount of data storage node 50GB (Gigabyte, gigabytes), the service server 508 select the new increased 择一个作为待迁移存储节点512,该待迁移存储节点512的存储容量为200GB,可容纳待迁移用户数据。 Optional be migrated as a storage node 512, storage node to be migrated to the storage capacity of 200GB 512, which can accommodate the user data to be migrated. 因此,业务服务器508将待迁移用户数据迁移至待迁移存储节点512上,即实现了多个用户的用户数据的批量迁移,不再针对每一个用户数据进行单独迁移,提高了用户数据的迁移效率。 Thus, the service server 508 to be moved to migrate user data to be migrated on the storage node 512, i.e., a plurality of users to achieve a bulk migration of user data, no separate data migration for each user, improving the efficiency of user data migration . 业务服务器50則尋待迁移用户数据迁移至待迁移存储节点512后,更新存储映射表,将存储映射表中转存节点L1对应存储节点标识修改为512,后续若需对用户1和用户12对应的用户数据进行存取,则需从存储节点512中存取用户1和用户12对应的用户数据。 After the service server 50 to find subscriber data to be migrated for migration Migration to storage node 512, storage mapping table to update the mapping table storage memory node L1 relay node identifier corresponding to modified memory 512, for subsequent For 12 corresponding to user 1 and user access user data, the user is required to access the user data of the user 1 and the corresponding node 512 from the memory 12.

[00M]作为一种可选的实施方式,业务服务器508持续统计目标存储节点在每一时间周期内的用户数据增长速度,在用户数据增长速度超过预设增长速度阔值时判定目标存储节点过负荷。 It determines the target storage node [00M] As an alternative embodiment, the service server 508 stores the target count continued growth node user data in each time period, the growth rate in the user data exceeds a preset value is excessively wide growth load. 其中,该时间周期可根据分布式数据库系统500的具体应用环境进行设置。 Wherein, the time period can be set according to the distributed database system 500 of the specific application environment. 不难理解,周期时长越短,算得的用户数据增长速度越准确。 Understandably, the shorter the time period, the more accurate user data calculated growth rate. 预设增长速度阔值也可根据分布式数据库系统500的具体应用环境进行设置。 Growth preset value can also be set wide distributed database system according to the specific application environment 500.

[0096] 在具体实现过程中,可采用例如但不限于下列公式来计算目标存储节点的用户数据增长速度:用户数据增长速度=(当前周期统计的用户数据的数据量前一周期统计的用户数据的数据量)/周期时长。 [0096] In a specific implementation, may be employed for example but not limited to the following equation to calculate the target user data storage node growth: growth rate of user data = (data amount of the current period statistical user data of the previous cycle statistical user data when the amount of data length) / cycle. 上述周期时长可根据分布式数据库系统500的具体应用环境进行设置。 Length can be set according to the specific application environment distributed database system 500 of the above-described cycle. 用户数据增长速度为正值,表明目标存储节点中用户数据在增长,且值越大表明目标存储节点中用户数据的增长速度越快,为负表明目标存储节点中用户数据在减少。 Positive growth rate of user data, the user indicates that the target data storage node is growing, the growth rate and the higher number indicates a target storage node user data faster, the storage node is negative indicates that the target user data is reduced.

[0097] 作为一种可选的实施方式,业务服务器508统计目标存储节点中存储的用户数据的数量,在目标存储节点中用户数据的数量超过预设容量阔值时判定目标存储节点过负荷。 Determining a target load through the storage node [0097] As an alternative embodiment, the amount of user data traffic statistics server 508 stored in the target storage node, in the target storage node exceeds a preset amount of user data capacity width value. 其中,预设容量阔值可根据目标存储节点的具体存储容量进行设置,例如,若目标存储节点的存储容量为200GB,则将目标存储节点对应的预设容量阔值设置为180GB等。 The preset capacity value width can be set depending on the storage capacity of the target storage node, e.g., if the storage capacity of 200GB to the target storage node, then the node corresponding to the target storage capacity width preset value is set to 180GB like.

[0098] 可见,在图6所描述的分布式数据库系统中,当业务服务器判断出目标存储节点过负荷时,从目标存储节点中存储的多个转存节点对应的用户数据中选择部分转存节点对应的用户数据作为待迁移用户数据,并从尚未过负荷的存储节点中选择至少一个存储节点作为待迁移存储节点,或从新增的存储节点中选择至少一个存储节点作为待迁移存储节点, 进而将待迁移用户数据迁移至待迁移存储节点中,因此可W针对多个用户标识对应的用户数据进行批量迁移,无需针对单独用户的用户数据进行逐次迁移,减少了用户数据迁移的次数和时间,提高了用户数据的迁移效率。 [0098] visible, in distributed database system described in FIG. 6, when the service server determines that the target storage node is overloaded, the plurality of nodes corresponding to dump from the target user data is stored in the storage node selecting section rollover node data corresponding to the user as the user data to be migrated and select at least one storage node from the storage node has not been overloaded as a storage node to be migrated, or selecting at least one additional storage node from a storage node to be migrated as a storage node, Further migrate user data to be migrated to the storage node to be migrated, thus W bulk mobility for a plurality of user identification data corresponding to the user, without the need for individual users sequentially migrate user data, and reducing the number of times the user data migration improve the efficiency of the migration of user data.

[0099] 请参见图7,是本发明提供的另一种终端的结构示意图。 [0099] Referring to FIG. 7, it is a schematic diagram of another configuration of a terminal provided by the present invention. 其中,如图7所示,终端70 可W包括:至少一个处理器701,例如CPU,至少一个总线702,至少一个输入装置703和至少一个输出装置704,存储器705。 Wherein, as shown in Figure 7, terminal 70 may include W: at least one processor 701, a CPU, a bus at least 702, at least one input device 703 and at least one output device 704, a memory 705. 其中,总线702用于实现运些组件之间的通信连接;输入装置703具体可为终端的触控面板,包括触摸屏和触控屏,用于检测终端触控面板上的操作指令;输出装置704可W包括终端的显示屏(Display),用于输出、显示图像或者数据;存储器705可W是高速RAM显示器,也可W是非不稳定的显示器(non-volatile memcxry),例如至少一个磁盘显示器,存储器705可选的还可W是至少一个位于远离前述处理器701的显示装置。 Wherein the bus 702 for achieving a communication connection between the operation of these components; the input device 703 may be a particular terminal, a touch panel includes a touch screen and a touch screen for detecting an operation instruction on the touch panel of the terminal; an output device 704 W terminal may include a display screen (display), an output, or display image data; W is a high-speed memory 705 may display RAM, W may also be a non-volatile display (non-volatile memcxry), for example, display at least one disk, memory 705 may also optionally at least one W is located remote from the processor 701 of the display device. 如图7所示,作为一种计算机显示介质的存储器705中可W包括操作系统、网络通信模块、用户接口模块W及数据存储程序。 As shown in FIG. 7, as a computer memory medium 705 W may include an operating system, network communication module, the user interface module W program and data storage.

[0100] 在图7所示的终端70中,处理器701可W用于运行存储器705中存储的数据存储程序,并执行W下操作: [0100] In the terminal 70 shown in FIG. 7, the processor 701 may be used to store data W program 705 stored in the operating memory, and performs the operation W:

[0101] 通过输入装置703接收数据存储请求,数据存储请求携带目标用户标识和用户数据; [0101] through the input device 703 receives a data storage request, the data storage request carries the user identifier and the target user data;

[0102] 将目标用户标识按照预设的映射算法进行运算,并根据运算结果查询目标用户标识对应的目标转存节点,其中,目标转存节点对应多个用户标识; [0102] calculates the target user ID according to a preset mapping algorithm, query and target identifier corresponding to the target user based on the calculation result dump node, wherein the target nodes corresponding to a plurality of dump user identifier;

[0103] 在存储映射表中查询目标转存节点对应的目标存储节点,存储映射表中记录有转存节点与存储转存节点对应用户数据的存储节点之间的一一对应关系或多对一对应关系; The target storage node [0103] queries a mapping table stored in the node corresponding to the target revolution storage, storage mapping table recorded in the storage node dump dump node corresponds to one correspondence between the user data storage node or many the corresponding relationship;

[0104] 将数据存储请求携带的用户数据存储至目标存储节点中对应目标用户标识的存储位置。 [0104] The data storage request carries the user data stored in a storage location corresponding to the target storage node identified by the target user.

[0105] 进一步地,处理器701执行将数据存储请求携带的用户数据存储至目标存储节点中对应目标用户标识的存储位置之后,还执行: After [0105] Further, the processor 701 executes the storage location of the data storage request carries user data storage to the target storage node corresponding to the target user's identifier, further perform:

[0106] 根据目标存储节点中存储的用户数据判断目标存储节点是否过负荷; [0106] The user data stored in the target storage node determines whether the target storage node overload;

[0107] 若判断出目标存储节点过负荷,则从目标存储节点所存储的多个转存节点对应的用户数据中选择部分转存节点对应的用户数据作为待迁移用户数据,并从尚未过负荷的存储节点中选择至少一个存储节点作为待迁移存储节点,或从新增的存储节点中选择至少一个存储节点作为待迁移存储节点,其中,待迁移存储节点的剩余总存储容量大于待迁移用户数据的数据量; Node selecting portion dump dump nodes corresponding to the plurality of data corresponding to the user [0107] If it is determined that the target storage node overload, the target storage node from the stored user data as the user data to be migrated, and has not been overloaded from storage node selecting at least one storage node to be migrated as a storage node, or select at least one storage node from the new storage node to be migrated as a storage node, wherein the remaining total storage capacity of the storage node to be migrated larger than the user data to be migrated the amount of data;

[0108] 将待迁移用户数据迁移到待迁移存储节点中,并更新存储映射表。 Migration [0108] The user data is to be migrated to the storage node to be migrated, and updates the stored map.

[0109] 更进一步地,处理器701执行根据目标存储节点中存储的用户数据判断目标存储节点是否过负荷,具体为: [0109] Still further, the processor 701 executes the target storage node determines whether the target user data according to the overload storage node is stored, in particular:

[0110] 持续统计目标存储节点在每一时间周期内的用户数据增长速度,在用户数据增长速度超过预设增长速度阔值时判定目标存储节点过负荷;或, Determining a target load through the storage node [0110] Statistics Length user data storage node target growth rate in each time period, the growth rate in the user data exceeds a preset value width growth; or,

[0111] 统计目标存储节点中存储的用户数据的数量,在目标存储节点中用户数据的数量超过预设容量阔值时判定目标存储节点过负荷。 [0111] Statistical amount of user data stored in the target storage node, in the target storage node exceeds a preset amount of user data capacity of the storage node determines a target value width is overloaded.

[0112] 更进一步地,映射算法包括哈希算法。 [0112] Still further, the mapping algorithm comprises a hash algorithm.

[0113] 更进一步地,存储映射表存储在分布式数据库的内存中。 [0113] Still further, the mapping table is stored in memory in the distributed database.

[0114] 可理解的是,处理器701的执行步骤具体可参见图1或图2实施例的内容,此处不再寶述。 [0114] appreciated that the processor performs step 701 may specifically refer to FIG. 1 or FIG. 2 embodiment of the content, not Po described herein.

[0115] 综上所述,终端接收数据存储请求,将数据存储请求中携带的目标用户标识按照预设的映射算法进行运算,并根据运算结果查询目标用户标识对应的目标转存节点,并在存储映射表中查询目标转存节点对应的目标存储节点,进而将数据存储请求中携带的用户数据存储至目标存储节点中对应目标用户标识的存储位置。 [0115] In summary, the terminal receives a data storage request, the data storage request carries user identifier calculates a target according to a preset mapping algorithm, query and dump target node identifier corresponding to the target user based on the calculation result, and storing the mapping table query dump destination storage node corresponding to the node of the target, and then stores the data request carries user data stored in the target storage node to a storage location corresponding to the target user ID. 因此在终端将大量用户数据按照分布式数据存储方式存储到多个存储节点时,可w避免映射表中用户标识与存储节点的对应关系过多,提高终端在映射表中查询目标用户所对应的目标存储节点的效率,从而提高用户数据的存储效率。 Therefore, when a large amount of user data stored in the terminal to the plurality of storage nodes in a distributed data storage, can avoid excessive w corresponding relationship mapping table and the user identifier of the storage node, to improve the terminal queries the user in the mapping table corresponding to the target efficiency of the target storage node, thereby improving the efficiency of user data is stored.

[0116] 进一步地,当终端判断出目标存储节点过负荷时,从目标存储节点中存储的多个转存节点对应的用户数据中选择部分转存节点对应的用户数据作为待迁移用户数据,并从尚未过负荷的存储节点中选择至少一个存储节点作为待迁移存储节点,或从新增的存储节点中选择至少一个存储节点作为待迁移存储节点,进而将待迁移用户数据迁移至待迁移存储节点中,因此可W针对多个用户标识对应的用户数据进行批量迁移,无需针对单独用户的用户数据进行逐次迁移,减少了用户数据迁移的次数和时间,提高了用户数据的迁移效率。 [0116] Further, when the terminal determines that the user data is overloaded, the target storage node from a corresponding plurality of dump destination storage node of the storage nodes in the storage node corresponding to the selected portion of transfer user data as the user data to be migrated, and selecting at least one storage node from the storage node has not been overloaded as a storage node to be migrated, or selecting at least one additional storage node from a storage node to be migrated as a storage node, and thus migrate user data to be migrated to the storage node to be migrated , so W can migrate batch identifier for the user data corresponding to a plurality of users, without the need for individual users sequentially migrate user data, and reducing the number of times the user data migration, migration to improve efficiency of user data.

[0117] 本领域普通技术人员可W理解实现上述实施例方法中的全部或部分流程,是可W 通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。 [0117] Those of ordinary skill in the art can understand that the above embodiments W method all or part of the process, W is instructing relevant hardware through a computer program, the program may be stored in a computer readable storage medium, when the program is executed, the processes of the foregoing method embodiments. 其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memoir,ROM)或随机存储记忆体(Random Access Memory,RAM)等。 Wherein the storage medium may be a magnetic disk, an optical disk, read-only memory (Read-Only Memoir, ROM) or a random access memory (Random Access Memory, RAM) and the like.

[0118] 本发明实施例方法中的步骤可W根据实际需要进行顺序调整、合并和删减。 [0118] The procedure of Example embodiment of the method of the present invention W may be adjusted according to actual needs sequence, deletion and merger.

[0119] 本发明实施例终端中的单元可W根据实际需要进行合并、划分和删减。 [0119] Example embodiment of the terminal unit of the present invention may be combined according to need W, division and deletion.

[0120] W上所掲露的仅为本发明一种较佳实施例而已,当然不能W此来限定本发明之权利范围,本领域普通技术人员可W理解实现上述实施例的全部或部分流程,并依本发明权利要求所作的等同变化,仍属于发明所涵盖的范围。 [0120] W on the exposed kei be only one preferred embodiments of the present invention, but not to limit the scope of this W of the present invention, those of ordinary skill in the art can understand that the above embodiments W all or part of the equivalent variations, claims, and shall be made to the invention as claimed, is still covered by the scope of the invention.

Claims (10)

1. 一种数据存储方法,其特征在于,所述方法包括: 接收数据存储请求,所述数据存储请求携带目标用户标识和用户数据; 将所述目标用户标识按照预设的映射算法进行运算,并根据运算结果查询所述目标用户标识对应的目标转存节点,其中,所述目标转存节点对应多个用户标识; 在存储映射表中查询所述目标转存节点对应的目标存储节点,所述存储映射表中记录有转存节点与存储所述转存节点对应用户数据的存储节点之间的一一对应关系或多对一对应关系; 将所述数据存储请求携带的所述用户数据存储至所述目标存储节点中对应所述目标用户标识的存储位置。 1. A data storage method, wherein the method comprises: receiving a request for storing data, said data storage request carries the user identifier and the target user data; calculates the target user identifier according to a preset mapping algorithm, and based on the calculation result of the target dump node query identifier corresponding to the target user, wherein the target nodes corresponding to a plurality of dump user identifier; mapping table stored in the target storage node to query the target nodes corresponding to rollover, the said storage mapping table is recorded dump dump node corresponding to the node storing the correspondence relationship between the user data storage node or one mapping relation; storing the data request carries the user data stored to the target storage node of the storage location corresponding to the target user ID.
2. 根据权利要求1所述的方法,其特征在于,所述将所述数据存储请求携带的所述用户数据存储至所述目标存储节点中对应所述目标用户标识的存储位置之后,还包括: 根据所述目标存储节点中存储的用户数据判断所述目标存储节点是否过负荷; 若判断出所述目标存储节点过负荷,则从所述目标存储节点所存储的多个转存节点对应的用户数据中选择部分转存节点对应的用户数据作为待迀移用户数据,并从尚未过负荷的存储节点中选择至少一个存储节点作为待迀移存储节点,或从新增的存储节点中选择至少一个存储节点作为所述待迀移存储节点,其中,所述待迀移存储节点的剩余总存储容量大于所述待迀移用户数据的数据量; 将所述待迀移用户数据迀移到所述待迀移存储节点中,并更新所述存储映射表。 The method according to claim 1, wherein said corresponding storage location of the target user identification data stored in the request carries the user data storage to the target storage node, the method further comprising : the user data stored in the target storage node determines whether the target storage node overload; if it is determined that the target storage node overload, from the plurality of nodes dump destination storage node corresponding to the stored dump node selecting section corresponding to user data as the user data to be Gan shifting user data, and select at least one storage node from the storage node has not been overloaded as to be Gan shift storage node, or select at least from the new storage node as a storage node of the storage node to be shifted Gan, wherein the remaining to be shifted Gan total storage capacity greater than the storage node to be Gan shift amount of user data; the user data to be Gan Gan move the shift Gan be said shift storage node, and updates the memory map.
3. 根据权利要求2所述的方法,其特征在于,所述根据所述目标存储节点中存储的用户数据判断所述目标存储节点是否过负荷,包括: 持续统计所述目标存储节点在每一时间周期内的用户数据增长速度,在所述用户数据增长速度超过预设增长速度阈值时判定所述目标存储节点过负荷;或, 统计所述目标存储节点中存储的用户数据的数量,在所述目标存储节点中用户数据的数量超过预设容量阈值时判定所述目标存储节点过负荷。 3. The method according to claim 2, characterized in that the subscriber data whether the overload of the target storage node determines the target storage node is stored, comprising: the target duration statistics stored in each node determining the growth rate of the user data within the time period, the growth rate in the user data exceeds a preset threshold value the growth rate of the target storage node overload; or, the statistical amount of user data stored in the target storage node, in the It determines the target storage node overloaded when the number of the target storage node of said user data exceeds a predetermined size threshold.
4. 根据权利要求1-3任一项所述的方法,其特征在于,所述映射算法包括哈希算法。 4. The method according to any one of claims 1-3, wherein said mapping algorithm comprises a hash algorithm.
5. 根据权利要求1-3任一项所述的方法,其特征在于,所述存储映射表存储在所述分布式数据库的内存中。 5. The method of any one of claims 1-3, wherein said mapping table stored in memory in the distributed database.
6. -种终端,其特征在于,所述终端包括: 接收单元,用于接收数据存储请求,所述数据存储请求携带目标用户标识和用户数据; 第一查询单元,用于将所述目标用户标识按照预设的映射算法进行运算,并根据运算结果查询所述目标用户标识对应的目标转存节点,其中,所述目标转存节点对应多个用户标识; 第二查询单元,用于在存储映射表中查询所述目标转存节点对应的目标存储节点,所述存储映射表中记录有转存节点与存储所述转存节点对应用户数据的存储节点之间的一一对应关系或多对一对应关系; 存储单元,用于将所述数据存储请求携带的所述用户数据存储至所述目标存储节点中对应所述目标用户标识的存储位置。 6. - type of terminal, wherein the terminal comprises: receiving means for receiving a request for storing data, said data storage request carries the user identifier and the target user data; a first query unit for the target user identification calculates according to a preset mapping algorithm, and the target node based on the calculation result dump querying the user identifier corresponding to the target, wherein the target nodes corresponding to a plurality of dump user identifier; a second inquiry means for storing querying the mapping table corresponding to the target node dump destination storage node, the storage mapping table is recorded dump dump node corresponding to the node storing the correspondence relationship between the storage node to one or more user data a correspondence relationship; a storage unit corresponding to the target user for identification of said data storage request carries the user data stored in the target storage node of the storage location.
7. 根据权利要求6所述的终端,其特征在于,所述终端还包括: 判断单元,用于根据所述目标存储节点中存储的用户数据判断所述目标存储节点是否过负荷; 选择单元,用于若所述判断单元判断出所述目标存储节点过负荷,则从所述目标存储节点所存储的多个转存节点对应的用户数据中选择部分转存节点对应的用户数据作为待迀移用户数据,并从尚未过负荷的存储节点中选择至少一个存储节点作为待迀移存储节点,或从新增的存储节点中选择至少一个存储节点作为所述待迀移存储节点,其中,所述待迀移存储节点的剩余总存储容量大于所述待迀移用户数据的数据量; 迀移单元,用于将所述待迀移用户数据迀移到所述待迀移存储节点中,并更新所述存储映射表。 The terminal according to claim 6, characterized in that the terminal further comprises: determination means for determining whether user data judging the overload according to the target storage node is stored in the target storage node; selecting means, for if the determining unit determines the target storage node overload, the user data from the plurality of nodes dump destination storage node corresponding to the stored selected portion of the user data corresponding to a dump node to be shifted Gan user data, and select from the storage node has not been overloaded at least one storage node as a storage node to be Gan shift, or selecting at least one additional storage node from a storage node to be Gan as the shift storage node, wherein said Gan shift storage node to be remaining to be greater than the total storage capacity Gan shift amount of user data; Gan shifting means for shifting the user data to be Gan Gan Gan to be shifted onto said storage node, and updates the storage mapping table.
8. 根据权利要求7所述的终端,其特征在于,所述判断单元具体用于: 持续统计所述目标存储节点在每一时间周期内的用户数据增长速度,在所述用户数据增长速度超过预设增长速度阈值时判定所述目标存储节点过负荷;或, 统计所述目标存储节点中存储的用户数据的数量,在所述目标存储节点中用户数据的数量超过预设容量阈值时判定所述目标存储节点过负荷。 8. The terminal according to claim 7, wherein the determination unit is configured to: a user data rate of sustained growth of the target storage node statistics in each time period, the growth rate of the user data exceeds or when it is determined that the number of users of the statistical data stored in the target storage node, in the target storage node exceeds a preset amount of user data capacity threshold; determines the target storage node overload preset growth threshold said target storage node overload.
9. 根据权利要求6-8任一项所述的终端,其特征在于,所述映射算法包括哈希算法。 9. The terminal according to any one of claims 6-8, wherein said mapping algorithm comprises a hash algorithm.
10. 根据权利要求6-8任一项所述的终端,其特征在于,所述存储映射表存储在所述分布式数据库的内存中。 10. A terminal according to any one of claims 6-8, wherein said mapping table stored in memory in the distributed database.
CN201510998390.0A 2015-12-26 2015-12-26 Data storage method and terminal CN105491149A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510998390.0A CN105491149A (en) 2015-12-26 2015-12-26 Data storage method and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510998390.0A CN105491149A (en) 2015-12-26 2015-12-26 Data storage method and terminal

Publications (1)

Publication Number Publication Date
CN105491149A true CN105491149A (en) 2016-04-13

Family

ID=55677859

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510998390.0A CN105491149A (en) 2015-12-26 2015-12-26 Data storage method and terminal

Country Status (1)

Country Link
CN (1) CN105491149A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107241387A (en) * 2017-05-12 2017-10-10 腾讯科技(深圳)有限公司 Data request processing method, device and system
CN108062350A (en) * 2017-11-08 2018-05-22 深圳市金立通信设备有限公司 Data processing method, node equipment and computer readable medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101505472A (en) * 2008-02-05 2009-08-12 华为技术有限公司 User data server system and apparatus
CN102129442A (en) * 2010-09-20 2011-07-20 华为技术有限公司 Distributed database system and data accessing method
CN102647335A (en) * 2011-02-22 2012-08-22 中国移动通信集团公司 Data routing method, device and system
US20140304242A1 (en) * 2009-09-18 2014-10-09 Hitachi, Ltd. Storage system for eliminating duplicated data

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101505472A (en) * 2008-02-05 2009-08-12 华为技术有限公司 User data server system and apparatus
US20140304242A1 (en) * 2009-09-18 2014-10-09 Hitachi, Ltd. Storage system for eliminating duplicated data
CN102129442A (en) * 2010-09-20 2011-07-20 华为技术有限公司 Distributed database system and data accessing method
CN102647335A (en) * 2011-02-22 2012-08-22 中国移动通信集团公司 Data routing method, device and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107241387A (en) * 2017-05-12 2017-10-10 腾讯科技(深圳)有限公司 Data request processing method, device and system
CN108062350A (en) * 2017-11-08 2018-05-22 深圳市金立通信设备有限公司 Data processing method, node equipment and computer readable medium

Similar Documents

Publication Publication Date Title
US8285690B2 (en) Storage system for eliminating duplicated data
US8996611B2 (en) Parallel serialization of request processing
EP2501108B1 (en) Massively scalable object storage system
CN104603739B (en) Block-level access to the parallel storage
US20110138384A1 (en) Dynamically provisioning virtual machines
US8510275B2 (en) File aware block level deduplication
US8311032B2 (en) Dynamically provisioning virtual machines
US8751763B1 (en) Low-overhead deduplication within a block-based data storage
US20100199065A1 (en) Methods and apparatus for performing efficient data deduplication by metadata grouping
US20150039645A1 (en) High-Performance Distributed Data Storage System with Implicit Content Routing and Data Deduplication
CN102055650B (en) Load balance method and system and management server
CN102332029A (en) Hadoop-based mass classifiable small file association storage method
CN101013387A (en) Load balancing method based on object storage device
WO2013178155A1 (en) Storage method and apparatus for distributed file system
CN102968498B (en) Data processing method and apparatus
CN103226561B (en) Sibling group based on the contents of addressable storage
US20120084527A1 (en) Data block migration
US9052938B1 (en) Correlation and associated display of virtual machine data and storage performance data
US8738861B2 (en) Data prefetching method for distributed hash table DHT storage system, node, and system
US10127233B2 (en) Data processing method and device in distributed file storage system
US20100138540A1 (en) Method of managing organization of a computer system, computer system, and program for managing organization
CN103020315A (en) Method for storing mass of small files on basis of master-slave distributed file system
US20130332608A1 (en) Load balancing for distributed key-value store
EP2858329B1 (en) Method and device for generating a flow table entry forwarding rule
US9971823B2 (en) Dynamic replica failure detection and healing

Legal Events

Date Code Title Description
C06 Publication
C10 Entry into substantive examination