CN110868318A - Method and device for generating network access relationship, electronic equipment and storage medium - Google Patents
Method and device for generating network access relationship, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN110868318A CN110868318A CN201911061780.XA CN201911061780A CN110868318A CN 110868318 A CN110868318 A CN 110868318A CN 201911061780 A CN201911061780 A CN 201911061780A CN 110868318 A CN110868318 A CN 110868318A
- Authority
- CN
- China
- Prior art keywords
- node
- access relationship
- access
- network
- query request
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 62
- 230000004044 response Effects 0.000 claims abstract description 56
- 238000004590 computer program Methods 0.000 claims description 7
- 230000004083 survival effect Effects 0.000 claims description 4
- 238000004364 calculation method Methods 0.000 abstract description 7
- 230000002776 aggregation Effects 0.000 abstract description 6
- 238000004220 aggregation Methods 0.000 abstract description 6
- 238000004891 communication Methods 0.000 description 14
- 238000010586 diagram Methods 0.000 description 5
- 230000005540 biological transmission Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/12—Discovery or management of network topologies
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/12—Network monitoring probes
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The embodiment of the invention provides a method, a device, electronic equipment and a storage medium for generating a network access relationship, wherein the method is used for a first node, the first node is used for representing any node in a network system, and the method comprises the following steps: determining a first network access relation of a first node, and generating and sending a first access relation query request according to the first network access relation; receiving a first access relationship query response sent by other nodes except the first node in the network system, wherein the first access relationship query response comprises a second network access relationship; and generating a third network access relation aiming at the network system according to the first network access relation and the second network access relation. Therefore, the invention can realize that any node in the network can generate the access relation among all nodes in the whole network, thereby avoiding obtaining the access relation among all nodes in the network only by the aggregation calculation of special equipment in the prior art and reducing the resource expense.
Description
Technical Field
The present invention relates to the field of network communication technologies, and in particular, to a method and an apparatus for generating a network access relationship, an electronic device, and a storage medium.
Background
A network is made up of nodes and links connecting the nodes, representing objects and their interrelationships.
In the prior art, the network access relationships between the nodes in the network are generated by dedicated generation equipment. Such as: the special generation equipment is a central control server in the server network, firstly, each server reports respective network packet capturing data to the central control server, then the central control server analyzes the reported network packet capturing data, aggregation calculation is carried out after information such as IP addresses and ports is obtained, and finally the central control server obtains access relations among the servers in the server network.
However, in a large-scale cluster or a network environment with a large data transmission amount, the access relationship between each node in the network is obtained only by the aggregation calculation of the dedicated generation device, and at this time, the calculation capability of the dedicated generation device becomes a performance bottleneck for generating the network access relationship, thereby reducing the generation efficiency of the network access relationship.
Disclosure of Invention
To solve the problems in the prior art, embodiments of the present invention provide a method and an apparatus for generating a network access relationship of a network access relationship, an electronic device, and a storage medium.
In a first aspect, an embodiment of the present invention provides a method for generating a network access relationship, where the method for generating a network access relationship is used for a first node, the first node is used to characterize any node in a network system, and the method for generating a network access relationship includes:
determining a first network access relationship of the first node, and generating a first access relationship query request according to the first network access relationship, wherein the first access relationship query request comprises a first node identifier for representing that the first node is an access relationship query party;
sending the first access relation query request to enable other nodes except the first node in the network system to determine a second network access relation of the other nodes according to the first access relation query request and return the second network access relation to the first node corresponding to the first node identifier;
receiving a first access relationship query response sent by the other node, wherein the first access relationship query response comprises the second network access relationship;
and generating a third network access relation aiming at the network system according to the first network access relation and the second network access relation.
Optionally, the first network access relationship includes one or more second nodes associated with the first node;
the sending the first access relationship query request includes:
and sending the first access relation query request to each second node, and forwarding the first access relation query request to nodes except the first node and the second node in the network system by the second nodes.
Optionally, the first access relationship query request further includes a first access relationship query sequence number; the first access relationship query sequence number and the first node identifier are used for the node receiving the first access relationship query request to judge whether the first access relationship query request is received for the first time.
Optionally, the receiving the first access relationship query response sent by the other node includes:
and receiving a first access relation query response sent by other nodes in a specified time period, wherein the specified time period comprises twice of the maximum message survival time (MSL) after the first access relation query request is sent.
Optionally, the method further comprises:
receiving a second access relation query request, wherein the second access relation query request comprises a second node identifier used for representing an access relation query party;
determining a fourth network access relation of the first node according to the second access relation query request;
adding the fourth network access relationship into a second access relationship query response, and sending the second access relationship query response to the node corresponding to the second node identifier, so that the node corresponding to the second node identifier generates the third network access relationship according to the fourth network access relationship;
if determining that a third node exists, wherein the third node is used for representing nodes which are except for the node sending the second access relation query request and are associated with the first node in the network system, forwarding the second access relation query request to the third node;
and if the third node does not exist, stopping forwarding the second access relation query request.
Optionally, the second access relationship query request further includes a second access relationship query sequence number; the determining a fourth network access relationship of the first node according to the second access relationship query request includes:
if the second access relationship query request is determined to be received for the first time according to the second access relationship query sequence number and the second node identifier, determining the fourth network access relationship according to the second access relationship query request;
and if the second access relation query request is determined not to be received for the first time according to the second access relation query sequence number and the second node identifier, not responding and forwarding the second access relation query request.
Optionally, the first node is deployed with a specified query tool and a specified agent, where the specified query tool and the specified agent are used to determine the first network access relationship, and the specified agent is further used to send the first access relationship query request and receive the first access relationship query response.
In a second aspect, an embodiment of the present invention provides an apparatus for generating a network access relationship, where the apparatus is used in a first node, and the first node is used to characterize any node in a network system, and the apparatus for generating a network access relationship includes:
the determining module is configured to determine a first network access relationship of the first node, and generate a first access relationship query request according to the first network access relationship, where the first access relationship query request includes a first node identifier used for representing that the first node is an access relationship querying party;
a sending module, configured to send the first access relationship query request, so that other nodes in the network system except the first node determine a second network access relationship according to the first access relationship query request, and return the second network access relationship to the first node corresponding to the first node identifier;
a receiving module, configured to receive a first access relationship query response sent by the other node, where the first access relationship query response includes the second network access relationship;
and the generating module is used for generating a third network access relation aiming at the network system according to the first network access relation and the second network access relation.
In a third aspect, an embodiment of the present invention further provides an electronic device, including:
at least one processor; and
at least one memory communicatively coupled to the processor, wherein:
the memory stores program instructions executable by the processor, which when called by the processor are capable of performing the above-described methods.
In a fourth aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium storing a computer program, which causes the computer to execute the above method.
In a fifth aspect, an embodiment of the present invention further provides a network system, which includes at least two first nodes, where the first nodes are configured to execute the foregoing method.
The method, the device, the electronic device and the storage medium for generating the network access relationship provided by the embodiments of the present invention determine the first network access relationship of the first node itself, generate the first access relationship query request according to the first network access relationship, send the first access relationship query request, and receive the first access relationship query response sent by other nodes except the first node in the network system, where the first access relationship query response includes the second network access relationship, and generate the third network access relationship for the network system according to the first network access relationship and the second network access relationship, thereby implementing that any node in the network can generate the access relationship between each node in the entire network, and thus avoiding obtaining the access relationship between each node in the network only by means of aggregation calculation of a dedicated device in the prior art, the resource overhead is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a method for generating a network access relationship according to an embodiment of the present invention;
fig. 2 is a schematic view of an application scenario of a method for generating a network access relationship according to an embodiment of the present invention;
fig. 3 is a schematic flow chart of another method for generating a network access relationship according to an embodiment of the present invention;
fig. 4 is a schematic flow chart of another method for generating a network access relationship according to an embodiment of the present invention;
fig. 5 is a schematic flow chart of another method for generating a network access relationship according to an embodiment of the present invention;
fig. 6 is a schematic flow chart of another method for generating a network access relationship according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a device for generating a network access relationship according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic 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. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 shows a flowchart of a method for generating a network access relationship provided in this embodiment, and fig. 2 shows an application scenario diagram of the method for generating a network access relationship provided in this embodiment; the method for generating the network access relationship may be applied to a first node (e.g., a workstation, a server, a terminal device, a network device, etc.), where the first node is used to characterize any node in a network system, and as shown in fig. 1, the method for generating the network access relationship may include the following steps:
s110, determining a first network access relationship of the first node, and generating a first access relationship query request according to the first network access relationship, wherein the first access relationship query request comprises a first node identifier (namely, a query party IP) for representing that the first node is an access relationship query party.
In this embodiment, the first node may be any node in the network system, which may be a query party for accessing the relationship.
Such as: as shown in fig. 2, the network system includes a server 1, a server 2, a server 3, a server 4, a server 5, and a server 6, and the first node may be any one of the server 1, the server 2, the server 3, the server 4, the server 5, and the server 6.
The first network access relationship may refer to an access relationship between the first node and another node, which is obtained by querying the network usage of the first node and then summarizing the network usage.
Such as: as shown in fig. 2, taking the server 2 as the first node as an example, querying the first network access relationship between itself and other servers includes:
between server 1 and server 2: the server 1 is a source node, and the server 2 is a destination node;
between server 3 and server 2: the server 2 is a source node, and the server 3 is a destination node;
between server 4 and server 2: the server 2 is a source node, and the server 4 is a destination node;
between server 6 and server 2: the server 6 is a source node and the server 2 is a destination node.
S120, sending a first access relation query request to enable other nodes except the first node in the network system to determine a second network access relation of the other nodes according to the first access relation query request and return the second network access relation to the first node corresponding to the first node identifier.
In this embodiment, the first node sends the first access relationship query request to other nodes except the first node in the network system, and the purpose of the first node is to allow the other nodes to provide the second network access relationship of the node for the first node, so that the first node can acquire the access relationships among all nodes in the whole network, and further generate a third network access relationship for the network system.
The second network access relationship may refer to an access relationship between the node and another node, which is obtained by querying a network usage of the node, and then summarizing the network usage of the node except the first node in the network system.
Such as: as shown in fig. 2, taking the server 4 as another node as an example, the second network access relationship queried by the server includes:
between server 1 and server 4: the server 1 is a source node, and the server 4 is a destination node;
between server 6 and server 4: the server 6 is a source node and the server 4 is a destination node.
S130, receiving a first access relationship query response sent by other nodes except the first node in the network system, wherein the first access relationship query response comprises a second network access relationship.
And S140, generating a third network access relation aiming at the network system according to the first network access relation and the second network access relation.
In this embodiment, if other nodes except the first node in the network system all return corresponding second network access relationships, the third network access relationship may refer to an access relationship between all nodes in the entire network system; if only a part of the nodes except the first node in the network system return the corresponding second network access relationship, the third network access relationship may refer to the access relationship between the part of the nodes in the network system.
In an exemplary scenario, as shown in fig. 2, server 1, server 2, server 3, server 4, server 5, and server 6 are included in the server network. Here, the server 2 is described as an example of the first node.
When generating a third network access relationship of the server network, the server 2 needs to determine a first network access relationship of itself first, and generates a first access relationship query request according to the first network access relationship, where the first access relationship query request includes a server identifier for characterizing that the server 2 is an access relationship query party, and sends the first access relationship query request; after receiving the first access relationship query request, the server 1, the server 3, the server 4, the server 5 and the server 6 in the server network determine a second network access relationship thereof according to the first access relationship query request and return the second network access relationship to the server 2; when the server 2 receives the second network access relationships returned by the servers 1, 3, 4, 5, and 6, a third network access relationship for the server network may be generated according to the first network access relationship and the second network access relationship. Wherein the third network access relationship may be indicated by an arrow in fig. 2.
As can be seen from the above embodiments, by determining the first network access relationship of the first node itself, generating a first access relationship query request according to the first network access relationship, sending the first access relationship query request, and receiving a first access relationship query response sent by other nodes in the network system except the first node, where the first access relationship query response includes the second network access relationship, and generating a third network access relationship for the network system according to the first network access relationship and the second network access relationship, it is realized that any node in the network can generate access relationships among nodes in the entire network, thereby avoiding obtaining access relationships among nodes in the network only by relying on aggregation calculation of a dedicated device in the prior art, and reducing resource overhead.
Further, on the basis of the above method embodiment, the first node is deployed with a specified query tool (topotool) and a specified agent (topoagent), where the specified query tool and the specified agent are used to determine the first network access relationship, and the specified agent is further used to send the first access relationship query request and receive the first access relationship query response.
The specific implementation process may include: the topotool deployed in the first node sends an access relationship query request for the node to the topotool of the node, and after receiving the access relationship query request for the node, the topotool queries the network service condition of the node and then summarizes the obtained first network access relationship of the node.
And after the topoagent obtains the network access relationship of the node, a first access relationship query request is generated, the first access relationship query request is sent to other nodes except the first node in the network system, and a first access relationship query response sent by other nodes is received.
Such as: as shown in fig. 2, each of the server 1, the server 2, the server 3, the server 4, the server 5, and the server 6 is deployed with its own specific query tool (topotool) and specific agent (topoagent). The self-designated query tool and the self-designated agent program of each server are used for determining the self network access relationship, and the self-designated agent program of each server is also used for querying the access relationship among the servers.
In addition, a TCP (Transmission control protocol) protocol is generally adopted for communication between services of each server, and a network access relationship related to the present invention may refer to communication between services of each server in a TCP protocol scenario; the designated agent of each server may use a UDP (user datagram Protocol) Protocol for request and response, which may improve efficiency of access relationship query.
Further, on the basis of the above method embodiment, the first access relationship query request may further include a first access relationship query sequence number; the first access relationship query sequence number (i.e., query ID) and the first node identifier (i.e., querier IP) are used for a node receiving the first access relationship query request to determine whether the first access relationship query request is received for the first time.
The first access relation query sequence number may be a current timestamp, and the first node identifier may be an IP address of the first node.
The first access relation query sequence number and the first node identifier are two parameters in the first access relation query request. The first node sets the two parameters, and the purpose of the first node is to enable other nodes to quickly judge whether the received first access relation query request is received for the first time after receiving the first access relation query request, and if the first access relation query request is received for the first time, the first node responds and forwards the first access relation query request; if the first access relation query request is not received for the first time, the first access relation query request which is repeatedly received is discarded, so that the situation that other nodes repeatedly answer and forward the same access relation query request is avoided.
Fig. 3 is a schematic flow chart of another method for generating a network access relationship provided in this embodiment, and based on the method shown in fig. 1, as shown in fig. 3, the method for generating a network access relationship may include the following steps:
s310, determining a first network access relation of a first node, and generating a first access relation query request according to the first network access relation; the first access relation query request comprises a first node identification used for representing that the first node is an access relation query party, and the first network access relation comprises one or more second nodes associated with the first node.
S320, sending the first access relation query request to each second node, and forwarding the first access relation query request to nodes except the first node and the second nodes in the network system by the second nodes, so that other nodes except the first node in the network system determine the second network access relation of the other nodes according to the first access relation query request, and return the second network access relation to the first node corresponding to the first node identifier.
In this embodiment, because some nodes in the network system may be associated with the first node and some nodes may not be associated with the first node, at this time, the node that receives the first access relationship query request needs to forward to other nodes that may not receive the first access relationship query request, and finally, the purpose that all nodes can receive the first access relationship query request is achieved.
In order to achieve the purpose, after the first node determines the first network access relationship of the first node, the first network access relationship comprises a second node associated with the first node, and at this time, the first node can send the first network access relationship to the second node; after receiving the first access relationship query request, the second node determines a second network access relationship of the second node, and if the second network access relationship includes nodes except the first node and the second node, the second node may send the first access relationship query request to nodes except the first node and the second node in the network system in addition to the first access relationship query response sent to the first node, and so on, by forwarding of each node in the network, the first access relationship query request can be received by all nodes in the network system.
As shown in fig. 2, the server 2 serves as a first node, and the first network access relationship determined by the server 2 may be as shown in table 1. The service 2 may be Tomcat, and the Tomcat server may be a free Web application server with open source code.
TABLE 1
The first access relationship query request generated by the server 2 may include a first access relationship query sequence number (i.e., query ID) and a first node identifier (i.e., querying party IP) for characterizing that the first node is an access relationship querying party, as shown in table 2.
TABLE 2
Query ID | Inquiry party IP |
1557642480 (i.e. current timestamp) | 10.10.1.2 |
As can be seen from table 1, the server associated with server 2 includes: server 1(IP address: 10.10.1.1), server 3(IP address: 10.10.1.3), server 4(IP address: 10.10.1.4), and server 5(IP address: 10.10.1.5), and at this time, server 2 may transmit the first access relationship inquiry request to server 1, server 3, server 4, and server 6.
After receiving the first access relationship query request, the server 1, the server 3, the server 4, and the server 6 may determine whether the first access relationship query request is received for the first time according to a query ID and an inquirer IP in the first access relationship query request, determine a network access relationship of the server and send the network access relationship to the server 2 if the first access relationship query request is received for the first time, and send the first access relationship query request to a server associated with the server through different threads; and if not, not responding and forwarding the first access relation query request.
Taking the server 4 as an example: the first network access relationship determined by the method can be shown in table 3. The service 4 may be MySQL, which is a relational database management system.
TABLE 3
After receiving the response from the server 4, the server 2 obtains the currently obtained access relationship with the query ID of 1557642480 according to the query ID to perform aggregation calculation, so as to obtain a new network access relationship, which may be shown in table 4.
TABLE 4
Compared with the table 1, the table 4 updates the entry with the sequence number of 3, and adds the entry with the sequence number of 5, wherein the basis for updating the data with the sequence number of 3 is that the network connection quadruple information of the source end IP-source end port-destination IP-destination end port is consistent, and the original missing destination service information in the sequence number of 3 can be supplemented; the data with sequence number 5 is the newly added entry of the access relation data in the root server 4.
The way in which the server 1 and the server 3 respond to the request corresponds to the server 4 and will not be described in detail here.
After the server 6 receives the first access relationship query request initiated by the server 2, the server 6 will respond to the server 2 and forward the first access relationship query request to the server 5 associated with the server 6; the server 6 also receives the first access relationship query request forwarded by the server 4, and when receiving the first access relationship query request forwarded by the server 4, because the same first access relationship query request from the server 2 already exists in the local cache, the server 6 discards the first access relationship query request from the server 4 at this time and does not make a response or forward.
The local cache can use the combination of the query ID and the query party IP as an identifier for identifying one-time query requests, namely, queries with the same information of the query ID and the query party IP are processed only once. The local cache time length can be 2 times of the MSL, and the reason that 2 times of the MSL is taken as the cache time length is that the time for waiting 2 times of the MSL is needed when one TCP connection is released, and the cache time length can be used for ensuring that the query request cannot form an infinite loop.
After receiving the first access relationship query request forwarded by the server 6, the server 5 may determine whether the first access relationship query request is received for the first time according to the query ID and the query party IP in the first access relationship query request, and if so, determine its own network access relationship and send it to the server 2.
Since there is no other server associated with the server 5 than the server 6, the server 5 does not forward the first access relationship query request any more.
After all of the server 1, the server 3, the server 4, the server 6, and the server 5 have responded, the network access relationship with the query ID 1557642480 generated by the server 2 may be as shown in table 5. The service 1 may be Nginx, the service 2 may be Tomcat, the service 3 may be Redis, and the service 4 may be MySQL.
The Nginx may be a high-performance HTTP (hypertext transfer protocol) and a reverse proxy web server, and the Redis may be an open source, written in ANSI C language, supporting network, a log-type or Key-Value database which may be based on memory or may be persistent, and provides API (Application Programming Interface) in multiple languages.
TABLE 5
S330, receiving a first access relationship query response sent by other nodes except the first node in the network system, wherein the first access relationship query response comprises a second network access relationship. This step is the same as S130 and will not be described herein.
S340, generating a third network access relation aiming at the network system according to the first network access relation and the second network access relation. This step is the same as S140 and will not be described herein.
As can be seen from the foregoing embodiments, when the first network access relationship includes one or more second nodes associated with the first node, the first access relationship query request may be sent to nodes other than the first node and the second node in the network system through the second nodes, so that after receiving the first access relationship query request, other nodes other than the first node in the network system may determine a second network access relationship according to the first access relationship query request and return the second network access relationship to the first node, thereby implementing decentralized generation of the network access relationship, and the computation cost of each node is low, and the performance of each node is not affected.
Fig. 4 is a schematic flow chart of another method for generating a network access relationship provided in this embodiment, and based on the method shown in fig. 1, as shown in fig. 4, the method for generating a network access relationship may include the following steps:
s410, determining a first network access relation of the first node, and generating a first access relation query request according to the first network access relation, wherein the first access relation query request comprises a first node identifier used for representing that the first node is an access relation query party. This step is the same as S110 and is not described here.
S420, sending the first access relation query request to enable other nodes except the first node in the network system to determine a second network access relation of the other nodes according to the first access relation query request and return the second network access relation to the first node corresponding to the first node identifier. This step is the same as S120 and is not described here.
S430, receiving a first access relationship query response sent by other nodes except the first node in the network system within a specified time period, where the specified time period includes twice the MSL (Maximum Segment Life time, Maximum message lifetime) after sending the first access relationship query request.
In this embodiment, in order to improve the efficiency of generating the network access relationship, the response time is limited in the present invention, that is, the first access relationship query response sent by the second node is received within the specified time period, the first access relationship query response sent by the second node is no longer received after exceeding the specified time period, and no waiting is performed even if some nodes have not responded.
S440, generating a third network access relation aiming at the network system according to the first network access relation and the second network access relation. This step is the same as S140 and will not be described herein.
As can be seen from the foregoing embodiments, the first access relationship query response sent by other nodes in the network system except the first node is received only within a specified time period, such as: the maximum survival time of the message is 2 times, so that the accuracy of the generated network access relation is ensured, and the efficiency of generating the network access relation is also improved.
Fig. 5 is a schematic flow chart of another method for generating a network access relationship provided in this embodiment, and based on the method shown in fig. 1, as shown in fig. 5, the method for generating a network access relationship may further include the following steps:
s510, a second access relation query request is received, wherein the second access relation query request comprises a second node identification used for representing an access relation query party.
In this embodiment, the first node may be any node in the network system, and may also serve as a queried party of the access relationship. Such as: as shown in fig. 2, the first node is server 2, which is the inquired party of the access relation, and the inquirer of the access relation is server 4, and servers 1, 3, 5, 6 in the network system also serve as inquired parties. The implementation process is similar to that in which the inquiring party of the access relationship is the server 2 and the inquired parties are the servers 1, 3, 4, 5 and 6, and is not described herein again.
S520, determining the fourth network access relation of the first node according to the second access relation query request.
S530, adding the fourth network access relationship into the second access relationship query response, and sending the second access relationship query response to the node corresponding to the second node identifier, so that the node corresponding to the second node identifier generates a third network access relationship according to the fourth network access relationship.
And S540, if it is determined that a third node exists, the third node being used for representing nodes which are in the network system, except for the node sending the second access relation query request, and are associated with the first node, forwarding the second access relation query request to the third node.
And S550, if the third node does not exist, stopping forwarding the second access relation query request.
As can be seen from the above embodiments, after receiving the second access relationship query request, the first node determines a fourth network access relationship of the first node, and responds and forwards the second access relationship query request according to the fourth network access relationship, especially if it is determined that there is no third node, where the third node is used to represent a node in the network system, which is associated with the first node, except for the node that sends the second access relationship query request, and stops forwarding the second access relationship query request, thereby ensuring that the query request does not form an endless loop, and improving reliability of generating the network access relationship.
Fig. 6 is a schematic flow chart of another method for generating a network access relationship provided in this embodiment, and based on the method shown in fig. 5, as shown in fig. 6, the method for generating a network access relationship may further include the following steps:
s610, receiving a second access relation query request, wherein the second access relation query request comprises a second access relation query serial number and a second node identifier used for representing an access relation query party.
S620, judging whether a second access relation query request is received for the first time or not according to the second access relation query sequence number and the second node identifier. If yes, go to S630; if not, go to S670.
S630, determining the fourth network access relation according to the second access relation query request.
And S640, adding the fourth network access relationship into the second access relationship query response, and sending the second access relationship query response to the node corresponding to the second node identifier, so that the node corresponding to the second node identifier generates a third network access relationship according to the fourth network access relationship. This step is the same as S530 and is not described herein.
S650, if it is determined that a third node exists, the third node being used for representing nodes which are in the network system, except for the node sending the second access relation query request, and are associated with the first node, forwarding the second access relation query request to the third node. This step is the same as S540 and is not described in detail here.
And S660, if the third node does not exist, stopping forwarding the second access relation query request. This step is the same as S550 and is not described here.
And S670, not answering and forwarding the second access relation query request.
It can be seen from the above embodiments that, according to the second access relationship query sequence number and the second node identifier, it is determined whether the second access relationship query request is received for the first time, so that a combination of "query ID-query party IP" is used as an identifier for identifying a query request for one time, that is, queries with the same "query ID-query party IP" information are processed only once, thereby avoiding repeated processing of query requests and improving the speed of generating network access relationships.
Fig. 7 shows a schematic structural diagram of a network access relationship generation apparatus provided in this embodiment, where the apparatus may be used in a first node, where the first node is used to characterize any node in a network system, and as shown in fig. 7, the network access relationship generation apparatus may include:
a determining module 71, configured to determine a first network access relationship of the first node itself, and generate a first access relationship query request according to the first network access relationship, where the first access relationship query request includes a first node identifier used to characterize the first node as an access relationship querying party;
a sending module 72, configured to send the first access relationship query request, so that other nodes in the network system except the first node determine a second network access relationship according to the first access relationship query request, and return the second network access relationship to the first node corresponding to the first node identifier;
a receiving module 73, configured to receive a first access relationship query response sent by the other node, where the first access relationship query response includes the second network access relationship;
a generating module 74, configured to generate a third network access relationship for the network system according to the first network access relationship and the second network access relationship.
Further in accordance with an embodiment of the present invention, the first network access relationship comprises one or more second nodes associated with the first node;
the sending the first access relationship query request includes:
and sending the first access relation query request to each second node, and forwarding the first access relation query request to nodes except the first node and the second node in the network system by the second nodes.
Further, on the basis of the above apparatus embodiment, the first access relationship query request further includes a first access relationship query sequence number; the first access relationship query sequence number and the first node identifier are used for the node receiving the first access relationship query request to judge whether the first access relationship query request is received for the first time.
Further, on the basis of the foregoing apparatus embodiment, the receiving a first access relationship query response sent by the other node includes:
and receiving a first access relation query response sent by other nodes in a specified time period, wherein the specified time period comprises twice of the maximum message survival time (MSL) after the first access relation query request is sent.
Further, on the basis of the above device embodiment, the method further includes:
receiving a second access relation query request, wherein the second access relation query request comprises a second node identifier used for representing an access relation query party;
determining a fourth network access relation of the first node according to the second access relation query request;
adding the fourth network access relationship into a second access relationship query response, and sending the second access relationship query response to the node corresponding to the second node identifier, so that the node corresponding to the second node identifier generates the third network access relationship according to the fourth network access relationship;
if determining that a third node exists, wherein the third node is used for representing nodes which are except for the node sending the second access relation query request and are associated with the first node in the network system, forwarding the second access relation query request to the third node;
and if the third node does not exist, stopping forwarding the second access relation query request.
Further, on the basis of the above apparatus embodiment, the second access relationship query request further includes a second access relationship query sequence number; the determining a fourth network access relationship of the first node according to the second access relationship query request includes:
if the second access relationship query request is determined to be received for the first time according to the second access relationship query sequence number and the second node identifier, determining the fourth network access relationship according to the second access relationship query request;
and if the second access relation query request is determined not to be received for the first time according to the second access relation query sequence number and the second node identifier, not responding and forwarding the second access relation query request.
Further, on the basis of the above device embodiment, the first node is deployed with a specified query tool and a specified agent, where the specified query tool and the specified agent are used to determine the first network access relationship, and the specified agent is further used to send the first access relationship query request and receive the first access relationship query response.
The apparatus for generating a network access relationship according to this embodiment may be configured to execute the method embodiments, and the principle and the technical effect are similar, which are not described herein again.
Fig. 8 is a schematic physical structure diagram of an electronic device, which may include, as shown in fig. 8: a processor (processor)801, a communication Interface (Communications Interface)802, a memory (memory)803 and a communication bus 804, wherein the processor 801, the communication Interface 802 and the memory 803 complete communication with each other through the communication bus 804. The processor 801 may call logic instructions in the memory 803 to perform the following method:
determining a first network access relationship of the first node, and generating a first access relationship query request according to the first network access relationship, wherein the first access relationship query request comprises a first node identifier for representing that the first node is an access relationship query party;
sending the first access relation query request to enable other nodes except the first node in the network system to determine a second network access relation of the other nodes according to the first access relation query request and return the second network access relation to the first node corresponding to the first node identifier;
receiving a first access relationship query response sent by the other node, wherein the first access relationship query response comprises the second network access relationship;
and generating a third network access relation aiming at the network system according to the first network access relation and the second network access relation.
It should be noted that, when being implemented specifically, the electronic device in this embodiment may be a server, a PC, or another device, as long as the structure includes the processor 801, the communication interface 802, the memory 803, and the communication bus 804 shown in fig. 8, where the processor 801, the communication interface 802, and the memory 803 complete mutual communication through the communication bus 804, and the processor 801 may call a logic instruction in the memory 803 to execute the above method. The embodiment does not limit the specific implementation form of the electronic device.
In addition, the logic instructions in the memory 803 may be implemented in the form of software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a ROM (Read-only Memory), a RAM (Random Access Memory), a magnetic disk, or an optical disk.
Further, embodiments of the present invention disclose a computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, which when executed by a computer, the computer is capable of performing the methods provided by the above-mentioned method embodiments, for example, comprising:
determining a first network access relationship of the first node, and generating a first access relationship query request according to the first network access relationship, wherein the first access relationship query request comprises a first node identifier for representing that the first node is an access relationship query party;
sending the first access relation query request to enable other nodes except the first node in the network system to determine a second network access relation of the other nodes according to the first access relation query request and return the second network access relation to the first node corresponding to the first node identifier;
receiving a first access relationship query response sent by the other node, wherein the first access relationship query response comprises the second network access relationship;
and generating a third network access relation aiming at the network system according to the first network access relation and the second network access relation.
On the other hand, an embodiment of the present invention further provides a network system, where the network system includes at least two first nodes, and the first nodes are configured to execute the methods provided in the foregoing embodiments, for example, the method includes:
determining a first network access relationship of the first node, and generating a first access relationship query request according to the first network access relationship, wherein the first access relationship query request comprises a first node identifier for representing that the first node is an access relationship query party;
sending the first access relation query request to enable other nodes except the first node in the network system to determine a second network access relation of the other nodes according to the first access relation query request and return the second network access relation to the first node corresponding to the first node identifier;
receiving a first access relationship query response sent by the other node, wherein the first access relationship query response comprises the second network access relationship;
and generating a third network access relation aiming at the network system according to the first network access relation and the second network access relation.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (10)
1. A method for generating a network access relationship is used for a first node, the first node is used for characterizing any node in a network system, and the method for generating the network access relationship comprises the following steps:
determining a first network access relationship of the first node, and generating a first access relationship query request according to the first network access relationship, wherein the first access relationship query request comprises a first node identifier for representing that the first node is an access relationship query party;
sending the first access relation query request to enable other nodes except the first node in the network system to determine a second network access relation of the other nodes according to the first access relation query request and return the second network access relation to the first node corresponding to the first node identifier;
receiving a first access relationship query response sent by the other node, wherein the first access relationship query response comprises the second network access relationship;
and generating a third network access relation aiming at the network system according to the first network access relation and the second network access relation.
2. The method for generating a network access relationship according to claim 1, wherein the first network access relationship includes one or more second nodes associated with the first node;
the sending the first access relationship query request includes:
and sending the first access relation query request to each second node, and forwarding the first access relation query request to nodes except the first node and the second node in the network system by the second nodes.
3. The method for generating network access relationship according to claim 1, wherein the first access relationship query request further includes a first access relationship query sequence number; the first access relationship query sequence number and the first node identifier are used for the node receiving the first access relationship query request to judge whether the first access relationship query request is received for the first time.
4. The method according to claim 1, wherein the receiving the first access relationship query response sent by the other node includes:
and receiving a first access relation query response sent by other nodes in a specified time period, wherein the specified time period comprises twice of the maximum message survival time (MSL) after the first access relation query request is sent.
5. The method for generating a network access relationship according to claim 1, further comprising:
receiving a second access relation query request, wherein the second access relation query request comprises a second node identifier used for representing an access relation query party;
determining a fourth network access relation of the first node according to the second access relation query request;
adding the fourth network access relationship into a second access relationship query response, and sending the second access relationship query response to the node corresponding to the second node identifier, so that the node corresponding to the second node identifier generates the third network access relationship according to the fourth network access relationship;
if determining that a third node exists, wherein the third node is used for representing nodes which are except for the node sending the second access relation query request and are associated with the first node in the network system, forwarding the second access relation query request to the third node;
and if the third node does not exist, stopping forwarding the second access relation query request.
6. The method for generating network access relationship according to claim 5, wherein the second access relationship query request further includes a second access relationship query sequence number;
the determining a fourth network access relationship of the first node according to the second access relationship query request includes:
if the second access relationship query request is determined to be received for the first time according to the second access relationship query sequence number and the second node identifier, determining the fourth network access relationship according to the second access relationship query request;
and if the second access relation query request is determined not to be received for the first time according to the second access relation query sequence number and the second node identifier, not responding and forwarding the second access relation query request.
7. The method according to claim 1, wherein the first node is deployed with a specific query tool and a specific agent, the specific query tool and the specific agent are used for determining the first network access relationship, and the specific agent is further used for sending the first access relationship query request and receiving the first access relationship query response.
8. An apparatus for generating a network access relationship, the apparatus being used for a first node, the first node being used for characterizing any node in a network system, the apparatus for generating a network access relationship comprising:
the determining module is configured to determine a first network access relationship of the first node, and generate a first access relationship query request according to the first network access relationship, where the first access relationship query request includes a first node identifier used for representing that the first node is an access relationship querying party;
a sending module, configured to send the first access relationship query request, so that other nodes in the network system except the first node determine a second network access relationship according to the first access relationship query request, and return the second network access relationship to the first node corresponding to the first node identifier;
a receiving module, configured to receive a first access relationship query response sent by the other node, where the first access relationship query response includes the second network access relationship;
and the generating module is used for generating a third network access relation aiming at the network system according to the first network access relation and the second network access relation.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method for generating a network access relation according to any one of claims 1 to 7 when executing the program.
10. A non-transitory computer readable storage medium, on which a computer program is stored, the computer program, when being executed by a processor, implementing the steps of the method for generating a network access relationship according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911061780.XA CN110868318B (en) | 2019-11-01 | 2019-11-01 | Method and device for generating network access relation, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911061780.XA CN110868318B (en) | 2019-11-01 | 2019-11-01 | Method and device for generating network access relation, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110868318A true CN110868318A (en) | 2020-03-06 |
CN110868318B CN110868318B (en) | 2022-10-18 |
Family
ID=69653851
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911061780.XA Active CN110868318B (en) | 2019-11-01 | 2019-11-01 | Method and device for generating network access relation, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110868318B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112291370A (en) * | 2020-12-28 | 2021-01-29 | 金锐同创(北京)科技股份有限公司 | Method for processing service access relation and related equipment |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101729351A (en) * | 2009-11-03 | 2010-06-09 | 福建星网锐捷网络有限公司 | Method and system for finding topology information, query request device and awaiting query device |
CN102439905A (en) * | 2011-09-30 | 2012-05-02 | 华为技术有限公司 | Method, device and system of finding network topology automatically |
CN106657047A (en) * | 2016-12-14 | 2017-05-10 | 北京启明星辰信息安全技术有限公司 | Network access relationship generation method and apparatus |
CN107682270A (en) * | 2017-09-13 | 2018-02-09 | 北京百卓网络技术有限公司 | A kind of method for discovering network topology and device |
CN108573029A (en) * | 2018-03-20 | 2018-09-25 | 咪咕文化科技有限公司 | Method, device and storage medium for acquiring network access relation data |
-
2019
- 2019-11-01 CN CN201911061780.XA patent/CN110868318B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101729351A (en) * | 2009-11-03 | 2010-06-09 | 福建星网锐捷网络有限公司 | Method and system for finding topology information, query request device and awaiting query device |
CN102439905A (en) * | 2011-09-30 | 2012-05-02 | 华为技术有限公司 | Method, device and system of finding network topology automatically |
CN106657047A (en) * | 2016-12-14 | 2017-05-10 | 北京启明星辰信息安全技术有限公司 | Network access relationship generation method and apparatus |
CN107682270A (en) * | 2017-09-13 | 2018-02-09 | 北京百卓网络技术有限公司 | A kind of method for discovering network topology and device |
CN108573029A (en) * | 2018-03-20 | 2018-09-25 | 咪咕文化科技有限公司 | Method, device and storage medium for acquiring network access relation data |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112291370A (en) * | 2020-12-28 | 2021-01-29 | 金锐同创(北京)科技股份有限公司 | Method for processing service access relation and related equipment |
Also Published As
Publication number | Publication date |
---|---|
CN110868318B (en) | 2022-10-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20200344189A1 (en) | Communication method and communication apparatus | |
CN109547511B (en) | WEB message real-time pushing method, server, client and system | |
US10567483B2 (en) | Method and apparatus for high performance low latency real time notification delivery | |
US20170171039A1 (en) | Network flow information collection method and apparatus | |
CN103780679A (en) | Long time delay remote invocation method based on HTTP protocol | |
US9319449B2 (en) | Method, apparatus, and computer program product for processing data requests | |
US9935861B2 (en) | Method, system and apparatus for detecting instant message spam | |
CN114500633B (en) | Data forwarding method, related device, program product and data transmission system | |
WO2023221452A1 (en) | Packet processing system and method, device, and storage medium | |
CN110868318B (en) | Method and device for generating network access relation, electronic equipment and storage medium | |
CN113452778B (en) | Session holding method, device, equipment, system and storage medium | |
CN110380967B (en) | SSE technology-based server message pushing method | |
CN106790693A (en) | The analysis method and system of a kind of network packet | |
CN112714159A (en) | Message forwarding method and device, storage medium and electronic device | |
CN107872538A (en) | Decouple method for processing business, reverse proxy and the service server of TCP length connections | |
WO2014005489A1 (en) | Intermediate proxy server, communication method and system based on http multi-level proxy | |
CN114827159B (en) | Network request path optimization method, device, equipment and storage medium | |
WO2014158189A1 (en) | Network printing | |
WO2017193814A1 (en) | Service chain generation method and system | |
CN106487890A (en) | A kind of cross-node communication network requesting method based on XMPP | |
KR101382177B1 (en) | System and method for dynamic message routing | |
CN111262773A (en) | Message synchronization method and data center | |
CN109005240A (en) | Real time data method for subscribing based on http protocol | |
CN115665042B (en) | Data processing method, device, user plane functional entity and storage medium | |
CN111641698B (en) | Data statistical method, system, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |