CN114244744B - Node discovery method and device based on Internet of things equipment - Google Patents

Node discovery method and device based on Internet of things equipment Download PDF

Info

Publication number
CN114244744B
CN114244744B CN202111585596.2A CN202111585596A CN114244744B CN 114244744 B CN114244744 B CN 114244744B CN 202111585596 A CN202111585596 A CN 202111585596A CN 114244744 B CN114244744 B CN 114244744B
Authority
CN
China
Prior art keywords
node
internet
discovery
list
node list
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111585596.2A
Other languages
Chinese (zh)
Other versions
CN114244744A (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.)
Shanghai Molian Information Technology Co ltd
Original Assignee
Shanghai Molian Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Molian Information Technology Co ltd filed Critical Shanghai Molian Information Technology Co ltd
Priority to CN202111585596.2A priority Critical patent/CN114244744B/en
Publication of CN114244744A publication Critical patent/CN114244744A/en
Application granted granted Critical
Publication of CN114244744B publication Critical patent/CN114244744B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network

Abstract

The invention provides a node discovery method and device based on Internet of things equipment, wherein an adjacent node list, a discovery node list and an available node list are preset in the Internet of things equipment; the node discovery method comprises the following steps: the internet of things equipment requests neighbor node information by taking a node in the neighbor node list as a target node so as to acquire the neighbor node information of the target node; the internet of things device performs connectivity check on the acquired neighbor nodes of the target node, and writes neighbor node information of the target node passing the connectivity check into the discovery node list; the internet of things device performs availability detection on the nodes in the discovery node list, and writes node information in the discovery node list passing the availability detection into the available node list. According to the invention, a mechanism for node discovery is provided in the Internet of things equipment, and the equipment is automatically triggered to actively discover a new node under a certain condition, so that the equipment data uplink is completed.

Description

Node discovery method and device based on Internet of things equipment
Technical Field
The invention relates to the technical field of the Internet of things, in particular to a node discovery method and device based on Internet of things equipment.
Background
The blockchain can provide a trusted decentralised ledger for the data of the Internet of things equipment, so that the trusted data value is realized. The existing Internet of things equipment basically presets the existing node information, and the uplink actions are completed. And after the deployment of the Internet of things equipment is completed, the data uplink can be completed basically without manual operation.
The internet of things equipment has the characteristics of large quantity and wide distribution, once a preset node fails or a network has a problem, after a new node is deployed, corresponding node information cannot be updated into the equipment in time, so that a large number of internet of things equipment cannot finish data uplink, and corresponding account information is missing in an account on a chain.
Disclosure of Invention
The present invention is directed to a node discovery method and apparatus based on an internet of things device that, at least to some extent, overcomes one or more of the problems due to the limitations and disadvantages of the related art.
In order to achieve the above and other related objects, the present invention provides a node discovery method based on an internet of things device, where an adjacent node list, a discovery node list and an available node list are preset in the internet of things device;
the node discovery method based on the Internet of things equipment comprises the following steps:
the internet of things equipment requests neighbor node information by taking a node in the neighbor node list as a target node so as to acquire the neighbor node information of the target node;
the internet of things device performs connectivity check on the acquired neighbor nodes of the target node, and writes neighbor node information of the target node passing the connectivity check into the discovery node list;
the internet of things device performs availability detection on the nodes in the discovery node list, and writes node information in the discovery node list passing the availability detection into the available node list.
In one embodiment of the present invention, when the request of the neighboring node information by the internet of things device using each node in the neighboring node list as a target node is completed, or when the number of nodes in the discovery node list reaches a first preset value, the method is executed:
the internet of things device performs availability detection on the nodes in the discovery node list, and writes node information in the discovery node list passing the availability detection into the available node list.
In one embodiment of the invention, the first preset value is set to the length of the discovery node list.
In one embodiment of the present invention, the internet of things device performs connectivity check on the neighboring node of the target node, and writing the neighboring node information of the target node passing the connectivity check into the discovery node list includes:
and the Internet of things equipment sends a Ping message to the neighbor node of the target node, and writes neighbor node information of the target node which successfully returns the Ping message into the discovery node list.
In one embodiment of the invention, a root node list is preset in the internet of things equipment, and a plurality of root node information is stored in the root node list;
the internet of things device, before using a node in the neighbor node list as a target node, requests neighbor node information of the target node and writes the acquired neighbor node information of the target node into the discovery node list, further includes:
and writing the root node information in the root node list into the neighbor node list when the neighbor node list is in an initial state.
In one embodiment of the present invention, the internet of things device performing availability detection on the nodes in the discovery node list, and writing the node information in the discovery node list passing the availability detection into the available node list includes:
and circularly executing the steps that the Internet of things equipment detects the availability of the nodes in the discovery node list and writes the node information in the discovery node list passing the availability detection into the available node list until the availability detection of each node in the discovery node list is finished or the number of the nodes in the available node list reaches a second preset value.
In one embodiment of the invention, the second preset value is set to the length of the list of available nodes.
In one embodiment of the present invention, the available node list uses a data structure of a first-in first-out queue to store node information;
the node discovery method based on the internet of things equipment further comprises the following steps:
the internet of things equipment detects availability by outputting a node from the POP in the available node list according to a preset period;
when one node is unavailable from the POP in the available node list, judging whether the number of the nodes in the available node list is smaller than a third preset value or not;
when the number of nodes in the available node list is smaller than a third preset value, executing:
the internet of things device requests the neighbor node information of the target node by taking the node in the neighbor node list as the target node so as to acquire the neighbor node information of the target node;
the internet of things device performs connectivity check on the neighbor nodes of the target node, and writes neighbor node information of the target node passing the connectivity check into the discovery node list;
the internet of things device performs availability detection on the nodes in the discovery node list, and writes node information in the discovery node list passing the availability detection into the available node list.
In one embodiment of the present invention, the third preset value is 2.
In one embodiment of the present invention, when the number of nodes in the available node list is smaller than a third preset value, the following steps are performed according to a preset interval time cycle:
the internet of things device requests the neighbor node information of the target node by taking the node in the neighbor node list as the target node so as to acquire the neighbor node information of the target node;
the internet of things device performs connectivity check on the neighbor nodes of the target node, and writes neighbor node information of the target node passing the connectivity check into the discovery node list;
the internet of things device performs availability detection on the nodes in the discovery node list, and writes node information in the discovery node list passing the availability detection into the available node list.
In one embodiment of the present invention, the preset interval is set as follows: and gradually increasing, and keeping the fixed value unchanged after the fixed value is reached.
In one embodiment of the present invention, the node discovery method further includes:
when the node from the POP in the available node list is available, the node information is repulsed into the available node list.
In one embodiment of the present invention, the internet of things device performs availability detection on nodes in the discovery node list, and writes node information in the discovery node list passing the availability detection into the available node list, where the node information in the available node list is arranged according to a discovery order, and the node information discovered earlier is arranged later.
In one embodiment of the present invention, the internet of things device performing availability detection on the nodes in the discovery node list, and writing the node information in the discovery node list passing the availability detection into the available node list includes:
and the Internet of things equipment organizes RPC query messages according to the blockchain interface, sends the RPC query messages to the nodes in the discovery node list, and writes the nodes into the available node list if the result is successfully returned to indicate that the nodes are available.
In one embodiment of the present invention, the internet of things device requests the neighbor node information by using the node in the neighbor node list as the target node, so as to obtain the neighbor node information of the target node, where the neighbor node information of the target node includes RPCport and IP of the neighbor node of the target node.
In order to achieve the above object and other related objects, the present invention further provides a node discovery device based on an internet of things device, where an adjacent node list, a discovery node list and an available node list are preset in the internet of things device;
the node discovery device based on the Internet of things equipment comprises:
the adjacent point acquisition module is configured to request adjacent node information by the Internet of things equipment by taking a node in the adjacent node list as a target node so as to acquire the adjacent node information of the target node;
the connectivity checking module is configured to perform connectivity checking on the acquired neighbor nodes of the target node by the Internet of things equipment, and write neighbor node information of the target node passing the connectivity checking into the discovery node list;
the availability detection module is configured to perform availability detection on the nodes in the discovery node list by the Internet of things equipment, and write the node information in the discovery node list passing the availability detection into the available node list.
To achieve the above and other related objects, the present invention also provides an electronic device including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the above method when executing the computer program.
To achieve the above and other related objects, the present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the above method.
According to the node discovery method and device based on the Internet of things equipment, the mechanism of node discovery is provided in the Internet of things equipment, and the equipment is automatically triggered to actively discover new nodes to update the available node list under a certain condition, so that the data uplink process can be completed even if part of nodes fail.
According to the node discovery method and device based on the Internet of things equipment, all relevant Internet of things equipment can discover new nodes to update the available node list according to the set trigger conditions, and the nodes do not need to be updated one by one manually, so that the labor cost is greatly saved.
Drawings
Fig. 1 shows a flowchart of a node discovery method based on the internet of things device of the present invention.
Fig. 2 illustrates a flow chart of node discovery of an internet of things device in one specific example of the invention.
Fig. 3 shows a schematic diagram of requesting neighbor node information by using a node in the neighbor node list as a target node by an internet of things device in node discovery based on the internet of things device to obtain a neighbor node of the target node.
Fig. 4 shows a trigger policy map based on node discovery of an internet of things device according to the present invention.
Fig. 5 shows a functional block diagram of the node discovery apparatus of the internet of things device of the present invention.
Fig. 6 shows a schematic structural diagram of an electronic device according to the node discovery method based on the internet of things device of the present invention.
Detailed Description
Other advantages and effects of the present invention will become apparent to those skilled in the art from the following disclosure, which describes the embodiments of the present invention with reference to specific examples. The invention may be practiced or carried out in other embodiments that depart from the specific details, and the details of the present description may be modified or varied from the spirit and scope of the present invention.
Please refer to fig. 1-6. It should be noted that, the illustrations provided in the present embodiment merely illustrate the basic concept of the present invention by way of illustration, and only the components related to the present invention are shown in the drawings and are not drawn according to the number, shape and size of the components in actual implementation, and the form, number and proportion of the components in actual implementation may be arbitrarily changed, and the layout of the components may be more complex.
Fig. 1 shows a flowchart of a node discovery method based on the internet of things device of the present invention. The Internet of things equipment is terminal equipment with a network (such as cellular, wiFi, bluetooth, zigbee, loRa and the like) access function, can collect and process information of objects, and supports data communication.
In order to realize the node discovery process based on the internet of things device, a root node list, a neighbor node list, a discovery node list and an available node list can be preset in the internet of things device and are respectively used for storing node information in different steps in the node discovery process, and the length (also called capacity) m of the neighbor node list, the length (also called capacity) n of the discovery node list and the length (also called capacity) k of the available node list can be set according to actual requirements.
The root node list is preset with a plurality of root node information; the neighbor node list is used for storing target node information, and the internet of things equipment can request the neighbor node information for a target node by taking the node in the neighbor node list as the target node to acquire the neighbor node of the target node, wherein the node in the neighbor node list can be the root node information in a pre-written root node list or the node information which is subsequently acquired and written from the discovery node list; the discovery node list is used for storing neighbor node information of the target node passing the connectivity check; the available node list is used for storing node information in the discovery node list through which the availability detection passes.
Referring to fig. 1, the node discovery method based on the internet of things device includes:
step S10, the Internet of things equipment requests neighbor node information by taking a node in the neighbor node list as a target node so as to acquire the neighbor node information of the target node;
step S20, the Internet of things equipment performs connectivity check on the acquired neighbor nodes of the target node, and writes neighbor node information of the target node passing the connectivity check into the discovery node list;
and step S30, the Internet of things equipment detects the availability of the nodes in the discovery node list, and writes the node information in the discovery node list passing the availability detection into the available node list.
By providing a mechanism for node discovery in the internet of things equipment, the equipment is automatically triggered to actively discover new nodes to update the self available node list under a certain condition, and the data uplink process can be completed even if part of nodes fail.
Firstly, step S10 is executed, where the internet of things device requests neighboring node information by using a node in the neighboring node list as a target node, so as to obtain the neighboring node information of the target node. The internet of things device may request the neighbor node information by using the node in the neighbor node list as the target node according to the message and flow of the discovery node in the existing blockchain, and perform the loop for several times (for example, 8 times) to obtain the neighbor node information of the target node.
It should be noted that, the neighbor node list is empty in the initial state, and no node information is stored therein, so before the internet of things device requests the neighbor node information by taking the node in the neighbor node list as the target node, the internet of things device needs to write the pre-stored root node information in the root node list into the neighbor node list.
Fig. 3 shows a schematic diagram of requesting, by an internet of things device, neighbor node information by using a node in the neighbor node list as a target node in node discovery based on the internet of things device, so as to obtain a neighbor node of the target node. When the target node discovers the neighbor node, the target node needs to acquire the RPCport of the neighbor node and the available identifier of the RPC, when the target node inquires the RPCport of the neighbor node and the available identifier of the RPC, the target node needs to send an RPC message to interact with the corresponding neighbor node to confirm whether the corresponding neighbor node is really available, so that unavailable neighbor nodes are filtered out, the target node returns the information of all the really available neighbor nodes to the local node LocalID of the Internet of things equipment, and the Internet of things equipment stores the received neighbor node information in a discovery node list. In this way, the node information such as the IP address (Internet Protocol Address ), the node ID, the UDP (User Datagram Protocol, user datagram protocol) port number, the TCP (Transmission Control Protocol ) port number, the RPCport (Remote Procedure Call Port, remote procedure call port), the RPCflag of the neighboring node can be queried, and the internet of things device can complete data uplink according to the node information. And the availability detection of the target node to the adjacent node can reduce the calculated amount of the Internet of things equipment in the step S30, and is beneficial to power saving and flow saving of the Internet of things equipment.
Of course, in some embodiments, when the target node queries whether the RPCport of the neighboring node and the RPC is available, the target node may directly return the acquired neighboring node of the target node to the local node LocalID of the internet of things device and store the local node LocalID in the discovery node list without sending the RPC packet to interact with the corresponding neighboring node to confirm whether the corresponding neighboring node is actually available, and the internet of things device performs node availability detection in step S30.
And then, executing a step S20, wherein the Internet of things equipment performs connectivity check on the acquired neighbor nodes of the target node, and writes neighbor node information of the target node passing the connectivity check into the discovery node list. Specifically, after obtaining the neighbor node information of the target node, connectivity checking needs to be performed on the obtained neighbor node of the target node to determine the connectivity of the obtained neighbor node of the target node, and then the neighbor node of the target node passing the connectivity checking is written into the discovery node list.
As an example, the internet of things device sends a Ping message to the neighboring node of the target node, and writes neighboring node information of the target node that successfully returns the Ping message into the discovery node list. The step of performing connectivity check on the acquired neighbor nodes of the target node may be performed several times in a loop (the number of times of performing configuration loop may be performed according to the actual situation, for example, 8 times).
It should be noted that, in the node discovery process of the one-time internet of things device, the steps of step S10 and step S20 are generally required to be performed repeatedly until the internet of things device finishes requesting for the information of the neighboring node by taking each node in the neighboring node list as a target node, or stops performing when the number of nodes in the discovery node list reaches a first preset value. The first preset value may be set, for example, to the length of the discovery node list or to a reasonable value that is smaller than the length of the discovery node list.
And executing step S30, wherein the Internet of things equipment detects the availability of the nodes in the discovery node list and writes the node information in the discovery node list passing the availability detection into the available node list. Specifically, the internet of things device may sequentially perform availability detection on the nodes in the discovery node list, and write the node information in the discovery node list passing the availability detection into the available node list, where the node information in the available node list is arranged according to the discovery order, and the node information discovered earlier is arranged later, where the available node list may store the available node information using, for example, a data structure of a first-in-first-out queue (FIFO, first In First Out). Of course, the internet of things device may perform availability detection on each node in the discovery node list in a random manner, and write node information in the discovery node list passing the availability detection into the available node list.
As an example, when the internet of things device performs availability detection on a node in the discovery node list, the internet of things device may, for example, organize a query message (e.g., an RPC query message) according to a block link port, send the query message to a node in the discovery node list, and if a result is successfully returned, indicate that the node is available, write the node into the available node list.
It should be noted that, in the node discovery process of the one-time internet of things device, step S30 is generally performed repeatedly until the availability of each node in the discovery node list is detected or the number of nodes in the available node list reaches a second preset value. The second preset value may for example be set to the length of the list of available nodes or to a reasonable value smaller than the length of the list of available nodes. It should be noted that, in an alternative embodiment, after the loop execution of step S10 and step S20 is completed, the method may further include a step of writing the information of a plurality of nodes in the discovery node list into the neighbor node list, and waiting for the next round of node discovery process, so as to increase the randomness of selecting the target node during the discovery of the neighbor node.
Based on the consideration of power consumption and flow consumption, the Internet of things equipment starts to execute the node discovery process of the Internet of things equipment only when the triggering condition is met.
Fig. 4 shows a trigger policy diagram of a node discovery procedure of an internet of things device of the present application. The triggering strategy of the node discovery process of the internet of things equipment is as follows:
(1) And the Internet of things equipment detects availability of a node from the POP in the available node list according to a preset period, for example, the node k is subjected to PUSH again into the node information queue of the available node list when the node k is available, and if the node k is unavailable, whether the number of the nodes in the available node list is smaller than a third preset value is judged.
(2) When the number of the nodes in the available node list is smaller than a third preset value, indicating that the node resources in the available node list are tense, and triggering a node discovery process of the Internet of things equipment is required, namely executing steps S10-S30 to write new available nodes into the available node list; and when the number of the nodes in the available node list is larger than or equal to a third preset value, continuing to wait for node availability detection in the next period.
It should be noted that, the third preset value may be set to, for example, 2, or a reasonable value that is greater than 2 and less than the length of the available node list; the preset period may be configured according to actual needs, and may be set to, for example, 1 day, one week, one month, or other reasonable values, such as one day.
It should be noted that, when the number of nodes in the available node list is smaller than the third preset value, after the node discovery process of the internet of things device is triggered, considering that the node discovery process of the internet of things device passing once is generally unable to write full of the available node list, the node discovery process of the internet of things device needs to be executed in a circulating manner according to a preset interval time, that is, steps S10-S30 are executed in a circulating manner until the available node list is written full.
The preset interval time may be set as follows in consideration of the problems of power consumption and traffic consumption: the method comprises the steps of gradually increasing, and keeping the fixed value unchanged after the fixed value is reached. Taking fig. 4 as an example, the preset intervals may be, for example, 10 minutes, 20 minutes, 40 minutes, 1 hour, 2 hours, 4 hours, 8 hours, 16 hours, one day, and one day … …, respectively, and in other embodiments, the preset intervals may be performed at fixed intervals or other variable intervals.
In order to more clearly illustrate the node discovery method of the internet of things device of the present invention, fig. 2 shows a flowchart of node discovery of the internet of things device in a specific example. Referring to fig. 2, the internet of things device presets a root node list, a neighbor node list, a discovery node list and an available node list, which are respectively used for storing node information in different steps in the node discovery process. The length (also called capacity) of the neighbor node list is m, and the value of m can be 30; the length of the node list (also referred to as capacity) is found to be n, the value of n may be 60, the length of the available node list (also referred to as capacity) is k, and the value of k may be 10, for example. The node discovery process of the Internet of things equipment is as follows:
(1) A preset root node list, which may include 5 root nodes of a blockchain network (e.g., a taifang foundation);
(2) In the initial state, as shown in step 1-1, the root node information in the root node list is written into the neighbor node list;
(3) 2-1, according to the message and flow of the block chain discovery node, using the node in the neighbor node list as a target node, requesting neighbor node information, and cycling for 8 times (configurable) until the neighbor node information is returned;
(4) 2-2, after receiving the information of the adjacent nodes, performing connectivity check, sending Ping messages to the adjacent nodes, and if the Ping messages are returned, writing into a discovery node list; this check cycle 3 is performed (configurable);
(5) Step 2-1 and step 2-2 are executed for a plurality of times until the node in the neighbor node list is executed or the node list is found to be full;
(6) After the step 2-1 and the step 2-2 are executed, the first 30 nodes in the discovery node list can be written into the adjacent node list as shown in the step 2-3, and the next round of node discovery process is waited for, so that the randomness is increased;
(7) As shown in step 3-1, an RPC query message is organized according to a blockchain interface (e.g., ethernet JSON-rpcaps interface), and sequentially sent to nodes in a sending node list, and the nodes wait for a return result, if the return is successful, the nodes are considered to be available, the available node list is written, and if a return error, such as timeout, link failure, etc., the nodes are considered to be unavailable, the step is circulated 3 times (configurable) until the sending node list is verified or the available node list is full.
(8) The corresponding steps in (3) - (7) may be performed in a cyclic manner with a certain period as shown in fig. 4.
According to the node discovery method based on the Internet of things equipment, the node discovery mechanism is provided in the Internet of things equipment, and the equipment is automatically triggered to actively discover new nodes to update the available node list under a certain condition, so that the data uplink process can be completed even if part of nodes fail. According to the node discovery method based on the Internet of things equipment, all relevant Internet of things equipment can discover new nodes according to the set trigger conditions to update the available node list of the equipment, and the equipment does not need to be manually updated one by one, so that the labor cost is greatly saved.
It should be noted that, the above steps of the methods are divided, for clarity of description, and may be combined into one step or split into multiple steps when implemented, so long as they contain the same logic relationship, and they are all within the protection scope of the present patent; it is within the scope of this patent to add insignificant modifications to the algorithm or flow or introduce insignificant designs, but not to alter the core design of its algorithm and flow.
Fig. 5 is a functional block diagram of a preferred embodiment of the node discovery apparatus 11 of the present invention. The node discovery apparatus 11 includes: an initialization module 111, an adjacent point acquisition module 112, a connectivity check module 113, an availability detection module 114 and a trigger module 115. The module referred to in the present invention refers to a series of computer program segments capable of being executed by the processor 13 and of performing a fixed function, which are stored in the memory 12.
The initialization module 111 is configured to write pre-stored root node information in a root node list into the neighbor node list; the adjacent point obtaining module 112 is configured to request adjacent node information by using a node in the adjacent node list as a target node by using the internet of things device, so as to obtain the adjacent node information of the target node; the connectivity checking module 113 is configured to perform connectivity checking on the obtained neighboring node of the target node by using the internet of things device, and write neighboring node information of the target node that passes the connectivity checking into the discovery node list; the availability detection module 114 is configured to perform availability detection on nodes in the discovery node list by using the internet of things device, and write node information in the discovery node list passing the availability detection into the available node list; the triggering module 115 is configured to detect the availability of the last node in the list of available nodes according to a preset period. Deleting the node information when the last node in the available node list is unavailable, and judging whether the number of the nodes in the available node list is smaller than a third preset value or not; and when the last node in the available node list is available, moving the node information to the forefront of the available node list, and sequentially shifting other node information forward. And triggering a node discovery process of the Internet of things equipment when the number of the nodes in the available node list is smaller than a third preset value.
Note that, the node discovery apparatus of this embodiment is an apparatus corresponding to the above-described node discovery method, and the functional modules in the node discovery apparatus or the respective steps in the node discovery method correspond to each other. The node discovery apparatus of this embodiment may be implemented in conjunction with the node discovery method. Accordingly, the related technical details mentioned in the node discovery method of the present embodiment may also be applied in the node discovery apparatus, and in order to reduce repetition, a detailed description is omitted here.
Fig. 6 is a schematic structural diagram of an electronic device according to a preferred embodiment of the present invention for implementing the node discovery method.
The electronic device 1 may comprise a memory 12, a processor 13 and a bus, and may further comprise a computer program, such as a node discovery program, stored in the memory 12 and executable on the processor 13.
The memory 12 includes at least one type of readable storage medium including flash memory, a removable hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc.
The processor 13 executes the operating system of the electronic device 1 and various types of applications installed. The processor 13 executes the application program to implement the steps of the various node discovery method embodiments described above, such as the steps shown in fig. 4.
Illustratively, the computer program may be split into one or more modules that are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules may be a series of instruction segments of a computer program capable of performing a specific function for describing the execution of the computer program in the electronic device 1. For example, the computer program may be divided into an initialization module 111, a neighbor acquisition module 112, a connectivity check module 113, an availability detection module 114 and a trigger module 115.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The above embodiments are only for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made thereto without departing from the spirit and scope of the technical solution of the present invention.

Claims (14)

1. The node discovery method based on the Internet of things equipment is characterized in that the node is a blockchain node; the Internet of things equipment is preset with a root node list, a neighbor node list, a discovery node list and an available node list, wherein a plurality of root nodes are stored in the root node list;
the node discovery method based on the Internet of things equipment comprises the following steps:
step S10, the Internet of things equipment requests neighbor node information by taking a node in the neighbor node list as a target node so as to acquire the neighbor node information of the target node;
step S20, the Internet of things equipment performs connectivity check on the acquired neighbor nodes of the target node, and writes neighbor node information of the target node passing the connectivity check into the discovery node list;
step S30, the Internet of things equipment detects the availability of the nodes in the discovery node list, and writes the node information in the discovery node list passing the availability detection into the available node list;
and writing the root node information in the root node list into the neighbor node list when the neighbor node list is in an initial state.
2. The node discovery method based on the internet of things device according to claim 1, wherein when the internet of things device requests neighboring node information by using each node in the neighboring node list as a target node, performing connectivity check on the acquired neighboring node of the target node, and writing the neighboring node information of the target node passing the connectivity check into the discovery node list, until the internet of things device finishes requesting the neighboring node information by using each node in the neighboring node list as a target node, or when the number of nodes in the discovery node list reaches a first preset value, executing:
the internet of things device performs availability detection on the nodes in the discovery node list, and writes node information in the discovery node list passing the availability detection into the available node list.
3. The node discovery method based on the internet of things device according to claim 2, wherein the first preset value is set to a length of the discovery node list.
4. The node discovery method based on the internet of things device according to claim 1, wherein the internet of things device performs connectivity check on the neighboring node of the target node, and writing the neighboring node information of the target node passing the connectivity check into the discovery node list includes:
and the Internet of things equipment sends a Ping message to the neighbor node of the target node, and writes neighbor node information of the target node which successfully returns the Ping message into the discovery node list.
5. The node discovery method based on the internet of things device according to claim 1, wherein the internet of things device performs availability detection on nodes in the discovery node list, and writing node information in the discovery node list through which the availability detection passes into the available node list includes:
and circularly executing the steps that the internet of things equipment sequentially carries out availability detection on the nodes in the discovery node list and writes the node information in the discovery node list passing the availability detection into the available node list until the availability detection of each node in the discovery node list is finished or the number of the nodes in the available node list reaches a second preset value.
6. The node discovery method based on the internet of things device according to claim 5, wherein the second preset value is set to a length of the available node list.
7. The node discovery method based on the internet of things device according to claim 1, wherein the available node list stores node information by adopting a data structure of a first-in first-out queue;
the node discovery method based on the internet of things equipment further comprises the following steps:
the internet of things equipment detects availability by outputting a node from the POP in the available node list according to a preset period;
when one node is unavailable from the POP in the available node list, judging whether the number of the nodes in the available node list is smaller than a third preset value or not;
and when the number of the nodes in the available node list is smaller than a third preset value, executing steps S10-S30.
8. The node discovery method based on the internet of things device according to claim 7, wherein when the number of nodes in the available node list is smaller than a third preset value, steps S10 to S30 are cyclically executed according to a preset interval time.
9. The node discovery method based on the internet of things device according to claim 8, wherein the preset interval is set as follows: and gradually increasing, and keeping the fixed value unchanged after the fixed value is reached.
10. The node discovery method based on the internet of things device according to claim 7, further comprising:
and when the node from the POP in the available node list is available, the node is re-pushed into a node information queue of the available node list.
11. The node discovery method based on the internet of things device according to claim 1, wherein the internet of things device performs availability detection on nodes in the discovery node list, and writing node information in the discovery node list through which the availability detection passes into the available node list includes:
and the Internet of things equipment organizes RPC query messages according to the blockchain interface, sends the RPC query messages to the nodes in the discovery node list, and writes the node information into the available node list if the result is successfully returned to indicate that the nodes are available.
12. The node discovery method based on the internet of things device according to claim 1, wherein the internet of things device requests neighbor node information by using a node in the neighbor node list as a target node, so as to obtain neighbor node information of the target node, wherein the neighbor node information of the target node includes RPCport and IP address of the neighbor node of the target node.
13. The node discovery method based on the internet of things device according to claim 1, further comprising writing at least part of node information in the discovery node list into the neighbor node list.
14. The node discovery device based on the Internet of things equipment is characterized in that the node is a blockchain node; the Internet of things equipment is preset with a root node list, a neighbor node list, a discovery node list and an available node list, wherein a plurality of root nodes are stored in the root node list;
the node discovery device based on the Internet of things equipment comprises:
the adjacent point acquisition module is configured to request adjacent node information by the Internet of things equipment by taking a node in the adjacent node list as a target node so as to acquire the adjacent node information of the target node;
the connectivity checking module is configured to perform connectivity checking on the acquired neighbor nodes of the target node by the Internet of things equipment, and write neighbor node information of the target node passing the connectivity checking into the discovery node list;
the availability detection module is configured to detect the availability of the nodes in the discovery node list by the Internet of things equipment and write the node information in the discovery node list passing the availability detection into the available node list;
and writing the root node information in the root node list into the neighbor node list when the neighbor node list is in an initial state.
CN202111585596.2A 2021-12-22 2021-12-22 Node discovery method and device based on Internet of things equipment Active CN114244744B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111585596.2A CN114244744B (en) 2021-12-22 2021-12-22 Node discovery method and device based on Internet of things equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111585596.2A CN114244744B (en) 2021-12-22 2021-12-22 Node discovery method and device based on Internet of things equipment

Publications (2)

Publication Number Publication Date
CN114244744A CN114244744A (en) 2022-03-25
CN114244744B true CN114244744B (en) 2024-04-05

Family

ID=80761673

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111585596.2A Active CN114244744B (en) 2021-12-22 2021-12-22 Node discovery method and device based on Internet of things equipment

Country Status (1)

Country Link
CN (1) CN114244744B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104509033A (en) * 2012-03-27 2015-04-08 爱立信(中国)通信有限公司(中国) Shared keep-alive and failure detection mechanisms in distributed network
CN106358261A (en) * 2016-09-09 2017-01-25 南方电网科学研究院有限责任公司 Building method and system of wireless self-organizing network
CN108323232A (en) * 2017-05-16 2018-07-24 北京大学深圳研究生院 The maintaining method of index and chain topological structure between a kind of multi-layer block catenary system
CN111131484A (en) * 2019-12-30 2020-05-08 深圳市网心科技有限公司 Node mounting method, device, network node and storage medium
CN111600769A (en) * 2020-07-27 2020-08-28 腾讯科技(深圳)有限公司 Site detection method and device and storage medium
CN113794618A (en) * 2021-09-17 2021-12-14 北京奥特雷柏科技有限公司 Redundant network communication method and device based on virtual network card and terminal equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2603720C (en) * 2004-11-05 2016-05-17 Kabushiki Kaisha Toshiba Network discovery mechanisms

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104509033A (en) * 2012-03-27 2015-04-08 爱立信(中国)通信有限公司(中国) Shared keep-alive and failure detection mechanisms in distributed network
CN106358261A (en) * 2016-09-09 2017-01-25 南方电网科学研究院有限责任公司 Building method and system of wireless self-organizing network
CN108323232A (en) * 2017-05-16 2018-07-24 北京大学深圳研究生院 The maintaining method of index and chain topological structure between a kind of multi-layer block catenary system
CN111131484A (en) * 2019-12-30 2020-05-08 深圳市网心科技有限公司 Node mounting method, device, network node and storage medium
CN111600769A (en) * 2020-07-27 2020-08-28 腾讯科技(深圳)有限公司 Site detection method and device and storage medium
CN113794618A (en) * 2021-09-17 2021-12-14 北京奥特雷柏科技有限公司 Redundant network communication method and device based on virtual network card and terminal equipment

Also Published As

Publication number Publication date
CN114244744A (en) 2022-03-25

Similar Documents

Publication Publication Date Title
US8762534B1 (en) Server load balancing using a fair weighted hashing technique
CN107395659A (en) A kind of method and device of service handling and common recognition
CN111880936B (en) Resource scheduling method, device, container cluster, computer equipment and storage medium
WO2015090245A1 (en) File transmission method, apparatus, and distributed cluster file system
CN107210924B (en) Method and apparatus for configuring a communication system
US9736235B2 (en) Computer system, computer, and load balancing method
CN110557416B (en) Multi-node collaborative blocking method and system
CN109104368B (en) Connection request method, device, server and computer readable storage medium
CN116566984B (en) Routing information creation method and device of k8s container cluster and electronic equipment
CN113992594B (en) Flow control method, flow control device, electronic equipment and computer readable storage medium
CN111163140A (en) Method, apparatus and computer readable storage medium for resource acquisition and allocation
CN110535776A (en) Gateway current-limiting method, device, gateway, system and storage medium
CN114244744B (en) Node discovery method and device based on Internet of things equipment
CN114268927A (en) Vehicle-mounted communication method, device, equipment and storage medium
CN106776032B (en) The treating method and apparatus of the I/O request of distributed block storage
CN109358820B (en) Data access method and device, electronic equipment and computer readable storage medium
CN112835605B (en) Block chain version gray scale upgrading verification method, device and system
CN109862089A (en) Data processing method, device, system, computer readable storage medium
CN110162415B (en) Method, server, device and storage medium for processing data request
CN115378855A (en) Data packet testing method and device, communication device and storage medium
CN104506440A (en) Data package transmitting method and routing list correcting method for router
CN110661655B (en) Cluster deployment method and system, electronic device and storage medium
CN107317880B (en) Method and device for realizing load balance
CN111309467A (en) Task distribution method and device, electronic equipment and storage medium
CN109240829A (en) For exchange chip application, manage exclusive resource method and device

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