CN112612793A - Resource query method, device, node equipment and storage medium - Google Patents

Resource query method, device, node equipment and storage medium Download PDF

Info

Publication number
CN112612793A
CN112612793A CN202011566770.4A CN202011566770A CN112612793A CN 112612793 A CN112612793 A CN 112612793A CN 202011566770 A CN202011566770 A CN 202011566770A CN 112612793 A CN112612793 A CN 112612793A
Authority
CN
China
Prior art keywords
node
resource
identification information
target
query
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.)
Granted
Application number
CN202011566770.4A
Other languages
Chinese (zh)
Other versions
CN112612793B (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.)
Hundsun Technologies Inc
Original Assignee
Hundsun Technologies Inc
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 Hundsun Technologies Inc filed Critical Hundsun Technologies Inc
Priority to CN202011566770.4A priority Critical patent/CN112612793B/en
Publication of CN112612793A publication Critical patent/CN112612793A/en
Application granted granted Critical
Publication of CN112612793B publication Critical patent/CN112612793B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2471Distributed queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a resource query method, a resource query device, node equipment and a storage medium, wherein the method comprises the following steps: determining a target logic storage node in a topological routing table with a chordal ring according to the identification information of the first target resource; further sending a query request to the target logical storage node to indicate the target logical storage node to query a target physical storage node storing the first target resource in a conversion table of the target logical storage node; the conversion table is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the physical storage nodes; a first target resource is stored on a target physical storage node; and then receiving a query response containing the identification information of the target physical storage node, which is fed back by the target logical storage node, and acquiring the first target resource from the target physical storage node according to the identification information of the target physical storage node. The resources in the invention do not need to be migrated to the logical storage nodes configured for the resources, thereby eliminating the data migration process in the prior art and simultaneously realizing the quick query of the resources.

Description

Resource query method, device, node equipment and storage medium
Technical Field
The present invention relates to the field of distributed storage, and in particular, to a resource query method, apparatus, node device, and storage medium.
Background
The DHT maps a set of key values to all nodes in the distributed system, and allows for fast data location. Based on the distributed hash, various complex applications can be constructed, such as a distributed file system, a peer-to-peer technology file sharing system, cooperative web caching, multicasting, anycasting, a domain name system, instant messaging, and the like.
The Chord method is used for establishing a one-to-one correspondence relationship between a node id (node identification) of a node and a key id (key identification) of a resource key word by virtualizing a network into a single ring topology, thereby realizing storage and search of resources. Therefore, the data location can be quickly located in the query phase only after the resources stored in different storage nodes are migrated to the storage nodes specified according to the Chord protocol and the corresponding relationship between each resource and the specified storage node is established, which requires a large amount of bandwidth and time to perform data migration.
Disclosure of Invention
In view of the above, an object of the present invention is to provide a resource query method, apparatus, node device and storage medium, which can achieve the effect of quickly querying resources without migrating resources to a logical storage node configured for the resource, eliminate the data migration process in the prior art, and save bandwidth and query time.
The technical scheme of the invention can be realized as follows:
in a first aspect, the present invention provides a resource query method, applied to a first node, where the first node is any one node in a distributed system, and the method includes: determining a target logic storage node in a topological routing table with a chordal ring according to the identification information of the first target resource; the topological routing table with the string ring is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the logic storage nodes; the target logical storage node is configured as a theoretical storage node for the first target resource; sending a query request to the target logical storage node; the query request is used for indicating the target logic storage node to query a target physical storage node in a conversion table of the target logic storage node; the conversion table is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the physical storage nodes; the first target resource is stored on the target physical storage node; receiving a query response of the target logical storage node, wherein the query response contains identification information of the target physical storage node; and acquiring the first target resource from the target physical storage node according to the identification information of the target physical storage node.
Optionally, the method further comprises: establishing a storage table according to all local resources and the topological routing table with the chordal ring; the storage table is used for maintaining the corresponding relation between the identification information of the local resource and the identification information of the logic storage node corresponding to the local resource; sending a first message to all logical storage nodes in the storage table; the first message is used for indicating all the logic storage nodes to generate respective corresponding conversion tables; receiving a second message sent by a second node, wherein the second message comprises identification information of local resources of the second node and identification information of the second node; the first node is configured as a theoretical storage node for local resources of the second node; the second node is at least one node except the first node in the distributed system; and establishing a conversion table of the first node according to the identification information of the local resource of the second node and the identification information of the second node.
Optionally, the method further comprises: when the first node has a newly added resource, determining a logic storage node of the newly added resource in the topological routing table with the chordal ring according to the identification information of the newly added resource; updating the identification information of the newly added resource and the identification information of the logic storage node of the newly added resource to the storage table; sending an updating message to the logic storage node of the newly added resource; and the update message is used for indicating the logic storage node of the newly added resource to update the identification information of the newly added resource and the identification information of the first node to the conversion table of the logic storage node of the newly added resource.
Optionally, the method further comprises: when the first node deletes the local resource, deleting the identification information of the deleted local resource and the identification information of the logic storage node of the local resource in the storage table; sending a deletion message to the deleted logical storage node of the local resource; the deletion message is used for indicating the deleted logic storage node of the local resource to delete the identification information of the deleted local resource and the identification information of the first node in a conversion table.
Optionally, the method further comprises: receiving an update message of the second node, wherein the update message comprises identification information of newly added resources and identification information of the second node; the new resource is stored on the second node; and updating the identification information of the newly added resource and the identification information of the second node to the conversion table of the first node.
Optionally, the method further comprises: receiving a deletion message of the second node, wherein the deletion message comprises identification information of deleted resources and identification information of the second node; the deleted resource is stored on the second node; the first node is configured as a theoretical storage node for the deleted resource; deleting the identification information of the deleted resource and the identification information of the second node in the conversion table of the first node.
Optionally, the method further comprises: obtaining a query request; the query request comprises identification information of a second target resource; the identification information of the second target resource is positioned in a conversion table of the first node; inquiring a physical storage node for storing the second target resource in a conversion table of the first node according to the identification information of the second target resource; and sending a query response, wherein the query response contains the identification information of the physical storage node of the second target resource.
Optionally, the method further comprises: obtaining a query request; the query request comprises identification information of a third target resource; the identification information of the third target resource is matched with the identification information in the storage table of the first node; sending a query response; the query response includes identification information of the first node.
In a second aspect, the present invention provides a resource query method, which is applied to a first node, where the first node is any one node in a distributed system, and the method includes: obtaining a query request; the query request comprises identification information of the target resource; inquiring and storing a target physical storage node in a conversion table of the first node according to the identification information of the target resource; the conversion table is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the physical storage nodes; the target resource is stored on the target physical storage node; and sending a query response, wherein the query response contains the identification information of the target physical storage node.
In a third aspect, the present invention provides a resource query method, applied to a first node, where the first node is any one node in a distributed system, and the method includes: obtaining a query request; the query request comprises identification information of the target resource; the identification information of the target resource is positioned in a storage table of the first node; the storage table is used for maintaining the corresponding relation between the identification information of the local resource and the identification information of the logic storage node; the logical storage node is configured as a theoretical storage node for the local resource; sending a query response; the query response includes identification information of the first node.
In a fourth aspect, the present invention provides a resource query apparatus, including: the determining module is used for determining a target logic storage node in the topological routing table with the chordal ring according to the identification information of the first target resource; the topological routing table with the string ring is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the logic storage nodes; the target logical storage node is configured as a theoretical storage node for the first target resource; the communication module is used for sending a query request to the target logic storage node; the query request is used for indicating the target logic storage node to query a target physical storage node in a conversion table of the target logic storage node; the conversion table is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the physical storage nodes; the first target resource is stored on the target physical storage node; receiving a query response of the target logical storage node, wherein the query response contains identification information of the target physical storage node; and the acquisition module is used for acquiring the first target resource from the target physical storage node according to the identification information of the target physical storage node.
Optionally, the resource query apparatus further includes an establishing module; the establishing module is used for establishing a storage table according to all local resources and the topological routing table with the chordal ring; the storage table is used for maintaining the corresponding relation between the identification information of the local resource and the identification information of the logic storage node corresponding to the local resource; the communication module is used for sending a first message to all logic storage nodes in the storage table; the first message is used for indicating all the logic storage nodes to generate respective corresponding conversion tables; receiving a second message sent by a second node, wherein the second message comprises identification information of local resources of the second node and identification information of the second node; the first node is configured as a theoretical storage node for local resources of the second node; the second node is at least one node except the first node in the distributed system; the establishing module is further configured to establish a translation table of the first node according to the identification information of the local resource of the second node and the identification information of the second node.
Optionally, the resource query apparatus further includes an update module; the determining module is further configured to determine, when a newly added resource exists in the first node, a logical storage node of the newly added resource in the chordal ring topology routing table according to identification information of the newly added resource; the updating module is used for updating the identification information of the newly added resource and the identification information of the logic storage node of the newly added resource to the storage table; the communication module is further configured to send an update message to the logical storage node of the newly added resource; and the update message is used for indicating the logic storage node of the newly added resource to update the identification information of the newly added resource and the identification information of the first node to the conversion table of the logic storage node of the newly added resource.
Optionally, the resource querying device further includes a deleting module; the deleting module is configured to delete, when the first node deletes the local resource, the identifier information of the deleted local resource and the identifier information of the logical storage node of the local resource in the storage table; the communication module is further configured to send a deletion message to the deleted logical storage node of the local resource; the deletion message is used for indicating the deleted logic storage node of the local resource to delete the identification information of the deleted local resource and the identification information of the first node in a conversion table.
Optionally, the communication module is further configured to receive an update message of the second node, where the update message includes identification information of a newly added resource and identification information of the second node; the new resource is stored on the second node; the updating module is further configured to update the identification information of the newly added resource and the identification information of the second node to the conversion table of the first node.
Optionally, the communication module is further configured to receive a deletion message of the second node, where the deletion message includes identification information of a deleted resource and identification information of the second node; the deleted resource is stored on the second node; the first node is configured as a theoretical storage node for the deleted resource; the deleting module is further configured to delete, in the conversion table of the first node, the identification information of the deleted resource and the identification information of the second node.
Optionally, the obtaining module is further configured to obtain a query request; the query request comprises identification information of a second target resource; the identification information of the second target resource is positioned in a conversion table of the first node; the determining module is further configured to query, in the translation table of the first node, a physical storage node storing the second target resource according to the identification information of the second target resource; the communication module is further configured to send a query response, where the query response includes identification information of the physical storage node of the second target resource.
Optionally, the obtaining module is further configured to obtain a query request; the query request comprises identification information of a third target resource; the identification information of the third target resource is matched with the identification information in the storage table of the first node; the communication module is also used for sending a query response; the query response includes identification information of the first node.
In a fifth aspect, the present invention provides a resource query apparatus, including an obtaining module, configured to obtain a query request; the query request comprises identification information of the target resource; the identification information of the target resource is positioned in a storage table of the first node; the storage table is used for maintaining the corresponding relation between the identification information of the local resource and the identification information of the logic storage node; the logical storage node is configured as a theoretical storage node for the local resource; the communication module is used for sending the inquiry response; the query response includes identification information of the first node.
In a sixth aspect, the present invention provides a resource query apparatus, which is applied to a first node, where the first node is any one node in a distributed system, and includes: the acquisition module is used for acquiring a query request; the query request comprises identification information of the target resource; the identification information of the target resource is matched with the identification information in the storage table of the first node; the storage table is used for maintaining the corresponding relation between the identification information of the local resource of the first node and the identification information of the logic storage node corresponding to the local resource; the logical storage node is configured as a theoretical storage node for the local resource; the communication module is used for sending the inquiry response; the query response includes identification information of the first node.
In a seventh aspect, the present invention provides a node device, comprising a processor and a memory, wherein the memory stores machine executable instructions capable of being executed by the processor, and the processor can execute the machine executable instructions to implement the resource query method of the first aspect and/or the resource query method of the second aspect and/or the resource query method of the third aspect.
In an eighth aspect, the present invention provides a storage medium having stored thereon a computer program which, when executed by a processor, implements the resource query method of the first aspect and/or the resource query method of the second aspect and/or the resource query method of the third aspect.
The embodiment of the invention provides a resource query method, a resource query device, a node device and a storage medium, wherein the method is applied to a first node, the first node is any one node in a distributed system, and the method comprises the following steps: determining a target logic storage node in a topological routing table with a chordal ring according to the identification information of the first target resource; the topological routing table with the string ring is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the logic storage nodes; the target logical storage node is configured as a theoretical storage node for the first target resource; sending a query request to a target logical storage node; the query request is used for indicating the target logic storage node to query the target physical storage node in the conversion table of the target logic storage node; the conversion table is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the physical storage nodes; a first target resource is stored on a target physical storage node; receiving a query response of a target logic storage node, wherein the query response contains identification information of a target physical storage node; and acquiring the first target resource from the target physical storage node according to the identification information of the target physical storage node. The difference from the prior art is that the resources in the prior art need to be stored in the logical storage nodes configured for the nodes, and the nodes can realize fast and accurate resource query according to the maintained topological routing table with the chordal ring.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a prior art ring network architecture diagram;
fig. 2 is a schematic diagram of a distributed network structure according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart of a resource query method according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating an example scenario provided by an embodiment of the present invention;
fig. 5 is an exemplary diagram of a chordal ring topology routing table according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating an example of a translation table according to an embodiment of the present invention;
FIG. 7 is a schematic flow chart of another resource query method according to an embodiment of the present invention;
FIG. 8 is a second schematic flowchart of another resource query method according to an embodiment of the present invention;
FIG. 9 is a third schematic flowchart of another resource query method according to an embodiment of the present invention;
FIG. 10 is an exemplary diagram of a memory table provided by an embodiment of the present invention;
FIG. 11 is a fourth schematic flowchart of another resource query method according to an embodiment of the present invention;
FIG. 12 is a fifth schematic flowchart of another resource query method according to an embodiment of the present invention;
FIG. 13 is a sixth schematic flowchart of another resource query method according to the embodiment of the present invention;
FIG. 14 is a seventh schematic flow chart of another resource query method according to the embodiment of the present invention;
fig. 15 is a signaling interaction diagram provided in an embodiment of the present invention;
fig. 16 is another signaling interaction diagram provided in the embodiment of the present invention;
FIG. 17 is a functional block diagram of a resource query device according to an embodiment of the present invention;
fig. 18 is a second functional block diagram of a resource query device according to the second embodiment of the present invention;
fig. 19 is a third functional block diagram of a resource query apparatus according to an embodiment of the present invention;
fig. 20 is a block diagram of a node device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
At present, in a distributed system, a distributed hash method is adopted to realize rapid positioning of resources, so that various complex applications such as a distributed file system, a point-to-point technology file sharing system, a cooperative web cache, multicast, anycast, a domain name system, instant messaging and the like can be constructed based on the distributed hash method. However, the distributed hash method is prone to causing the database downtime problem in the resource expansion scene, and the related technology provides a consistent hash algorithm to solve the defects of the traditional distributed hash algorithm, wherein the Chord algorithm is taken as a typical consistent hash algorithm, has the advantages of high flexibility, load balance and the like, and can realize quick positioning of resources and reduce the database downtime risk in the resource expansion scene.
The Chord algorithm maps resources (Key) and nodes (Node) to a ring through a hash algorithm by virtualizing a distributed network system into a single ring-shaped topological structure, the hash values of the resources and the nodes are arranged clockwise on the ring according to the size, based on the topological structure, a logical storage Node is configured for the resources according to a preset configuration rule, and the resources are stored on the logical storage Node, wherein the preset configuration rule is as follows: for a resource with a resource ID (hereinafter abbreviated as KID) of n, a first node with a ring node ID (hereinafter abbreviated as NID) not less than n is used as a logic storage node of the resource, the logic storage node stores the resource with the KID of n, and the storage position of the resource can be quickly positioned in the resource query process by establishing a corresponding relation between the KID of the resource and the NID of the logic storage node.
For convenience of understanding, referring to fig. 1, fig. 1 is a ring network architecture diagram of the prior art, as shown in fig. 1, there are 3 nodes and 6 resources on the ring, which are respectively a node 0 with NID of 0, a node 1 with NID of 1, a node 3 with NID of 3, a resource 1 with KID of 1, a resource 2 with KID of 2, a resource 4 with KID of 4, a resource 5 with KID of 5, a resource 6 with KID of 6, and a resource 7 with KID of 7, according to the preset configuration rule, node 0 is a logical storage node of resource 4, resource 5, resource 6, and resource 7, and is used for storing resource 4, resource 5, resource 6, and resource 7, and node 0 is a successor node of resource 4, resource 5, resource 6, and resource 7, and may be represented as: sucessor (6) ═ 0; node 1 is a logical storage node of resource 1, and is configured to store resource 1, and then node 1 is a successor node of resource 1, and may be represented as: 1, sucessor (1) ═ 1; node 3 is a logical storage node of resource 2, and is configured to store resource 2, and node 3 is a subsequent node of resource 2, and may be denoted as sucessor (2) ═ 3.
Based on the above-mentioned architecture, each resource is designated to be stored in the configured logical storage node, in order to realize the fast location of the resource, each node needs to maintain a chordal ring topology routing table (changetable) for maintaining a plurality of successor resources of the node and the successor node corresponding to each successor resource, according to the chordal ring topology routing table, when there is a resource query requirement, the logical storage node corresponding to any one resource can be determined through the chordal ring topology routing table, and then the resource can be obtained from the logical storage node.
The inventor finds in the research process that after the corresponding relationship between the resources and the nodes is established, the resources must be stored in the nodes configured for the resources, and the positions of the resources can be quickly located according to the chordal ring topology routing table in the query stage. However, in a complex distributed system, if the resource data in the system is updated too fast, a large amount of data migration work needs to be performed, so that the resource is always stored on the designated logical storage node, which needs to consume a large amount of bandwidth and time to perform data migration.
For example, with reference to fig. 1, according to the Chord protocol, the node 0 is configured as a logical storage node for the resources 4, 5, 6, and 7, in some possible scenarios, the resources 4, 5, 6, and 7 may be stored on the node 1 at the same time, or may be stored on different other nodes, respectively, and in order to ensure that the resources 4-7 are queried to the resources 4-7 according to the chordal ring topology routing table in the query phase, the resources 4, 5, 6, and 7 need to be migrated from the node 1 or other different nodes to the node 0. Thus, when a large number of different nodes store the resource that should be theoretically stored in the node 0, a large amount of bandwidth and time are consumed to continuously migrate the resource on the different nodes to the node 0.
In order to solve the problem of data migration, on the basis of the above architecture, the embodiment of the present invention introduces a concept of a conversion table (transformational table), that is, for any node in the distributed system, the conversion table is used to maintain not only a chordal ring topology routing table, but also a conversion table, where the conversion table is used to maintain a correspondence between a resource that the node should theoretically store and a physical storage node that actually stores the resource.
Through the mode, for each node in the distributed system, when a resource query request is stored, the request is sent to the theoretical storage node corresponding to the resource according to the topological routing table with the chordal ring, the required node is obtained, and the information of the physical storage node actually storing the resource is determined by using the maintained conversion table.
In order to ensure that each node can update the self-maintained conversion table in time, the embodiment of the present application further introduces a concept of a storage table (storage table), where the storage table is used to maintain a correspondence relationship between local resources of the node and the logical storage nodes, and the storage table is used to assist in building and updating the conversion table, so that when there is an update demand, each node indicates all the logical storage nodes in the update table to update the conversion table through the self-maintained storage table.
Furthermore, for the technical solution provided in the embodiment of the present application, in order to achieve fast resource location, for each node in the distributed system, it is not necessary to migrate the resource stored in the node to the logical storage node corresponding to the resource, and when there is a resource query requirement, the logical storage node of the resource may be determined according to the chordal ring topology routing table, and then the logical storage node queries a conversion table maintained by itself to obtain information of a physical storage node that actually stores the resource, thereby eliminating the drawback that data migration is required in the prior art to ensure fast location.
It should be noted that the resource in the embodiment of the present invention may be all information such as characters, images, sounds, and animations stored in the form of electronic data, and is not limited herein.
For convenience of understanding the implementation principle of the technical solution of resource query provided in the embodiment of the present application, the technical solution of resource query in the embodiment of the present invention is provided below on the basis of the above network architecture. Referring to fig. 2, fig. 2 is a schematic diagram of a distributed network structure according to an embodiment of the present invention, where the distributed network structure includes a data requesting node 11, a logical storage node 12, and a physical storage node 13; the data requesting node 11, the logical storage node 12, and the physical storage node 13 each maintain the storage tables, the translation tables, and the chordal ring topology routing tables described above.
When a resource query request exists in the data request node 11, the data request node 11 is configured to determine, according to identification information of a target resource, a logical storage node 12 corresponding to the target resource in a chordal ring topology routing table maintained by the data request node 11, and send a query request to the logical storage node 12, where the logical storage node 12 is configured to obtain the query request of the data request node 11, query a physical storage node 13 storing the target resource in a conversion table maintained by the data request node 12, and feed back identification information of the physical storage node 13 to the data request node 11; the data request node 11 is further configured to receive a query response from the logical storage node 12, and obtain the target resource from the physical storage node 13 according to the identification information of the physical storage node 13.
It should be noted that, for any node in the distributed system, it may serve as the data requesting node 11 to request resources from other nodes in the system; or as a logic storage node 12, obtaining the query request from the data request node 11, and feeding back the actual storage location information of the query resource to the data request node 11; it may also serve as a physical storage node 13 to provide target resources to the data requesting node 11.
In order to ensure that the resource position can be quickly located in the resource query process, for any type of node, in the scenario that the node is used as a data request node 11 and/or a physical storage node 13 and/or a logical storage node 12, a storage table can be established according to a chordal ring topology routing table and local resources maintained by the node, and a message is sent to all logical storage nodes in the storage table to indicate the nodes in the storage table to establish respective conversion tables; meanwhile, the method can also be used for receiving messages sent by other nodes and establishing own conversion table according to the messages.
It can be understood that, for the nodes in the distributed system of the embodiment of the present invention, when each node completes its own storage table, the conversion table of each node in the entire distributed system is also completed.
Referring to fig. 3 and fig. 4, fig. 3 is a schematic flowchart of a resource query method according to an embodiment of the present invention, fig. 4 is a scenario example diagram provided by the embodiment of the present invention, and a technical solution of the resource query method according to the embodiment of the present invention is described with any one node (hereinafter, referred to as a first node) in the network structure as an execution subject, where the method includes:
s114, determining a target logic storage node in the topological routing table with the chordal ring according to the identification information of the first target resource.
In some possible embodiments, the identification information of the first target resource may be a hash value obtained by performing a hash calculation on the target resource through a hash algorithm, for example, k2 shown in fig. 4 may be characterized as the identification information of resource 2. The hash algorithm may be, but is not limited to, secure hash algorithm SHA-1(SecureHashAlgorithm1, SHA-1 for short).
The above-mentioned chordal ring topology routing table is stored in the first node, which contains n successors of the node and each successor corresponding successor node. For example, with reference to fig. 4, assuming that the first node is node 1, the implementation manner of the above-mentioned chordal ring topology routing table may be as shown in fig. 5, with reference to fig. 5, where fig. 5 is a schematic diagram of a chordal ring topology routing table provided by the embodiment of the present invention.
It will be appreciated that the above-described logical storage node may be a node other than the data requesting node 11 in a distributed system, and is configured as a theoretical storage node for the target resource according to the Chord protocol.
And S115, sending a query request to the target logic storage node.
It can be understood that the query request may include identification information of the first target resource, and when the target logical storage node obtains the query request, the identification information of the target physical storage node corresponding to the identification information may be determined in a conversion table maintained by the target logical storage node according to the identification information of the first target resource.
For example, with continuing reference to fig. 4, assuming that the logical storage node is the node 6, the implementation manner of the first conversion table may be as shown in fig. 6, and refer to fig. 6 as a schematic diagram of a conversion table provided by the embodiment of the present invention. As shown in fig. 6, the node 6 is configured as a theoretical storage node of the resource 2 and the resource 5, the conversion table of the node 6 maintains the correspondence relationship between the identification information k2 of the resource 2 and the identification information n20 of the node 20 and the correspondence relationship between the identification information k5 of the resource 5 and the identification information n12 of the node 12, that is, < k2, n20> items and < k5, n12>, and represents that the node 20 is a physical storage node of the resource 2, the resource 2 is actually stored on the node 20, the node 12 is a physical storage node of the resource 5, and the resource 5 is actually stored on the node 12. Furthermore, when the node 6 obtains the query request, that is, the physical storage node of the target resource can be determined through the self-maintained conversion table, for example, the target resource is the resource 2, the node 6 can determine the physical storage node of the resource 2 as the node 20 according to the conversion table.
S116, receiving a query response of the target logical storage node, wherein the query response contains the identification information of the target physical storage node.
And S117, acquiring the target resource from the target physical storage node according to the identification information of the target physical storage node.
It can be understood that, according to the obtained query response, the data requesting node 11 may obtain the target resource from the physical storage node according to the identification information of the physical storage node 13 in the query response, for example, the data requesting node 11 may download the target resource from the physical storage node to the local, and may also display the target resource through the physical storage node 13 without downloading the resource to the local, which is not limited herein.
Compared with the prior art, the resource query method provided by the embodiment of the invention has the difference that the resources in the prior art are required to be stored on the logic storage nodes configured for the resources, and the nodes can realize the purpose of rapidly and accurately querying the resources according to the maintained topological routing table with the chordal ring; in the embodiment of the invention, the nodes not only maintain the topological routing table with the chordal ring, but also maintain the conversion table which maintains the corresponding relation between the resources and the physical storage nodes for actually storing the resources, therefore, the resources in the embodiment of the invention do not need to be migrated to the logical storage nodes configured for the nodes, when the resource query requirement exists, the nodes can query the logical storage nodes of the resources according to the topological routing table with the chordal ring, and send query requests to the logical storage nodes, so that the logical storage nodes determine the actual storage nodes of the resources according to the maintained conversion table, and further the resources can be obtained from the physical storage nodes fed back by the logical storage nodes, thereby eliminating the data migration process in the prior art and simultaneously realizing the rapid query of the resources. When a Chord network is used for storage application of large-volume unstructured data such as images, the elimination of data migration will effectively reduce the application overhead of the system.
Optionally, in a scenario, the first node may further receive a query request from another node, and when a target resource identifier in the query request matches identification information in a storage table of the first node, it indicates that the target resource is stored on the first node, and the first node may directly send a query response to the other node to notify the other node that the target resource is on the first node, so that a possible implementation manner is given below on the basis of fig. 3, referring to fig. 7, where fig. 7 is one of schematic flow charts of another resource query method provided in an embodiment of the present invention, and the method further includes:
and S118, obtaining a query request.
In some possible embodiments, the query request may come from a node other than the first node in the distributed system; the query request may include identification information of a third target resource, different from the first target resource, where the identification information of the third target resource matches the identification information in the storage table of the first node, indicating that the third target resource is currently stored on the first node,
s119, sending a query response, wherein the query response comprises the identification information of the first node.
Optionally, in another scenario, when the first node receives the query request, and the identifier of the target resource in the query request is matched with the identifier information in the translation table of the first node, which indicates that the first node is a logical storage node of the target resource, the first node may determine a physical storage node of the target resource in the translation table maintained by the first node, and feed back a query response, so that another possible implementation is given below on the basis of fig. 3, referring to fig. 8, where fig. 8 is a second schematic flow chart of another resource query method provided in the embodiment of the present invention, and the method further includes:
and S120, obtaining a query request.
In some possible embodiments, the query request may come from a node other than the first node in the distributed system; the query request may include identification information of a second target resource, and different from the first target resource and the third target resource, the identification information of the second target resource matches the identification information in the conversion table of the first node, indicating that the first node is a logical storage node of the second target resource.
S121, inquiring a physical storage node for storing the second target resource in the conversion table of the first node according to the identification information of the second target resource.
S122, sending a query response, wherein the query response contains the identification information of the physical storage node of the second target resource.
It should be noted that the first node may be a data requesting node 11 and/or a physical storage node 13 and/or a logical storage node 12 as shown in fig. 2.
In a scenario, when the first node is the data requesting node 11 shown in fig. 2, the first node may be configured to perform steps S114 to S117, so that the first node can obtain the first target resource; alternatively, the first node may be the physical storage node 13 shown in fig. 2, and the first node may be configured to execute steps S118 to S119, and may provide the third target resource to the data requesting node; alternatively, when the first node may be the logical storage node 12 shown in fig. 2, the first node may be configured to execute steps S120 to S122, and may feed back the actual storage location of the second target resource to the data requesting node.
In another scenario, when the first node may be the data request node 11 and the physical storage node 13, the first node may be configured to execute steps S114 to S119 to achieve the purpose of obtaining the target resource, and may also feed back the actual storage location of the target resource to other data nodes; alternatively, the first node may be the logical storage node 12 which is the data requesting node 11 at the same time, and may be configured to perform steps S114 to S117 to obtain the target resource, and may be configured to perform steps S120 to S122 to feed back the actual storage location of the target resource to the data requesting node; alternatively, the first node may be the physical storage node 13 and the logical storage node 12 at the same time, and may be configured to perform steps S118 to S1197 to provide the target resource to the data requesting node, and may also be configured to perform steps S120 to S122 to feed back the actual storage location of the target resource to the data requesting node; alternatively, the first node is used as the data requesting node 11, the physical storage node 13 and the logical storage node 12 at the same time, and is configured to execute steps S114 to S122.
Alternatively, in order to be able to quickly locate the resource location during the resource query process, a storage table and a conversion table need to be established in advance for the first node. Therefore, an implementation manner for establishing the storage table and the conversion table is given below, on the basis of fig. 3, please refer to fig. 9, and fig. 9 is a third schematic flowchart of another resource query method provided by the embodiment of the present invention, where the method further includes:
and S110, establishing a storage table according to all local resources and the topological routing table with the chordal ring.
In the embodiment of the present invention, the storage table is used to maintain a correspondence between the identification information of the local resource stored by each node and the identification information of the logical storage node corresponding to the local resource. In a possible implementation manner, the first node may traverse all local resources stored by the node, look up the logical storage node "theoticaaddress" corresponding to each resource through the chordal ring topology routing table, and add the identification information of each resource and the item of the identification information of the logical storage node corresponding to the resource, that is, < key, theoticaaddress >, in the storage table, thereby completing the establishment of the storage table.
For example, with continuing reference to fig. 4, assuming that the first node is the node 20, and the resource 2 and the resource 8 are local resources stored on the node 20, and according to the chordal ring topology routing table maintained by the node 20, it is determined that the logical storage node of the node 2 is the node 6, and the logical storage node of the resource 8 is the node 12, the node 20 adds the items < k2, n6> and < k8, n12> in the storage table to maintain the correspondence between the resource 2 and the node 6 and the correspondence between the resource 8 and the node 12, thereby completing the establishment of the storage table, which may be represented in the form as shown in fig. 10, see fig. 10, and fig. 10 is a schematic diagram of a storage table provided by the embodiment of the present invention.
And S111, sending a first message to all the logic storage nodes in the storage table, wherein the first message is used for indicating all the logic storage nodes to generate the corresponding conversion tables.
It can be understood that the first message may include identification information of each resource and identification information of the first node in the storage table, and the logical storage node that receives the first message adds the identification information of the resource and the identification information of the first node to its own translation table, that is, adds an item < key, actuaddress >, where actuaddress is a node that sends the first message.
For example, referring to FIG. 10, continuing with the first node as node 20, if node 20 includes < k2, n6> entries and < k8, n12> entries in its stored table, node 20 may send a first message to node 6 and node 12, respectively. For the node 6, the first message may contain the identification information k2 of the resource 2 and the identification information of the node 20, after the node 6 obtains the first message, the < k2, n20> entries are added to the conversion table, and the conversion table shown in fig. 5 is generated; for the node 12, the first message may contain the identification information k5 of the resource 5 and the identification information of the node 20, and after the node 12 obtains the first message, the < k2, n20> entries are added to the translation table of the node 12.
And S112, receiving a second message sent by the second node.
In the embodiment of the present invention, since each node in the embodiment of the present invention maintains a conversion table, for a first node, in addition to sending a message to all logical storage nodes in a storage table in the process of establishing the storage table to assist all logical storage nodes in establishing a conversion table, a second message sent by a second node may be received to establish its own conversion table.
It is to be understood that the second node is a node other than the first node in the distributed system, the second message may include identification information of the local resource of the second node and identification information of the second node, and the first node is configured as a theoretical storage node of the local resource of the second node.
S113, establishing a conversion table of the first node according to the identification information of the local resource of the second node and the identification information of the second node.
For example, with reference to fig. 4, by taking the first node as the node 20 and the second node as the node 6 as an example, assuming that the node 6 stores the local resource 17, and the theoretical storage node of the resource 17 is the node 20 according to the chord protocol, the node 6 sends a second message to the node 20 when establishing its own storage table, where the second message includes the identification information of the resource 17 and the identification information of the node 6 to indicate that the node 20 adds the < k17, n6> entry in the conversion table maintained by itself.
It can be understood that when each node completes the establishment of its own storage table, the establishment of the conversion table of each node in the whole distributed system is also completed.
It should be noted that the first node may be a data requesting node 11 and/or a physical storage node 13 and/or a logical storage node 12 as shown in fig. 2. When it is one or more of the data requesting node 11, the physical storage node 13, and the logical storage node 12, it may be used to perform steps S123 to S131, and complete the updating of the storage table and the conversion table.
Alternatively, in order to cope with resource changes on the nodes, it is ensured that each node can update the conversion table and the storage table maintained by itself in time, and the following provides an implementation manner of updating the storage table and the conversion table in the following scenario.
Scene one
On the basis of fig. 9, referring to fig. 11, fig. 11 is a fourth schematic flowchart of another resource query method provided by the embodiment of the present invention, where the method further includes:
and S123, when the first node has the newly added resource, determining a logic storage node of the newly added resource in the topological routing table with the chordal ring according to the identification information of the newly added resource.
In some possible embodiments, the first node may periodically scan stored local resources, and if a certain resource is locally stored but no record related to the resource exists in a storage table maintained by the first node, it may be determined that a newly added resource exists locally, and at this time, a logical storage node corresponding to the newly added resource may be determined according to a chordal ring topology routing table.
And S124, updating the identification information of the newly added resource and the identification information of the logic storage node of the newly added resource to a storage table.
For example, referring to fig. 4, assuming that the first node is a node 20, when the node 20 determines that a newly added resource 3 locally exists, determining that the theoretical storage address of the newly added resource 3 is a node 6 according to the query rule of the chordal ring topology routing table, adding an item < k3, n6> to the storage table of the node 20, and completing the update of the storage table.
And S125, sending an updating message to the logic storage node of the newly added resource.
It is understood that the update message is used to instruct the logic storage node of the newly added resource to update the identification information of the newly added resource and the identification information of the first node to their corresponding conversion tables.
For example, continuing to take the first node as the node 20 as an example, after the node 20 updates the identification information k3 of the newly added resource 3 and the identification information n6 of the node 6 to the storage table, an update message may be sent to the node 6, where the update message may include the identification information k3 of the newly added resource 3 and the identification information n20 of the node 20, so as to instruct the node 6 to add the < k3, n20> item to the conversion table, thereby completing the updating of the conversion table.
Optionally, in some possible embodiments, when the first node is configured as a logical storage node of a newly added resource on another storage node, the first node may further update a conversion table maintained by the first node according to update information of the other node, where an implementation is given below on the basis of fig. 9, referring to fig. 12, where fig. 12 is a fifth schematic flowchart of a resource query method provided in an embodiment of the present invention, and the method further includes:
s126, receiving an update message of the second node, wherein the update message comprises identification information of the newly added resource and identification information of the second node.
And S127, updating the identification information of the newly added resource and the identification information of the second node to the conversion table of the first node.
For example, referring to fig. 4, assuming that the first node is node 20 and the second node is node 6, when the newly added resource 17 exists on node 6 and the newly added resource 17 should theoretically be stored on node 20, node 20 may receive an update message sent from node 6, and update the identification information of resource 17 and node 6 into the conversion table of node 20, i.e. add < k17, n6> item in the table.
Scene two
Another updating method is given below, on the basis of fig. 9, referring to fig. 13, fig. 13 is a sixth schematic flowchart of another resource query method provided in the embodiment of the present invention, where the method further includes:
s128, when the first node deletes the local resource, the identification information of the deleted local resource and the identification information of the logic storage node of the deleted local resource are deleted in the storage table.
In some possible embodiments, the first node may periodically scan the storage table, and if the number of resource records in the storage table is greater than the number of locally stored resources, it indicates that the deleted resource exists, and at this time, redundant resource records in the storage table may be deleted, that is, the identification information of the deleted local resource and the identification information of the logical storage node corresponding to the deleted local resource are deleted, so as to complete updating of the storage table of the first node.
For example, referring to fig. 10, assuming that the first node is the node 20, and the storage table of the node 20 records the records of the resource 2 and the resource 8, but the local storage does not already contain the resource 2, it may be determined that the resource 2 is deleted by the first node, and at this time, the node 2 may delete the identification information k2 of the resource 2 and the identification information n6 of the node 6, and complete the update of the storage table of the node 20.
And S129, sending a deletion message to the deleted logic storage node of the local resource.
It is to be understood that the deletion message mentioned above is used to indicate that the logical storage node of the deleted local resource deletes the identification information of the deleted local resource and the identification information of the first node in its translation table.
For example, continuing with fig. 10, taking the first node as the node 20 as an example, assuming that the resource 2 is deleted, the node 20 deletes the identification information k2 of the node 2 and the identification information n6 of the node 6, and after the storage table update is completed, the node 2 may delete the identification information k2 of the resource 2 and the identification information n6 of the node 6, and may send a deletion message to the node 6 to instruct the node 6 to delete the identification information k2 of the node 2 and the identification information n6 of the node 20 in the conversion table which the node 6 maintains, so that the node 6 completes the update of the conversion table.
Optionally, in some possible embodiments, when the first node is configured as a logical storage node of a deleted resource on another storage node, the first node may further update a conversion table maintained by the first node according to deletion information of the other node, where an implementation is given below on the basis of fig. 9, referring to fig. 14, where fig. 14 is a seventh schematic flowchart of a resource query method provided by an embodiment of the present invention, and the method further includes:
and S130, receiving a deletion message of the second node.
It will be appreciated that the delete message comprises identification information of the deleted resource stored on the second node and identification information of the second node, the first node being configured as a theoretical storage node for the deleted resource.
S131, deleting the identification information of the deleted resource and the identification information of the second node in the conversion table of the first node.
For example, referring to fig. 4 and fig. 10, assuming that the first node is the node 20 and the second node is the node 6, when the node 6 deletes the local resource 17 stored therein, and the local resource 17 should be theoretically stored in the node 20, the node 6 sends a deletion message to the node 20, so that the node 20 deletes the identification information of the resource 17 and the node 6 in the conversion table maintained by itself, and completes the update of the conversion table of the node 20.
It should be noted that the first node may be a data requesting node 11 and/or a physical storage node 13 and/or a logical storage node 12 as shown in fig. 2. When it is any one of the data requesting node 11, the physical storage node 13, and the logical storage node 12, it can be used to execute steps S123 to S131, and complete the updating of the storage table and the conversion table.
For convenience of understanding the overall implementation flow of the technical solution of the present invention, signaling interaction during resource query of each node in a distributed system is provided below, referring to fig. 15, where fig. 15 is a signaling interaction diagram provided in an embodiment of the present invention. The first node, the second node and the third node are included, for convenience of understanding, the third node can be understood as a logic storage node in the first node storage table, and the second node can be understood as a physical storage node in the first node conversion table.
In one implementation manner, the resource query method in the embodiment of the present invention includes:
s1, the first node establishes a storage table according to all local resources and a topological routing table with a chordal ring.
S2, the first node sends a first message to the third node.
And S3, the second node generates a conversion table of the second node according to the identification information of the first node and the identification information of the local resource of the first node.
And S4, the first node receives a second message sent by the second node, wherein the second message comprises the identification information of the local resource of the second node and the identification information of the second node.
And S5, the first node generates a conversion table of the first node according to the identification information of the local resource of the second node and the identification information of the second node.
And S6, the first node determines a logic storage node in the topological routing table with the string ring according to the identification information of the target resource.
And S7, the first node sends a query request to the third node.
And S8, determining the identification information of the physical storage node corresponding to the identification information in a first conversion table maintained by the target resource according to the identification information of the target resource.
And S9, the third node sends a query response.
And S10, the first node acquires the target resource from the physical storage node according to the identification information of the physical storage node.
In another implementation manner, when the second node is a data request node, the resource query method in the embodiment of the present invention further includes:
s11, the second node sends a query request to the first node.
And S12, inquiring the physical storage node for storing the target resource in the second conversion table according to the identification information of the target resource.
And S13, the first node sends a query response to the second node.
In another implementation manner, when the third node is a data request node, the resource query method in the embodiment of the present invention further includes:
s14, the first node receives the query request sent by the third node.
S15, the first node queries the third node for response.
For the purpose of updating the storage table and the conversion table, a signaling interaction diagram is further provided below, referring to fig. 16, and fig. 16 is a signaling interaction diagram provided in an embodiment of the present invention. The method comprises a first node, a second node and a third node, wherein the third node can be understood as a logic storage node in a first node storage table, and the second node can be understood as a physical storage node in a first node conversion table, and the method further comprises the following steps:
and S16, when the first node has the newly added resource, determining a logic storage node corresponding to the newly added resource in the topological routing table with the chordal ring according to the identification information of the newly added resource.
And S17, updating the identification information of the newly added resource and the identification information of the logic storage node corresponding to the newly added resource to a storage table.
S18, the first node sends an updating message to the third node.
And S19, the third node updates the identification information of the newly added resource and the identification information of the first node to the first conversion table.
In another implementation, the first node may further receive a message sent by the second node to update its own storage table, that is, the method further includes:
s20, the second node updates the message to the first node.
And S21, the first node updates the identification information of the newly added resource and the identification information of the second node to a second conversion table.
In some possible embodiments, when the first node deletes the local resource, the first node needs to update its own storage table and instruct the third node to update its own conversion table, an implementation manner is given below, that is, the method further includes:
and S22, when the first node deletes the local resource, deleting the identification information of the deleted local resource and the identification information of the logic storage node corresponding to the deleted local resource in the storage table.
S23, the first node sends a deletion message to the third node.
S24, the third node deletes the identification information of the deleted local resource and the identification information of the first node in the first conversion table.
In other possible embodiments, when the local resource is deleted in the second node, the first node needs to be instructed to update its conversion table, which is implemented by the following method further including:
and S25, the second node deletes the message to the first node.
S26, the first node deletes the identification information of the deleted resource and the identification information of the second node in the second conversion table.
In order to implement the steps in the foregoing embodiments to achieve the corresponding technical effects, an implementation manner of a resource query apparatus is further provided below, referring to fig. 17, where fig. 17 is one of functional block diagrams of a resource query apparatus provided in an embodiment of the present invention, and includes a determining module 201, a communicating module 202, and an obtaining module 203.
A determining module 201, configured to determine a target logical storage node in a chordal ring topology routing table according to identification information of a first target resource; the topological routing table with the string ring is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the logic storage nodes; the target logical storage node is configured as a theoretical storage node for the first target resource;
a communication module 202, configured to send a query request to a target logical storage node; the query request is used for indicating the target logic storage node to query the target physical storage node in the conversion table of the target logic storage node; the conversion table is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the physical storage nodes; a first target resource is stored on a target physical storage node; receiving a query response of a target logic storage node, wherein the query response contains identification information of a target physical storage node;
the obtaining module 203 is configured to obtain the first target resource from the target physical storage node according to the identification information of the target physical storage node.
It is understood that the determining module 201, the communicating module 202 and the obtaining module 203 may be used to perform the above steps 114 to 117 to achieve the corresponding technical effect.
Optionally, the resource query apparatus 20 further includes an establishing module, configured to establish a storage table according to all local resources and the chordal ring topology routing table; the storage table is used for maintaining the corresponding relation between the identification information of the local resource and the identification information of the logic storage node corresponding to the local resource; the communication module is used for sending a first message to all the logic storage nodes in the storage table; the first message is used for indicating all the logic storage nodes to generate corresponding conversion tables; receiving a second message sent by a second node, wherein the second message comprises identification information of local resources of the second node and identification information of the second node; the first node is configured as a theoretical storage node for local resources of the second node; the second node is at least one node except the first node in the distributed system; the establishing module is further used for establishing a conversion table of the first node according to the identification information of the local resource of the second node and the identification information of the second node.
It is to be understood that the establishing module and the communication module 202 may be used to perform steps 110 to 113 to achieve the corresponding technical effect.
Optionally, the resource querying device 20 further includes an updating module, a determining module 201, configured to determine, when a newly added resource exists in the first node, a logic storage node of the newly added resource in the chordal ring topology routing table according to identification information of the newly added resource; the updating module is used for updating the identification information of the newly added resource and the identification information of the logic storage node of the newly added resource to a storage table; the communication module 202 is configured to send an update message to a logical storage node of the newly added resource; the update message is used for indicating the logic storage node of the newly added resource to update the identification information of the newly added resource and the identification information of the first node to the conversion table of the logic storage node of the newly added resource.
It is to be appreciated that the determination module 201, the update module and the communication module 202 may be utilized to perform steps 123 through 125 to achieve corresponding technical effects.
Optionally, the apparatus 20 further includes a deleting module, configured to delete, when the first node deletes the local resource, the identification information of the deleted local resource and the identification information of the logical storage node of the local resource in the storage table; a communication module 202, configured to send a deletion message to the deleted local resource; the deletion message is used to indicate that the deleted logical storage node of the local resource deletes the identification information of the deleted local resource and the identification information of the first node in the conversion table.
It will be appreciated that the deletion module and communication module 202 may be used to perform steps 128 to 129 to achieve corresponding technical effects.
Optionally, the communication module 202 is further configured to receive an update message of the second node, where the update message includes identification information of the newly added resource and identification information of the second node; the newly added resource is stored on the second node; and the updating module is also used for updating the identification information of the newly added resource and the identification information of the second node to the conversion table of the first node.
It will be appreciated that the communication module 202 and the update module may also be used to perform steps 126-127 to achieve corresponding technical effects.
Optionally, the communication module 202 is further configured to receive a deletion message of the second node, where the deletion message includes identification information of the deleted resource and identification information of the second node; the deleted resource is stored on the second node; the first node is configured as a theoretical storage node for deleted resources; and the deleting module is also used for deleting the identification information of the deleted resource and the identification information of the second node in the conversion table of the first node.
It is to be appreciated that the communication module 202 and the deletion module can also be utilized to perform steps 130-131 to achieve corresponding technical effects.
Optionally, the obtaining module 203 is further configured to obtain a query request; the query request comprises identification information of the second target resource; the identification information of the second target resource is positioned in the conversion table of the first node; the determining module 201 is further configured to query, in the translation table of the first node, a physical storage node storing the second target resource according to the identification information of the second target resource; the communication module 202 is further configured to send a query response, where the query response includes identification information of the physical storage node of the second target resource.
It is to be understood that the obtaining module 203, the determining module 201 and the communicating module 202 may also be used to perform steps 120 to 122 to achieve corresponding technical effects.
Optionally, the obtaining module 203 is further configured to obtain a query request; the query request comprises identification information of the third target resource; the identification information of the third target resource is matched with the identification information in the storage table of the first node; the communication module 202 is further configured to send a query response; the query response includes identification information of the first node.
It is to be appreciated that the obtaining module 203 and the communication module 202 may be configured to perform steps 118 through 119 to achieve corresponding technical effects.
Referring to fig. 18, fig. 18 is a second functional block diagram of a resource query apparatus according to an embodiment of the present invention, where the resource query apparatus 30 includes: an acquisition module 301, a query module 302, and a communication module 303.
An obtaining module 301, configured to obtain a query request; the query request includes identification information of the target resource.
A query module 302, configured to query a translation table of a first node for storing a target physical storage node according to the identification information of the target resource; the conversion table is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the physical storage nodes; the target resource is stored on the target physical storage node;
the communication module 303 is configured to send a query response, where the query response includes identification information of the target physical storage node.
It is understood that the obtaining module 301, the querying module 302 and the communication module 303 can be used to perform the above steps 110 to 113, 120 to 122 and 123 to 131 to achieve the corresponding technical effects.
Referring to fig. 19, fig. 19 is a third functional block diagram of a resource query apparatus according to an embodiment of the present invention, where the resource query apparatus 40 includes: an acquisition module 401 and a communication module 402.
An obtaining module 401, configured to obtain a query request; the query request comprises identification information of the target resource; the identification information of the target resource is positioned in a storage table of the first node; the storage table is used for maintaining the corresponding relation between the identification information of the local resource and the identification information of the logic storage node; the logic storage node is configured as a theoretical storage node of the local resource;
a communication module 402 for sending a query response; the query response includes identification information of the first node.
It is understood that the obtaining module 401 and the communication module 402 can be used to perform the above steps 110 to 113, 118 to 119, and 123 to 131 to achieve the corresponding technical effects.
An embodiment of the present invention further provides a node device, as shown in fig. 20, and fig. 20 is a block diagram illustrating a structure of the node device according to the embodiment of the present invention. The node device 50 includes a communication interface 501, a processor 502, and a memory 503. The processor 502, memory 503 and communication interface 501 are electrically connected to each other, directly or indirectly, to enable the transfer or interaction of data. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The memory 503 may be used for storing software programs and modules, such as program instructions/modules corresponding to the resource query method provided by the embodiment of the present invention, and the processor 502 executes various functional applications and data processing by executing the software programs and modules stored in the memory 503. The communication interface 501 may be used for communicating signaling or data with other node devices. The node apparatus 50 may have a plurality of communication interfaces 501 in the present invention.
The memory 503 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a programmable read-only memory (PROM), an erasable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), and the like.
The processor 502 may be an integrated circuit chip having signal processing capabilities. The processor may be a general-purpose processor including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, etc.
An embodiment of the present invention provides a storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the resource query method according to any one of the foregoing embodiments. The computer readable storage medium may be, but is not limited to, various media that can store program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a PROM, an EPROM, an EEPROM, a magnetic or optical disk, etc.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (15)

1. A resource query method is applied to a first node, wherein the first node is any one node in a distributed system, and the method comprises the following steps:
determining a target logic storage node in a topological routing table with a chordal ring according to the identification information of the first target resource; the topological routing table with the string ring is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the logic storage nodes; the target logical storage node is configured as a theoretical storage node for the first target resource;
sending a query request to the target logical storage node; the query request is used for indicating the target logic storage node to query a target physical storage node in a conversion table of the target logic storage node; the conversion table is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the physical storage nodes; the first target resource is stored on the target physical storage node;
receiving a query response of the target logical storage node, wherein the query response contains identification information of the target physical storage node;
and acquiring the first target resource from the target physical storage node according to the identification information of the target physical storage node.
2. The resource query method of claim 1, further comprising:
establishing a storage table according to all local resources and the topological routing table with the chordal ring; the storage table is used for maintaining the corresponding relation between the identification information of the local resource and the identification information of the logic storage node corresponding to the local resource;
sending a first message to all logical storage nodes in the storage table; the first message is used for indicating all the logic storage nodes to generate respective corresponding conversion tables;
receiving a second message sent by a second node, wherein the second message comprises identification information of local resources of the second node and identification information of the second node; the first node is configured as a theoretical storage node for local resources of the second node; the second node is at least one node except the first node in the distributed system;
and establishing a conversion table of the first node according to the identification information of the local resource of the second node and the identification information of the second node.
3. The resource query method of claim 2, further comprising:
when the first node has a newly added resource, determining a logic storage node of the newly added resource in the topological routing table with the chordal ring according to the identification information of the newly added resource;
updating the identification information of the newly added resource and the identification information of the logic storage node of the newly added resource to the storage table;
sending an updating message to the logic storage node of the newly added resource; and the update message is used for indicating the logic storage node of the newly added resource to update the identification information of the newly added resource and the identification information of the first node to the conversion table of the logic storage node of the newly added resource.
4. The resource query method of claim 2, further comprising:
when the first node deletes the local resource, deleting the identification information of the deleted local resource and the identification information of the logic storage node of the local resource in the storage table;
sending a deletion message to the deleted logical storage node of the local resource; the deletion message is used for indicating the deleted logic storage node of the local resource to delete the identification information of the deleted local resource and the identification information of the first node in a conversion table.
5. The resource query method of claim 3, further comprising:
receiving an update message of the second node, wherein the update message comprises identification information of newly added resources and identification information of the second node; the new resource is stored on the second node;
and updating the identification information of the newly added resource and the identification information of the second node to the conversion table of the first node.
6. The resource query method of claim 4, further comprising:
receiving a deletion message of the second node, wherein the deletion message comprises identification information of deleted resources and identification information of the second node; the deleted resource is stored on the second node; the first node is configured as a theoretical storage node for the deleted resource;
deleting the identification information of the deleted resource and the identification information of the second node in the conversion table of the first node.
7. The resource query method of claim 2, further comprising:
obtaining a query request; the query request comprises identification information of a second target resource; the identification information of the second target resource is positioned in a conversion table of the first node;
inquiring a physical storage node for storing the second target resource in a conversion table of the first node according to the identification information of the second target resource;
and sending a query response, wherein the query response contains the identification information of the physical storage node of the second target resource.
8. The resource query method of claim 2, further comprising:
obtaining a query request; the query request comprises identification information of a third target resource; the identification information of the third target resource is matched with the identification information in the storage table of the first node;
sending a query response; the query response includes identification information of the first node.
9. A resource query method is applied to a first node, wherein the first node is any one node in a distributed system, and the method comprises the following steps:
obtaining a query request; the query request comprises identification information of the target resource;
inquiring and storing a target physical storage node in a conversion table of the first node according to the identification information of the target resource; the conversion table is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the physical storage nodes; the target resource is stored on the target physical storage node;
and sending a query response, wherein the query response contains the identification information of the target physical storage node.
10. A resource query method is applied to a first node, wherein the first node is any one node in a distributed system, and the method comprises the following steps:
obtaining a query request; the query request comprises identification information of the target resource; the identification information of the target resource is positioned in a storage table of the first node; the storage table is used for maintaining the corresponding relation between the identification information of the local resource and the identification information of the logic storage node; the logical storage node is configured as a theoretical storage node for the local resource;
sending a query response; the query response includes identification information of the first node.
11. A resource query device is applied to a first node; the first node is any one node in a distributed system, and comprises:
the determining module is used for determining a target logic storage node in the topological routing table with the chordal ring according to the identification information of the first target resource; the topological routing table with the string ring is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the logic storage nodes; the target logical storage node is configured as a theoretical storage node for the first target resource;
the communication module is used for sending a query request to the target logic storage node; the query request is used for indicating the target logic storage node to query a target physical storage node in a conversion table of the target logic storage node; the conversion table is used for maintaining the corresponding relation between the identification information of the resources and the identification information of the physical storage nodes; the first target resource is stored on the target physical storage node; receiving a query response of the target logical storage node, wherein the query response contains identification information of the target physical storage node;
and the acquisition module is used for acquiring the first target resource from the target physical storage node according to the identification information of the target physical storage node.
12. A resource query device is applied to a first node; the first node is any one node in a distributed system, and comprises:
the acquisition module is used for acquiring a query request; the query request comprises identification information of the target resource; the identification information of the target resource is positioned in a storage table of the first node; the storage table is used for maintaining the corresponding relation between the identification information of the local resource and the identification information of the logic storage node; the logical storage node is configured as a theoretical storage node for the local resource;
the communication module is used for sending the inquiry response; the query response includes identification information of the first node.
13. A resource query device is applied to a first node, wherein the first node is any one node in a distributed system, and the resource query device comprises:
the acquisition module is used for acquiring a query request; the query request comprises identification information of the target resource; the identification information of the target resource is matched with the identification information in the storage table of the first node; the storage table is used for maintaining the corresponding relation between the identification information of the local resource of the first node and the identification information of the logic storage node corresponding to the local resource; the logical storage node is configured as a theoretical storage node for the local resource;
the communication module is used for sending the inquiry response; the query response includes identification information of the first node.
14. A node device comprising a processor and a memory, the memory storing machine executable instructions executable by the processor to implement the resource query method of any one of claims 1 to 8 and/or the resource query method of claim 9 and/or the resource query method of claim 10.
15. A storage medium on which a computer program is stored, which computer program, when being executed by a processor, carries out the resource query method of any one of claims 1 to 8 and/or the resource query method of claim 9 and/or the resource query method of claim 10.
CN202011566770.4A 2020-12-25 2020-12-25 Resource query method, device, node equipment and storage medium Active CN112612793B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011566770.4A CN112612793B (en) 2020-12-25 2020-12-25 Resource query method, device, node equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011566770.4A CN112612793B (en) 2020-12-25 2020-12-25 Resource query method, device, node equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112612793A true CN112612793A (en) 2021-04-06
CN112612793B CN112612793B (en) 2022-11-15

Family

ID=75248186

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011566770.4A Active CN112612793B (en) 2020-12-25 2020-12-25 Resource query method, device, node equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112612793B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113792079A (en) * 2021-11-17 2021-12-14 腾讯科技(深圳)有限公司 Data query method and device, computer equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101702020A (en) * 2009-10-22 2010-05-05 中国农业大学 Method and device for obtaining remotely sensed data based on grids
CN101788935A (en) * 2009-01-23 2010-07-28 英业达集团(天津)电子技术有限公司 Destroyed block processing method for redundant disk array system
CN110347656A (en) * 2019-06-27 2019-10-18 苏州浪潮智能科技有限公司 The management method and device requested in document storage system
CN111125089A (en) * 2019-11-05 2020-05-08 远景智能国际私人投资有限公司 Time sequence data storage method, device, server and storage medium
CN111651424A (en) * 2020-06-10 2020-09-11 中国科学院深圳先进技术研究院 Data processing method and device, data node and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101788935A (en) * 2009-01-23 2010-07-28 英业达集团(天津)电子技术有限公司 Destroyed block processing method for redundant disk array system
CN101702020A (en) * 2009-10-22 2010-05-05 中国农业大学 Method and device for obtaining remotely sensed data based on grids
CN110347656A (en) * 2019-06-27 2019-10-18 苏州浪潮智能科技有限公司 The management method and device requested in document storage system
CN111125089A (en) * 2019-11-05 2020-05-08 远景智能国际私人投资有限公司 Time sequence data storage method, device, server and storage medium
CN111651424A (en) * 2020-06-10 2020-09-11 中国科学院深圳先进技术研究院 Data processing method and device, data node and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113792079A (en) * 2021-11-17 2021-12-14 腾讯科技(深圳)有限公司 Data query method and device, computer equipment and storage medium
CN113792079B (en) * 2021-11-17 2022-02-08 腾讯科技(深圳)有限公司 Data query method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN112612793B (en) 2022-11-15

Similar Documents

Publication Publication Date Title
CN108228102B (en) Method and device for data migration between nodes, computing equipment and computer storage medium
JP6700308B2 (en) Data copy method and device
CN111352716B (en) Task request method, device and system based on big data and storage medium
WO2017020743A1 (en) Method and device for sharing cache data
US11394800B2 (en) Systems and methods for remote network topology discovery
CN109802951B (en) Message forwarding method, device and storage device
CN107172214B (en) Service node discovery method and device with load balancing function
JP2015509232A (en) Method and apparatus for messaging in the cloud
CN111327651A (en) Resource downloading method, device, edge node and storage medium
CN112612793B (en) Resource query method, device, node equipment and storage medium
JP4335907B2 (en) Method and apparatus for mobility churn processing for a peer-to-peer lookup system
US20220263759A1 (en) Addressing method, addressing system, and addressing apparatus
EP2375692A2 (en) Apparatus and method for registering node and searching for floating internet protocol address using distributed network
US10334025B2 (en) Adaptive query targeting in a dynamic distributed environment
US20240176762A1 (en) Geographically dispersed hybrid cloud cluster
CN111107039A (en) Communication method, device and system based on TCP connection
CN106790323B (en) Resource discovery method and device
US10708221B1 (en) Generating a natural name data structure to prevent duplicate network data associated with an asynchronous distributed network operating system
CN113542319A (en) Service providing entity change notification method, device and system used in Dubbo framework
CN110365723B (en) Asymmetric service discovery method and device
CN108683533B (en) Configuration updating method, configuration updating response method, server and system
US20220407838A1 (en) Service discovery and renaming
CN117420956A (en) Information processing method, device, equipment and computer storage medium
CN106953804B (en) Method and device for inquiring routing information of called user
CN110740198A (en) Neighbor table item management method and device, electronic equipment and machine-readable 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