CN110830539B - Network storage system and method - Google Patents

Network storage system and method Download PDF

Info

Publication number
CN110830539B
CN110830539B CN201810919502.2A CN201810919502A CN110830539B CN 110830539 B CN110830539 B CN 110830539B CN 201810919502 A CN201810919502 A CN 201810919502A CN 110830539 B CN110830539 B CN 110830539B
Authority
CN
China
Prior art keywords
mpt
data
node
nodes
network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810919502.2A
Other languages
Chinese (zh)
Other versions
CN110830539A (en
Inventor
林益帆
苗辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guizhou Baishancloud Technology Co Ltd
Original Assignee
Guizhou Baishancloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guizhou Baishancloud Technology Co Ltd filed Critical Guizhou Baishancloud Technology Co Ltd
Priority to CN201810919502.2A priority Critical patent/CN110830539B/en
Publication of CN110830539A publication Critical patent/CN110830539A/en
Application granted granted Critical
Publication of CN110830539B publication Critical patent/CN110830539B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a network storage system and a network storage method. The disclosed system includes a central server and a client server for consistent storage, wherein: the central server is used for storing full network data, receiving and executing a first data access operation instruction for operating the network data by a user, issuing a client server management operation instruction for managing the client server, and receiving and executing a link maintenance operation instruction for maintaining a communication link between the central server and the client server; the client server is used for automatically checking whether the full network data is updated and consistently stores the copy of the full network data, receiving and executing a central server management operation instruction, and receiving and executing a second data access operation instruction which is inquired by a user on the copy of the network data. The technical scheme disclosed has the advantages of less bandwidth usage and good performance, does not bring too much pressure to the central machine, and can support servers of tens of thousands to hundreds of thousands.

Description

Network storage system and method
Technical Field
The invention relates to the field of computer networks and distributed storage, in particular to a network storage system and a network storage method.
Background
In a cluster of servers (e.g., cloud servers, CDN servers) for providing a specific form of network service, such as on-demand computing, content caching, etc., in order for each server node providing the same service to provide the same service data to different users, data (including user data, software configuration data, environment variable data, etc.) needs to be stored in a consistent manner (i.e., synchronously stored) on each different server node to ensure that the entire cluster provides the same service to different users. In addition, even if the data in the cluster is never updated, when a certain server in the cluster comes online again after going down or reinstalling the operating system, the data needs to be consistent with the data of other servers on the online.
The prior art generally adopts the technical scheme shown in fig. 1 to ensure consistency among data on different server nodes.
As shown in fig. 1, the ZooKeeper Server (Server) installed with ZooKeeper distributed service software (software such as etcd and consul may be used instead of the ZooKeeper, which is not shown in fig. 1) is a central Server in the Server cluster, and for example, an administrator (centralized Configuration) may modify the Configuration directory (/ Configuration) and various (Configuration) Data (Configuration Data) contained in the Configuration directory through a (centralized Configuration management) Web terminal. For example, a plurality of Client servers (clients) in a server cluster may then listen for (Watch) updates of (configuration) data, and when listening for (configuration) data updates, read the updated (configuration) data through an interface developed in a language such as C + +, Java, etc. for reading (configuration) data.
The prior art solution shown in fig. 1 has the following disadvantages:
1) in the case of a small number of servers in a cluster (e.g., hundreds to thousands), these pieces of software can basically satisfy the requirement of data consistency management on the servers. However, when the number of servers reaches tens of thousands or even hundreds of thousands, since all the client servers in the cluster have to monitor the data updates of the central server and obtain the updated data from the central server, the bandwidth of the central server determines that the updated data cannot be transmitted to all the client servers in real time or with low delay.
2) Since the cloud servers and the CDN servers are distributed around the world and belong to tens or even hundreds of different operators, the network environment is very complex, and many customer cloud servers and customer CDN servers cannot be connected to the central cloud server and the central CDN server to perform low-latency data update operations. In addition, due to network problems such as network jitter, there may be a phenomenon that data updated by the client server and original updated data of the central server are inconsistent due to lost data or received error data.
3) Since the client servers are autonomously monitored, if the update feedback is not performed, the central server cannot determine whether a client server in the cluster has correctly completed the corresponding data update operation after the data is modified. In addition, even if update feedback is performed, similar to the above-described drawback of item 2), network problems such as network jitter may cause (feedback) data errors, resulting in unexpected operation.
In order to solve the above problems, a new technical solution needs to be proposed.
Disclosure of Invention
The network storage system according to the present invention comprises a central server and a client server for performing coherent storage, wherein:
the central server is used for storing full network data, receiving and executing a first data access operation instruction for a user to operate the network data, issuing a client server management operation instruction for managing the client server, and receiving and executing a link maintenance operation instruction for maintaining a communication link between the central server and the client server;
the client server is used for automatically checking whether the full amount of network data is updated and consistently stores the copy of the full amount of network data, receiving and executing a central server management operation instruction, and receiving and executing a second data access operation instruction queried by a user for the copy of the network data.
The network storage system according to the present invention, wherein:
and setting the central server as a DCMST root node in a degree-constrained minimum spanning tree DCMST algorithm, and constructing a data transmission path between the central server and the client server based on the degree-constrained minimum spanning tree DCMST algorithm.
According to the network storage system, the automatic check of the whole network data whether to be updated or not through the client server is realized through the following steps:
automatically checking whether the check value of the copy of the full amount of network data is consistent with the check value of the full amount of network data through the client server, if the check values are consistent, indicating that the copy of the full amount of network data stored by the client server is consistent with the full amount of network data without updating the copy of the full amount of network data,
wherein the check value comprises a hash value.
According to the network storage system, the total amount of network data adopts a key-value storage structure, the data structures of MPT nodes corresponding to the key-value data storage nodes of a central server and a client server are defined based on an Ethenhouse Mercker compressed prefix tree (MPT), the data structures of the MPT nodes comprise a first variable for storing MPT node index values and a second variable for storing check values, each of the central server and the client server corresponds to one example of the Ethenhouse Mercker compressed prefix tree MPT, the check values of two MPT nodes corresponding to one of the two examples of the Ethenhouse Mercker compressed prefix tree MPT are compared layer by layer from an MPT root node to an MPT leaf node from left to right, and when the check values of the two MPT nodes are consistent, the network data in the two corresponding key-value data storage nodes of the two servers corresponding to the two MPT nodes are consistent, there is no need to compare the check values of the sub-MPT nodes at each level of the two MPT nodes.
According to the network storage system of the present invention, the client server is further configured to perform the following operations:
network data change callback operation;
carrying out timing heartbeat keep-alive operation with a central server;
after re-establishing the connection with the central server, the cluster in which the central server is located is automatically re-registered.
According to the network storage system of the present invention, the data structure of the MPT node thereof includes: an MPT branch node data structure, an MPT extended node data structure, an MPT leaf node data structure,
wherein the MPT branch node data structure further comprises a third variable for storing pointers to a plurality of child nodes, a fourth variable for storing a pointer to a leaf child node or a null pointer,
the MPT extension node data structure further includes a fifth variable for storing a pointer to a child node, a fourth variable for storing a pointer to a leaf child node or a null pointer,
wherein the network data is stored in a key-value form, and the index value is a compressed key value.
The network storage method comprises the following steps:
the method comprises the steps that a central server stores full network data, receives and executes a first data access operation instruction of a user for operating the network data, issues a client server management operation instruction for managing a client server, and receives and executes a link maintenance operation instruction for maintaining a communication link between the central server and the client server;
the client server automatically checks whether the full amount of network data is updated and consistently stores the copy of the full amount of network data, receives and executes a central server management operation instruction, and receives and executes a second data access operation instruction which is inquired by a user on the copy of the network data.
The network storage method according to the present invention further comprises:
and setting the central server as a DCMST root node in a degree-constrained minimum spanning tree DCMST algorithm, and constructing a data transmission path between the central server and the client server based on the degree-constrained minimum spanning tree DCMST algorithm.
According to the network storage method, the automatic check of the whole network data whether to be updated or not through the client server is realized through the following steps:
the client server automatically checks whether the check value of the copy of the full amount of network data is consistent with the check value of the full amount of network data, if the check values are consistent, the fact that the copy of the full amount of network data stored by the client server is consistent with the full amount of network data is indicated, the copy of the full amount of network data does not need to be updated,
wherein the check value comprises a hash value.
According to the network storage method, the total amount of network data adopts a key-value storage structure, the data structures of MPT nodes corresponding to the key-value data storage nodes of a central server and a client server are defined based on the Ethernet Mercker compressed prefix tree MPT, the data structures of the MPT nodes comprise a first variable for storing MPT node index values and a second variable for storing check values, each server of the central server and the client server corresponds to one example of the Ethernet Mercker compressed prefix tree MPT, the check values of two MPT nodes corresponding to one of the two examples of the Ethernet Mercker compressed prefix tree MPT are compared layer by layer from an MPT root node to an MPT leaf node from left to right, and when the check values of the two MPT nodes are consistent, the network data in the two corresponding key-value data storage nodes of the two servers corresponding to the two MPT nodes are consistent, there is no need to compare the check values of the sub-MPT nodes at each level of the two MPT nodes.
The network storage method according to the present invention further comprises:
the client server executes the callback operation of the network data change;
the client server and the central server carry out timing heartbeat keep-alive operation;
after the client server reestablishes the connection with the central server, the client server automatically re-registers to the cluster where the central server is located.
According to the network storage method of the present invention, the data structure of the MPT node includes: an MPT branch node data structure, an MPT extended node data structure, an MPT leaf node data structure,
wherein the MPT branch node data structure further comprises a third variable for storing pointers to a plurality of child nodes, a fourth variable for storing a pointer to a leaf child node or a null pointer,
the MPT extended node data structure further includes a fifth variable for storing a pointer to a child node, a fourth variable for storing a pointer to a leaf child node or a null pointer,
wherein the network data is stored in a key-value form, and the index value is a compressed key value.
According to the technical scheme of the invention, the use bandwidth is small, the performance is good, too much pressure can not be brought to the central machine, and servers of tens of thousands to hundreds of thousands can be supported.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the invention and together with the description, serve to explain the principles of the invention. In the drawings, like reference numerals are used to indicate like elements. The drawings in the following description are directed to some, but not all embodiments of the invention. For a person skilled in the art, other figures can be derived from these figures without inventive effort.
Fig. 1 illustrates a prior art solution for ensuring consistency between data on different server nodes.
Fig. 2 schematically shows a schematic view of a network storage system according to the present invention.
Fig. 3 shows schematically a flow chart of a network storage method according to the invention.
Fig. 4 shows a schematic diagram of a DCMST communication routing path constructed from communication routing paths in an existing network topology.
Fig. 5 exemplarily shows a schematic diagram of data structures of 3 different MPT nodes that can be used according to the above technical scheme of the present invention.
Fig. 6 exemplarily shows a diagram for a lookup operation for an MPT tree using the MPT nodes shown in fig. 5.
Fig. 7 exemplarily shows a schematic diagram for an insertion or update operation for an MPT tree using the MPT nodes shown in fig. 5.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
Fig. 2 schematically shows a schematic view of a network storage system according to the present invention.
As shown in fig. 2, the network storage system according to the present invention includes a central server (i.e., the center in fig. 2) and a client server (i.e., the client in fig. 2) for performing coherent storage, wherein:
the central server is used for storing the full amount of network data, receiving and executing a first data access operation instruction of a user for performing (for example, adding, deleting, modifying and checking and the like) operation on the network data (for example, adding, deleting, modifying k (key) v (value) data in fig. 2), issuing a client server management operation instruction for managing the client server, and receiving and executing a link maintenance operation instruction for maintaining a communication link between the central server and the client server;
the client server is used for automatically checking whether the full amount of network data is updated (for example, the operation shown by diff in fig. 2) and consistently storing the copy of the full amount of network data (for example, the operation shown by mpt in fig. 2), receiving and executing a central server management operation instruction, and receiving and executing a second data access operation instruction queried by a user for the copy of the network data.
Alternatively, the central server may be set as a degree-constrained minimum spanning tree (DCMST) root node in a DCMST algorithm, and a data transmission path between the central server and the client server (i.e., a network connectivity structure represented by a minimum spanning tree structure with the center as a root node in fig. 2) may be constructed based on the degree-constrained minimum spanning tree (DCMST) algorithm.
Optionally, automatically checking via the client server whether the full amount of network data is updated is achieved by:
automatically checking, via the client server, whether a check value of the copy of the full amount of network data (e.g., the roothash in fig. 2, the client also saved a corresponding roothash value, not shown in fig. 2) is consistent with the check value of the full amount of network data, the consistency of the check values indicating that the copy of the full amount of network data stored by the client server is consistent with the full amount of network data without updating the copy of the full amount of network data,
wherein the check value includes a hash value (i.e., the roothash value in fig. 2).
Optionally, the total amount of network data adopts a key-value storage structure, the data structures of MPT nodes corresponding to the key-value data storage nodes of the central server and the client servers are defined based on an etherhouse merkel compressed prefix tree (MPT) (i.e., MPT shown in fig. 2), the data structures of the MPT nodes include a first variable for storing an index value of the MPT nodes, a second variable for storing a check value, each of the central server and the client servers corresponds to one instance of the etherhouse merkel compressed prefix tree (MPT), the check values of two corresponding one-to-one MPT nodes of the two instances of the etherhouse merkel compressed prefix tree (MPT) are sequentially compared layer by layer from an MPT root node to an MPT leaf node from left to right, when the check values of the two MPT nodes are consistent, it is indicated that the network data in the two corresponding key-value data storage nodes of the two servers corresponding to the two MPT nodes are consistent, there is no need to compare the check values of the sub-MPT nodes at each level of the two MPT nodes.
Optionally, the client server is further configured to:
network data change callback operation;
carrying out timed heartbeat keep-alive operation with a central server;
after re-establishing the connection with the central server, automatically re-registering to the cluster where the central server is located.
The network data change callback operation is a preset operation that needs to be executed when a data change (i.e., inconsistency) is detected. For example, a group (one or more keys) can be used as the value of the configuration item of the configuration of nginx (certain software), the operation to be executed after the change of the keys is preset, the nginx configuration is generated by the keys and the value, and then the nginx is informed to load the configuration.
Alternatively, the client (i.e., client server) may preset a plurality of such operations, each listening for a modification of the corresponding key, and when a key is modified, invoking the corresponding action.
For example, the client may disconnect from the original connection due to a change in network status. Therefore, a timed heartbeat keep-alive operation is required between the client server and the central server. For example, when the client finds that the heartbeat data cannot be sent to the cluster (i.e., cannot be sent to the central server), the client reestablishes the connection, finds other clients in the cluster that can be connected to the client, rejoins the cluster, and notifies the central server to update the data transmission path (i.e., update the DCMST), thereby implementing the timed heartbeat keep-alive operation.
That is, the data transmission path is a DCMST generated by connectivity and communication delay between cluster nodes, and the DCMST includes all nodes and necessary data transmission paths. Unless the network between two cluster nodes is disconnected (namely, at least one node is an island), the network between the two cluster nodes must be waited for to be recovered to normal, otherwise, the regular updating operation of the DCMST reaches each cluster node through the transmission path, thereby ensuring that the cluster nodes and the original transmission path are disconnected and automatically reconnected, and ensuring the effectiveness of the transmission path.
Optionally, the data structure of the MPT node includes: an MPT branch node data structure, an MPT extended node data structure, an MPT leaf node data structure,
wherein the MPT branch node data structure further comprises a third variable for storing pointers to a plurality of child nodes, a fourth variable for storing a pointer to a leaf child node or a null pointer,
the MPT extension node data structure further includes a fifth variable for storing a pointer to a child node, a fourth variable for storing a pointer to a leaf child node or a null pointer,
wherein the network data is stored in a key-value form, and the index value is a compressed key value.
Fig. 3 shows schematically a flow chart of a network storage method according to the invention.
As shown in the solid line box of fig. 3, the network storage method according to the present invention includes:
step S302: the method comprises the steps that a central server stores full network data, receives and executes a first data access operation instruction of a user for operating the network data, issues a client server management operation instruction for managing a client server, and receives and executes a link maintenance operation instruction for maintaining a communication link between the central server and the client server;
step S304: the client server automatically checks whether the full amount of network data is updated and consistently stores the copy of the full amount of network data, receives and executes a central server management operation instruction, and receives and executes a second data access operation instruction which is inquired by a user on the copy of the network data.
Optionally, as shown in a dashed box of fig. 3, the network storage method according to the present invention further includes:
step S306: the central server is set as a DCMST root node in a degree-constrained minimum spanning tree (DCMST) algorithm, and a data transmission path between the central server and the client server is constructed on the basis of the DCMST algorithm.
For example, corresponding to step S306, data transmission paths from the central machine (i.e., the above-described central server) to other nodes (i.e., client servers) may be constructed based on the degree-constrained minimum spanning tree algorithm.
Fig. 4 shows a schematic diagram of a DCMST communication routing path constructed from communication routing paths in an existing network topology.
As shown in fig. 4, an existing network topology diagram including 6 server nodes is shown in the drawing at the upper left corner of fig. 4, a line segment existing between two server nodes indicates that a direct communication routing path exists between the two server nodes, a line segment does not exist between the two server nodes indicates that the two server nodes are not directly connected with each other, and a value on the path represents network delay. Using the prior art DCMST algorithm, a tree-like path of the DCMST in the lower left corner of fig. 4 can be constructed.
For example, when the cluster is initialized, the center collects the delay time of the connectivity of each node, and generates an initial transmission path shown in the drawing at the lower left corner of fig. 4 in a bold manner according to a spanning tree algorithm. When the machine is off-shelf, the center is informed of the path from the father node to the center, and the machine is removed from the father node.
Optionally, automatically checking via the client server whether the full amount of network data is updated is achieved by:
the client server automatically checks whether the check value of the copy of the full amount of network data is consistent with the check value of the full amount of network data, if the check values are consistent, the fact that the copy of the full amount of network data stored by the client server is consistent with the full amount of network data is indicated, the copy of the full amount of network data does not need to be updated,
wherein the check value comprises a hash value.
Optionally, the total amount of network data adopts a key-value storage structure, a data structure of MPT nodes corresponding to key-value data storage nodes of the central server and the client server is defined based on an etherhouse merkel compressed prefix tree (MPT), the data structure of the MPT nodes includes a first variable for storing an index value of the MPT nodes and a second variable for storing a check value, each of the central server and the client server corresponds to an instance of the etherhouse merkel compressed prefix tree (MPT), the check values of two MPT nodes corresponding to one of the two instances of the etherhouse merkel compressed prefix tree (MPT) are sequentially compared layer by layer from a MPT root node to an MPT leaf node from left to right, and when the check values of the two MPT nodes are consistent, it is indicated that the network data in the two corresponding key-value data storage nodes of the two servers corresponding to the two MPT nodes are consistent, there is no need to compare the check values of the sub-MPT nodes at each level of the two MPT nodes.
For example, the data structure of the etherhouse merkel compressed prefix tree (MPT) may be customized, the data difference between two servers may be quickly compared by generating the MPT comparison corresponding to the data, the hash value after encoding the key value (i.e., the value in the key-value pair) is stored according to the characteristics of the compressed prefix tree, and the hash value (i.e., one form of the check value) of the content corresponding to the key value is stored in the data node (i.e., the MPT node), so that the data difference can be determined by recursively determining whether the hashes of the parent nodes are consistent.
Optionally, as shown in a dashed box of fig. 3, the network storage method according to the present invention further includes:
step S308: the client server executes the callback operation of the network data change;
step S310: the client server and the central server carry out timing heartbeat keep-alive operation;
step S312: after the client server reestablishes the connection with the central server, the client server automatically re-registers to the cluster where the central server is located.
Optionally, the data structure of the MPT node includes: an MPT branch node data structure, an MPT extended node data structure, an MPT leaf node data structure,
wherein the MPT branch node data structure further comprises a third variable for storing pointers to a plurality of child nodes, a fourth variable for storing a pointer to a leaf child node or a null pointer,
the MPT extension node data structure further includes a fifth variable for storing a pointer to a child node, a fourth variable for storing a pointer to a leaf child node or a null pointer,
wherein the network data is stored in a key-value form, and the index value is a compressed key value.
For example, fig. 5 exemplarily shows a schematic diagram of data structures of 3 different MPT nodes that can be used according to the above-described technical scheme of the present invention.
Because the data structure for describing the MPT node in the prior art is more suitable for the operation of newly-added nodes and is not suitable for frequently modifying old numerical values, the invention uses the modified MPT node data structure, and the specific data structure is defined as follows:
1. branch nodes (i.e., MPT branch node data structures described above): there are three attributes (i.e., variables), the first of which is a childrens (which includes the first variable and the third variable), stores prefix bytes for each child node of the branch (i.e., the first variable) and pointers to the child nodes (i.e., the third variable); the second value stores a pointer of a node, and when the branch node itself is exactly the last node on one of the paths, the value points to a leaf node, and the other cases are null (i.e., the fourth variable mentioned above); the third value hash stores the hash value of the sum of all child node hashes of the node (i.e., the second variable described above).
2. Extension node (i.e., MPT extension node data structure described above): there are four attributes, the first is that the key is a byte array on the compression path (i.e., the first variable described above), and the index value that the variable stores is a compressed key value (e.g., string value), such as a unique key value (e.g., string value) nginx.conf, init.conf, etc.; the second is that children stores a pointer to the child node (i.e., the fifth variable described above), and the other two attributes value and hash (i.e., the fourth variable and the second variable described above) are the same as the branch node.
3. Leaf nodes (i.e., MPT leaf node data structures described above): there are two attributes, the first is key (i.e., the first variable mentioned above) representing the byte array on the compression path; and if the path is ended, the path is empty, and the second is that the hash (i.e., the second variable) represents the hash of the path itself, i.e., the hash value of the data content.
When the improved MPT node data structure is used by combining the technical scheme of the invention, the improved MPT node data structure has the following advantages:
1. the hash of the data content is not directly stored in the branch node and the expansion node, only the leaf node stores the hash, and the branch node and the expansion node point to one leaf node for storing data when the branch node and the expansion node need to store numerical values. And a contrast function is added thereto.
2. The original Ether shop MPT uses HP coding (Ether shop self-defined coding), and the value after the initial key coding is stored as a key for safety, but the method is not suitable for comparing and inquiring data.
3. All three node structures of the original Etherhouse MPT are possible to store data (if corresponding keys exist), a simple character string variable is used, in this way, when a stored result needs to add new fields, the three data structures need to be modified, the modified MPT data are all stored in leaf nodes, when branch and extension nodes need to store data, a special variable is used for storing a pointer pointing to the leaf nodes to represent the data of the branch and extension nodes, and therefore when the MPT stores more data, the leaf nodes are only required to be modified. And the difference is convenient to compare, and the difference data obtained by comparison is a set of leaf nodes.
Since the key-value storage structure is adopted by the full amount of network data, when the key-value storage structure of the full amount of network data or a certain file in the key-value storage structure is changed, each of the central server and the client server correspondingly updates a respective etherhouse merkel compressed prefix tree (MPT) instance. For example, the following specific operations may be included:
1. lookup node operations
Fig. 6 exemplarily shows a diagram for a lookup operation for an MPT tree using the MPT nodes shown in fig. 5.
As shown in fig. 6, the MPT tree instance stores three key values and their data hash values (abc, hash1), (abcef, hash2), (ccc, hash3), and the lookup operation may include the following specific steps:
a) if the current node is a branch node, if the search path is empty, returning the hash value of the node pointed by the value. If the search path is not empty, the first byte of the search path is utilized to search the next node in the hashmap, and the first byte is subtracted from the search path. If the child node is not found, the child node does not exist.
b) If the current node is an extended node, matching the prefix with the key of the extended node, if the prefix is consistent with the key of the extended node, subtracting the key prefix from the search path, and if the search path at the moment is empty, returning the hash value of the node pointed by the value. If the search path is not empty, the child node is entered, and if the child is empty, the child node does not exist.
c) If the current node is a leaf node, if the current node is not empty and the search path is matched with the key, returning the hash value of the current node, otherwise, not existing.
Taking the hash of the searched key value abcef as an example, the search path is abcef, a branch node is encountered first, childrens is checked, a child node a exists, the search path is modified to be bcef, an expansion node is encountered at the moment, bc is matched, the search path is modified to be ef, the child node is entered, finally, a leaf node is formed, and the matched key is equal to ef and the hash value hash1 is returned.
2. Insert or update operations
Fig. 7 exemplarily illustrates a schematic diagram for an insertion or update operation for an MPT tree using the MPT nodes illustrated in fig. 5.
Fig. 7 shows the result after the MPT tree instance in fig. 6 inserts (cbb, hash4) data. The insertion or update may include the following specific steps:
a) the longest path is first found out based on the lookup logic.
b) And if the search path is empty, adding or updating the hash value of the leaf node pointed by the value by the branch node and the extension node. If not, the judgment is continued according to the subsequent steps.
c) At this time, a child node is inserted into the branch node, and the key is a search path.
d) If the extended node is located at the extended node, if the prefixes are completely inconsistent, the extended node is changed into a branch node, and the original child node, the value node and the newly added node are inserted into the child nodes of the extended branch according to the first byte.
e) And updating the hash data hash' 2 and top related to the path from low to high in sequence.
That is, at the time of insertion (cbb, hash4), the following specific operations may be performed:
and searching the longest path c, wherein the searched path is bb, the current node is an expansion node, the expansion node is changed into a branch node, the original children node and the new node are inserted into childrens, and the related hash value on the path is updated.
3. Delete operation
Deletion can be regarded as the inverse operation of insertion, and can include the following specific steps:
a) searching nodes, and returning if the nodes do not exist.
b) If the father node of the node is a branch node, after deleting the node, if only one child node of the father branch node is left, changing the father branch node into an extended node.
c) And if the parent node of the node is the extension node, changing the extension node into a child node.
d) And updating the hash data related to the path from low to high in sequence.
4. Contrast operation
The comparison operation may comprise the following specific steps:
a) the hash values of root nodes of two trees (i.e., tree instances) are compared, and if the hash values are consistent, the two trees are completely consistent.
b) If the current leaf node indicates that the two leaf nodes are inconsistent, recording the difference list as a change.
c) Otherwise, another tree is searched and the searched path is marked according to the sub-paths (the key value and the hash value pointing to the node contained in the branch node childrens, and the key value of the expansion node and the hash value pointing to the node of childrens) of the current node, if the searched path does not exist, the searched path is recorded as new in the difference list, the searched path exists and the hash value is compared, if the hash is consistent, the subtree is consistent, and if the hash is inconsistent, the operation is recursed to compare all differences.
d) And traversing another tree, and recording all the unmarked child nodes as deletion.
In order to make the network storage method according to the present invention shown in fig. 3 more clearly understood by those skilled in the art, the following description will be made in conjunction with a specific embodiment.
1. The user adds (deletes or modifies) the data value of a certain key value key by using the interface outside the center.
2. The central kv repository stores the data and edit timestamps (timestamps) and updates the merkel compressed prefix tree (MPT), resulting in an index and a root node hash (rothash).
3. And taking out child nodes of the minimum spanning tree, and sending the key, the value, the timestamp and the root node hash data to the clients.
4. The client receives the data.
a) The timestamp of the original key is taken (if any) and discarded if the new timestamp is earlier than it indicates that the piece of data is old.
b) Otherwise, the value and the time stamp of the key are updated, and the data is also sent to the child node of the minimum spanning tree of the child node.
c) Updating the MPT of the node to obtain a new root node hash, finishing if the new root node hash is consistent with the root node hash of the data, otherwise, explaining the data difference caused by the network or machine up-and-down frame in the middle of the current data, inquiring the root node hash from the peripheral node by the node, and completely sending the MPT of the node to the node if the node consistent with the root node hash is inquired.
d) And the other clients receive the MPT of the client, perform comparison operation and return difference data.
e) The client receives the difference data and combines the difference data into the data of the client, and the hash of the root node is consistent.
f) Callback the operation of the registration (code, system command or script) in such a way as to achieve the modification of the configuration generation or environment variables.
g) And returning the current root node hash to the center by the original path.
4. And a timer is arranged in the client, the client heartbeats with the father node, and when the hash of the root node is inconsistent and updated in time, the client registers again after the heartbeats are disconnected.
5. The central records collect the hash of the root nodes of all the nodes, and the failed nodes can be found in time.
According to the technical scheme of the invention, the method has the following advantages:
1. the tree-shaped message transmission is carried out, the used bandwidth is small, the performance is good (the delay is small, the real-time performance is good), too much pressure is not brought to a central machine, and servers of tens of thousands to hundreds of thousands can be supported.
2. The path of the minimum spanning tree generated according to the connectivity among the nodes ensures that the data can reach some nodes which cannot be directly connected with the central machine. And the client can automatically rejoin the cluster after the network fluctuation guaranteed by the heartbeat of the client is disconnected. Therefore, the problem that the updated data is inconsistent with the original updated data due to network problems such as network jitter and the like is avoided.
3. The consistency of data is guaranteed through the hash of the root node of the client, and when the client with inconsistent data communicates with other clients until the data is accurate, the operation is executed, so that the correctness of the operation is guaranteed. Therefore, the problem that the updated data is inconsistent with the original updated data due to network problems such as network jitter and the like is avoided.
For example, network jitter and the like may cause some nodes not to receive a part of update instructions, but when the nodes reconnect to the cluster and interact with other nodes or receive new update instructions due to heartbeat, it may be found that the value of the MPT root node of the node is inconsistent with that of other nodes, and then complete MPT data of the node may be sent to the MPT node having the correct root node hash, and after receiving the data, the other nodes compare the difference and push the difference back to the nodes, and the nodes update the difference data. In the case where the external code needs to use native data, it also needs to determine whether the version of the root node (i.e., the root node hash) is expected when used, or else it needs to block waiting for the data to be updated.
The above-described aspects may be implemented individually or in various combinations, and such variations are within the scope of the present invention.
It will be understood by those of ordinary skill in the art that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software, firmware, hardware, or suitable combinations thereof. In a hardware implementation, the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation. Some or all of the components may be implemented as software executed by a processor, such as a digital signal processor or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as is well known to those of ordinary skill in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by a computer. In addition, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as known to those skilled in the art.
Finally, it should be noted that: the above examples are only for illustrating the technical solutions of the present invention, and are not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (12)

1. A network storage system comprising a central server and a client server for consistent storage, characterized by:
the central server is used for storing full network data, receiving and executing a first data access operation instruction for operating the network data by a user, issuing a client server management operation instruction for managing the client server, and receiving and executing a link maintenance operation instruction for maintaining a communication link between the central server and the client server;
the client server is used for automatically checking whether the full network data is updated and storing the copy of the full network data in a consistent manner, receiving and executing the management operation instruction of the central server, and receiving and executing a second data access operation instruction which is inquired by a user on the copy of the network data;
automatically checking, via the client server, whether the full amount of network data is updated is accomplished by:
automatically checking whether the check value of the copy of the full amount of network data is consistent with the check value of the full amount of network data through the client server, wherein the consistency of the check values indicates that the copy of the full amount of network data stored by the client server is consistent with the full amount of network data, and the copy of the full amount of network data does not need to be updated;
the full amount of network data adopts a key-value storage structure, and the data structures of MPT nodes corresponding to the key-value data storage nodes of the central server and the client server are defined based on an Etfang Mercker compressed prefix tree (MPT);
the data structure of the MPT node includes: an MPT branch node data structure, an MPT extended node data structure and an MPT leaf node data structure;
the MPT branch node data structure includes: a first variable for storing an index value of an MPT node and a third variable for storing pointers to a plurality of child nodes, a fourth variable for storing a pointer to a leaf child node or a null pointer, and a hash value storing a sum of hashes of all child nodes of the MPT node;
the MPT extension node data structure includes: the first variable, a fifth variable for storing a pointer to a child node, the fourth variable, and the hash value storing the sum of hashes of all child nodes of the MPT node;
the MPT leaf node data structure includes: the first variable, and a hash value of the data content.
2. The network storage system of claim 1, wherein:
and setting the central server as a DCMST root node in a degree-constrained minimum spanning tree DCMST algorithm, and constructing a data transmission path between the central server and the client server based on the degree-constrained minimum spanning tree DCMST algorithm.
3. The network storage system of claim 1 or 2, wherein the check value comprises a hash value.
4. The network storage system of claim 3, wherein each of the central server and the client servers corresponds to one instance of the EtherFang Mercker compressed prefix tree (MPT), check values of two MPT nodes corresponding to one of the two instances of the EtherFang Mercker compressed prefix tree (MPT) are sequentially compared layer by layer from an MPT root node to an MPT leaf node from left to right, and when the check values of the two MPT nodes are identical, it indicates that network data in two corresponding key-value data storage nodes of the two servers corresponding to the two MPT nodes are identical without comparing check values of child MPT nodes of the two MPT nodes.
5. The network storage system of claim 1 or 2, wherein the client server is further configured to:
network data change callback operation;
carrying out timing heartbeat keep-alive operation with the central server;
and after the connection with the central server is reestablished, automatically re-registering the cluster in which the central server is positioned.
6. The network storage system of claim 4,
wherein the network data is stored in a key-value form, and the index value is a compressed key value.
7. A network storage method, comprising:
the system comprises a central server, a client server and a server, wherein the central server is used for storing full network data, receiving and executing a first data access operation instruction for a user to operate the network data, issuing a client server management operation instruction for managing the client server, and receiving and executing a link maintenance operation instruction for maintaining a communication link between the central server and the client server;
the client server is used for automatically checking whether the full amount of network data is updated and the copies of the full amount of network data are stored consistently, receiving and executing the management operation instruction of the central server, and receiving and executing a second data access operation instruction for inquiring the copies of the network data by a user;
automatically checking, via the client server, whether the full amount of network data is updated is accomplished by:
the client server automatically checks whether the check value of the copy of the full amount of network data is consistent with the check value of the full amount of network data, if so, the client server stores the copy of the full amount of network data consistent with the full amount of network data, and the copy of the full amount of network data does not need to be updated;
the full amount of network data adopts a key-value storage structure, and the data structures of MPT nodes corresponding to the key-value data storage nodes of the central server and the client server are defined based on an Etfang Mercker compressed prefix tree (MPT);
the data structure of the MPT node includes: an MPT branch node data structure, an MPT extended node data structure and an MPT leaf node data structure;
the MPT branch node data structure includes: a first variable for storing an index value of an MPT node and a third variable for storing pointers to a plurality of child nodes, a fourth variable for storing a pointer to a leaf child node or a null pointer, and a hash value storing a sum of hashes of all child nodes of the MPT node;
the MPT extended node data structure includes: the first variable, a fifth variable for storing a pointer to a child node, the fourth variable, and the hash value storing the sum of hashes of all child nodes of the MPT node;
the MPT leaf node data structure includes: the first variable, and a hash value of the data content.
8. The network storage method of claim 7, further comprising:
and setting the central server as a DCMST root node in a degree constraint minimum spanning tree DCMST algorithm, and constructing a data transmission path between the central server and the client server based on the degree constraint minimum spanning tree DCMST algorithm.
9. The network storage method of claim 7 or 8,
the check value comprises a hash value.
10. The network storage method of claim 9, wherein each of the central server and the client servers corresponds to one instance of the efms merkel compressed prefix tree MPT, check values of two MPT nodes corresponding to one of the two instances of the efms merkel compressed prefix tree MPT are sequentially compared layer by layer from left to right from MPT root nodes to MPT leaf nodes, and when the check values of the two MPT nodes are identical, it indicates that network data in two corresponding key-value data storage nodes of the two servers corresponding to the two MPT nodes are identical, without comparing check values of child MPT nodes of the two MPT nodes.
11. The network storage method of claim 7 or 8, further comprising:
the client server executes network data change callback operation;
the client server and the central server perform timing heartbeat keep-alive operation;
and after the client server reestablishes the connection with the central server, the client server automatically re-registers to the cluster where the central server is located.
12. The network storage method of claim 10,
wherein the network data is stored in a key-value form, and the index value is a compressed key value.
CN201810919502.2A 2018-08-14 2018-08-14 Network storage system and method Active CN110830539B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810919502.2A CN110830539B (en) 2018-08-14 2018-08-14 Network storage system and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810919502.2A CN110830539B (en) 2018-08-14 2018-08-14 Network storage system and method

Publications (2)

Publication Number Publication Date
CN110830539A CN110830539A (en) 2020-02-21
CN110830539B true CN110830539B (en) 2022-09-06

Family

ID=69547027

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810919502.2A Active CN110830539B (en) 2018-08-14 2018-08-14 Network storage system and method

Country Status (1)

Country Link
CN (1) CN110830539B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111831694B (en) * 2020-06-23 2023-06-20 中国科学院软件研究所 Quick decision method of reactive system
CN111737269B (en) * 2020-08-26 2021-02-02 苏州浪潮智能科技有限公司 Data query response method and device and computer readable storage medium
CN112383449B (en) * 2020-11-19 2022-07-22 广东沃科融合通讯有限公司 Information sending method and device, electronic equipment and storage medium
CN113094074B (en) * 2021-05-07 2024-03-19 聚好看科技股份有限公司 Service cluster updating method and device
CN115065642B (en) * 2022-08-18 2022-12-02 深圳华锐分布式技术股份有限公司 Code table request method, device, equipment and medium under bandwidth limitation

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102904949A (en) * 2012-10-08 2013-01-30 华中科技大学 Replica-based dynamic metadata cluster system
CN103607405A (en) * 2013-11-27 2014-02-26 东北大学 Ciphertext search authentication method oriented towards cloud storage
CN107231394A (en) * 2016-03-25 2017-10-03 阿里巴巴集团控股有限公司 A kind of building method of data source address distribution tree and the method for replicate data
CN108039943A (en) * 2017-12-06 2018-05-15 清华大学深圳研究生院 A kind of encryption searching method that can verify that

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008250903A (en) * 2007-03-30 2008-10-16 Toshiba Corp File updating device, program and method
KR101252787B1 (en) * 2011-12-06 2013-04-09 이청종 Security management system with multiple gateway servers and method thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102904949A (en) * 2012-10-08 2013-01-30 华中科技大学 Replica-based dynamic metadata cluster system
CN103607405A (en) * 2013-11-27 2014-02-26 东北大学 Ciphertext search authentication method oriented towards cloud storage
CN107231394A (en) * 2016-03-25 2017-10-03 阿里巴巴集团控股有限公司 A kind of building method of data source address distribution tree and the method for replicate data
CN108039943A (en) * 2017-12-06 2018-05-15 清华大学深圳研究生院 A kind of encryption searching method that can verify that

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于代理重签名的云端数据完整性验证方案;杨小东等;《计算机工程》;20171018(第09期);全文 *

Also Published As

Publication number Publication date
CN110830539A (en) 2020-02-21

Similar Documents

Publication Publication Date Title
CN110830539B (en) Network storage system and method
CN110138588B (en) Method and system for automatically managing configuration files, configuration management platform and client
US8826032B1 (en) Systems and methods for network change discovery and host name resolution in storage network environments
CN112217656B (en) Method and device for synchronizing configuration information of network equipment in SD-WAN (secure digital-to-Wide area network) system
US11663192B2 (en) Identifying and resolving differences between datastores
US10956501B2 (en) Network-wide, location-independent object identifiers for high-performance distributed graph databases
CN108196787B (en) Quota management method of cluster storage system and cluster storage system
US10972296B2 (en) Messaging to enforce operation serialization for consistency of a distributed data structure
WO2023016091A1 (en) Data archiving method and apparatus, device, storage medium, and computer program product
CN109947411A (en) The method that distributed software generates unique ID major key
CN108694218A (en) A kind of method and apparatus data write-in and read
US20210165763A1 (en) Autonomous intelligent data pipeline comparator
US12032557B2 (en) Method, device, and computer program product for data management
CN106911769B (en) Cloud platform routing data processing method and physical server of cloud platform
CN112328702A (en) Data synchronization method and system
CN102957546A (en) Method, device and system for processing configuration
CN111324483B (en) Data recovery method and device and related equipment
CN104022896B (en) A kind of configuring management method, device and the network equipment
CN112804276B (en) Virtual broadband remote access server, control method thereof and communication system
KR100810877B1 (en) Data mirroring restoration in a distributed system
CN114500289B (en) Control plane recovery method, device, control node and storage medium
CN113934742B (en) Data updating method, node information storage method, electronic device and medium
US20210099282A1 (en) Management of software defined network configuration data based on hash trees
CN113032408A (en) Data processing method, system and equipment
CN114510529A (en) Data synchronization method and device, computer equipment and storage medium

Legal Events

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