Micro-service topological graph generation method and system, electronic equipment and storage medium
Through the combination of integrator and graph database, microservice topology maps are automatically collected and generated, which solves the problems of maintenance difficulties and untimely updates in the existing technology, and realizes efficient topology map generation and maintenance.
Patent Information
- Application Number
- CN202411896726.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-03-18
AI Technical Summary
In the prior art, microservice topology diagrams are difficult to maintain, and the update is not timely, making it difficult to reflect the connection relationship between microservices in real time.
The collector is configured through the integrator, and the connection information of the server port is collected and sent to the graph database, and the microservice topology diagram is automatically generated based on the graph database.
It realizes the automated generation of microservice topology maps, improves generation efficiency, promptly reflects the latest connection relationships between microservices, and simplifies the maintenance of topology maps.
Smart Images

Figure CN119652950A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a method, system, electronic device and storage medium for generating a microservice topology map. Background Art
[0002] Currently, large-scale application systems are built based on the microservice model, usually involving dozens or even hundreds of services, with complex relationships and frequent changes. In related technologies, the microservice topology of such application systems is formed by manually configuring the connection relationship between microservices, which is quite difficult to maintain. For example, since the calling relationship between microservices is complex and changes frequently, for microservices whose topological relationships have changed, it is often the case that the calling relationship between microservices has changed again before the microservice topology diagram has been updated. Summary of the invention
[0003] In view of this, the present invention proposes a method, system, electronic device and storage medium for generating a microservice topology map, which solves the problems in the microservice topology scheme of the related art, such as the need to manually configure the relationship between microservices, the difficulty in maintaining the microservice topology, and the untimely update of the calling relationship between microservices.
[0004] On the one hand, an embodiment of the present invention provides a method for generating a microservice topology map, which is applied to a server, where an integrator and a graph database are deployed. The method for generating a microservice topology map includes: Based on the integrator, configuration information is sent to several collectors connected thereto respectively, so that the collectors collect connection information of several ports of the server based on the configuration information; Based on the integrator, it receives the connection information of several ports sent by several collectors, and sends the received connection information of all ports to the graph database; Based on the graph database, it receives the connection information of all ports sent by the integrator, and automatically generates a microservice topology diagram based on the connection information of all ports received.
[0005] In some implementations, the configuration information includes a blacklist and a collection frequency, and the blacklist records non-service applications.
[0006] In some implementations, automatically generating a microservice topology map based on the received connection information of all ports includes: According to the port information in the connection information of all the ports received, a number of corresponding port nodes are automatically created, and based on the edge, the corresponding port nodes are automatically connected according to the port information.
[0007] In some implementations, after connecting corresponding port nodes based on the edges, the method further includes: Based on the graph database, the attribute information of the corresponding port node and the attribute information of the corresponding edge are automatically configured according to the connection information of the port.
[0008] In some embodiments, the method further comprises: Based on the integrator, obtain the information of several servers where several collectors connected to it are located, and send it to the graph database; Based on the graph database, it receives the connection information of all ports sent by the integrator, and automatically generates a microservice topology diagram based on the connection information of all ports received, including: Based on the graph database, it receives the information of several servers and the connection information of all ports sent by the integrator, and automatically generates or updates the microservice topology map based on the information of several servers and the connection information of all ports.
[0009] In some implementations, automatically generating or updating a microservice topology map based on information of several servers and connection information of all ports includes: According to the information of several servers, several corresponding server nodes are automatically created, and based on the connection information of all ports, several corresponding port nodes are automatically created; Based on the edge, according to the connection information of the port, the port nodes corresponding to the multiple ports connected to each other are automatically connected; Based on the server information and port connection information, the server node is automatically associated with the corresponding port node.
[0010] On the other hand, an embodiment of the present invention further provides a method for generating a microservice topology map, which is applied to a client, and a collector is deployed on the client. The method includes: Based on the collector, the configuration information sent by the integrator is received, and according to the received configuration information, the connection information of several ports of the server is collected, and the collected connection information of several ports is sent to the integrator, so that the connection information of all the received ports can be sent to the graph database based on the integrator.
[0011] In some implementations, according to the received configuration information, connection information of several ports of the server is collected, including: Collect the connection information of several ports of the server according to the collection frequency in the configuration information.
[0012] In some implementations, the configuration information includes a blacklist, and the blacklist records non-service applications; According to the received configuration information, the connection information of several ports of the server is collected, including: According to the received configuration information, the connection information of several ports of the server is collected, and during the collection process, the connection information of the corresponding ports of non-service applications is shielded.
[0013] On the other hand, an embodiment of the present invention further provides a microservice topology map generation system, including: a server and a client, a collector is deployed on the client, and an integrator and a graph database are deployed on the server; The integrator is configured to send configuration information to several collectors connected to the integrator respectively; The collector is configured to receive configuration information sent by the integrator, and based on the received configuration information, collect connection information of several ports of the server, and send the collected connection information of several ports to the integrator; The integrator is also configured to receive connection information of a plurality of ports sent by a plurality of collectors, and send the received connection information of all ports to the graph database; The graph database is configured to receive the connection information of all ports sent by the integrator, and automatically generate a microservice topology graph based on the connection information of all ports received.
[0014] On the other hand, an embodiment of the present invention further provides an electronic device, comprising: at least one processor; and a memory, the memory storing a computer program that can be run on the processor, characterized in that when the processor executes the program, the steps of the method of any of the above embodiments are performed.
[0015] On the other hand, an embodiment of the present invention further provides a computer storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method of any of the above embodiments are executed.
[0016] The present invention has at least the following beneficial effects: The present invention provides a method, system, electronic device and storage medium for generating a microservice topology map. The method, system, electronic device and storage medium for generating a microservice topology map provided by the present invention can configure a collector based on an integrator, so that the collector collects connection information of server ports according to configuration information, and can receive the connection information of server ports collected by the collector at the same time, and send the received connection information of server ports to a graph database. Based on the graph database, semantic storage of server port connection information can be realized, and automatic generation of a microservice topology map can be realized according to the connection information of each server port. The solution of the present invention indicates the connection relationship between microservices through the connection relationship between server ports, does not invade the microservice business itself, takes a short time, and improves the generation efficiency of the microservice topology map. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying creative work.
[0018] Figure 1 A flowchart of a method for generating a microservice topology map based on a server provided in an embodiment of the present invention; Figure 2 A schematic diagram of a microservice topology map generated by a microservice topology map generation method provided by an embodiment of the present invention; Figure 3 A flowchart of a method for generating a microservice topology map provided by an embodiment of the present invention; Figure 4 A schematic diagram of the structure of a microservice topology map generation system provided by an embodiment of the present invention; Figure 5 A schematic diagram of the structure of a microservice topology map generation system provided by an embodiment of the present invention; Figure 6 A flowchart of a method for generating a microservice topology map provided by an embodiment of the present invention; Figure 7 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention; Figure 8 A schematic diagram of the structure of a computer storage medium provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0019] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0020] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. The subsequent embodiments will not explain this one by one.
[0021] In the related art, the microservice topology of a large application system is formed by manually configuring the relationship between microservices, which is quite difficult to maintain. For example, since the calling relationship between microservices is complex and changes frequently, for microservices whose topology relationship has changed, the calling relationship between microservices often changes again before the microservice topology is updated, making it difficult for the topology to reflect the connection relationship between microservices in real time.
[0022] Therefore, the microservice topology diagram of the application system generated by manual configuration has problems such as difficult maintenance, untimely updates, difficulty in reflecting the connection relationship between microservices in real time, and is not conducive to management and troubleshooting.
[0023] In view of this, in order to solve at least one technical problem existing in the related art, the present invention provides a method for generating a microservice topology map. The method for generating a microservice topology map provided by the present invention can configure a collector based on an integrator, so that the collector collects the connection information of the server port according to the configuration information, and can receive the connection information of the server port collected by the collector at the same time, and send the received connection information of the server port to a graph database. Based on the graph database, the semantic storage of the server port connection information can be realized, and the automatic generation of the microservice topology map can be realized according to the connection information of each server port. The scheme of the present invention indicates the connection relationship between microservices through the connection relationship between server ports, does not invade the microservice's own business, takes a short time, and improves the generation efficiency of the microservice topology map.
[0024] The present invention is described in detail below in conjunction with embodiments and drawings.
[0025] The first aspect of the embodiment of the present invention provides a method for generating a microservice topology map, which is applied to a server and a client, wherein an integrator and a graph database are deployed on the server, and a collector is deployed on the client. The server and the client can be electronic devices such as desktop computers, laptops, or servers, which are not specifically limited here. For the sake of ease of description, the following embodiment of the present invention is described by taking the server and the client as an example.
[0026] Reference Figure 1 The method provided in the embodiment of the present invention may include steps S101 to S104.
[0027] S101, based on the integrator, sending configuration information to several collectors connected thereto respectively.
[0028] The integrator may also use software programs that can run and remain running in the server memory, such as resident programs. After the execution of such programs, the memory space occupied by them is not released, but they continue to reside in the memory, waiting to be activated or called.
[0029] The configuration information is used to configure the collector, so that the collector can collect server port information according to the configuration information. For example, the configuration information may include a collection frequency, so that the collector can collect server port information according to the collection frequency and send the collected server port information to the integrator regularly.
[0030] S102, based on the collector, receiving the configuration information sent by the integrator, and according to the received configuration information, collecting the connection information of several ports of the server, and sending the collected connection information of several ports to the integrator.
[0031] The collector can use software programs that can run and remain running in the server memory, such as resident programs. After the execution of such programs, the memory space occupied by them will not be released, but will continue to reside in the memory, waiting to be activated or called.
[0032] Microservices refer to multiple small, independent and loosely coupled services formed by splitting a large application. Each microservice is responsible for a specific function and can be independently deployed, expanded and maintained.
[0033] Communication between microservices usually relies on a combination of clearly specified IP addresses and port numbers. For example, if a webpage microservice is deployed on a server, the developer needs to specify a specific port for it, such as 9099, so that the client can request the corresponding resources by accessing the server's IP address and the port number. Therefore, the port specification clarifies the access point of the microservice in the network, and one port corresponds to one microservice. Therefore, in the embodiment of the present invention, the calling relationship between microservices is indicated based on the calling relationship between ports, thereby realizing the automatic generation of the microservice topology map, avoiding the occupation of microservice resources during the topology map generation process, and taking less time, and the microservice topology map can be quickly generated.
[0034] S103. Based on the integrator, the connection information of several ports sent by several collectors is received, and the connection information of all the received ports is sent to the graph database.
[0035] S104. Based on the graph database, the connection information of all ports sent by the integrator is received, and a microservice topology graph is automatically generated according to the connection information of all ports received.
[0036] A graph database is a database system specifically used to store and manage graph data. In an embodiment of the present invention, any graph database can be used to construct a microservice topology graph. For example, the graph database can be any one of Neo4j, JanusGraph, Dgraph, TigerGraph, and the like.
[0037] In the graph database, a microservice topology graph is automatically generated based on the connection information of all stored server ports. In the microservice topology graph, nodes are used to represent ports, edges are used to represent the relationship between ports, and attributes are used to represent the characteristic information of nodes and edges.
[0038] In the embodiment of the present invention, a collector can be configured based on an integrator, so that the collector collects the connection information of the server port according to the configuration information, and at the same time, the connection information of the server port collected by the collector can be received, and the received connection information of the server port can be sent to a graph database. Based on the graph database, the semantic storage of the server port connection information can be realized, and the automatic generation of the microservice topology map can be realized according to the connection information of each server port. In the embodiment of the present invention, the connection relationship between microservices is indicated by the connection relationship between server ports, which does not intrude the microservice's own business, is time-consuming, and improves the efficiency of generating the microservice topology map.
[0039] In some embodiments of the present invention, the configuration information may include a blacklist and a collection frequency, and the blacklist records non-service applications.
[0040] In a specific implementation, based on the integrator, configuration information containing the collection frequency can be sent to several collectors connected to it. After receiving the configuration information containing the collection frequency, the collector makes the configuration information effective, and then collects the connection information of several ports of the server according to the collection frequency in the configuration information, and sends the connection information of all ports collected at each collection frequency to the integrator. The integrator receives the connection information of all ports sent by the collector, and sends the received connection information of all ports to the graph database. After the graph database receives the connection information of all ports sent by the integrator, it automatically generates a microservice topology map based on the received connection information of all ports.
[0041] In the embodiments of the present invention, by configuring the collection frequency of the collector to collect port connection information, the connection information of all ports collected can be regularly updated, and then the generated microservice topology map can be regularly updated, so that the latest connection relationship between microservices can be reflected in a timely manner, which is beneficial to the association of microservice applications and the rapid location of faults when microservices fail, and accurate troubleshooting can be performed.
[0042] In a specific implementation, based on the integrator, configuration information containing a blacklist can be sent to several collectors connected to it. After receiving the configuration information containing the blacklist, the collector makes the configuration information effective. After that, when collecting the connection information of the server port, the collector automatically shields the connection information of the port corresponding to the non-service application recorded in the blacklist, thereby reducing the amount of data that the collector needs to collect each time, reducing the consumption of storage resources, improving the collection speed of the server port connection information, and further improving the generation efficiency of the microservice topology map.
[0043] In some embodiments of the present invention, Figure 1In step S104 shown, automatically generating a microservice topology diagram based on the received connection information of all ports may include: automatically creating a number of corresponding port nodes based on the port information in the received connection information of all ports, and automatically connecting the corresponding port nodes based on the edge and the port information.
[0044] By establishing port nodes corresponding to each port and connecting port nodes with call relationships with edges, the relationship between the ports can be clearly seen, which facilitates the management of microservices.
[0045] In some embodiments of the present invention, after connecting corresponding port nodes based on edges, such as Figure 1 The step S104 shown may also include: based on the graph database, automatically configuring the attribute information of the corresponding port node and the attribute information of the corresponding edge according to the connection information of the port.
[0046] In the node attribute information, you can configure the node status (for example, connected or disconnected), supported protocol types, applied microservice names, and other information. In the edge attribute information, you can configure the network status between interconnected nodes and other information. Therefore, by configuring the attribute information of the nodes and the attribute information of the edges, the management of microservices can be facilitated, and problems with nodes or connections between nodes can be discovered in a timely manner, which is conducive to fault troubleshooting and location.
[0047] In a specific implementation, ports can be divided into source ports and target ports according to their types. Source ports and target ports can be understood as one of the ports with a connection relationship is the source port and the other is the target port. Source ports and target ports can also be understood as two ports of a microservice application, for example, the end that sends data is the source port and the end that receives data is the target port.
[0048] In some examples, the direction of data transmission can be indicated by setting the direction of the edge, for example, the direction of the edge is from the source port to the destination port.
[0049] In some embodiments of the present invention, the connection information of the port may include: source port information, target port information, protocol types supported by the port, microservice information running on the port, and network transmission status between the port and other ports connected to the port; For example, the connection information of a port may include the following: [{"Name":"Application Name","Source IP":xx.xx.xx.xx","Source Port":"123","Destination IP":"xx.xx.xx.xx","Destination Port":"456","Protocol":"tcp / udp (network protocol)","Send Queue":"0","Receive Queue":0}, …].
[0050] In some embodiments of the present invention, configuring the attribute information of the corresponding port node and the attribute information of the corresponding edge based on the connection information of the port may include: configuring the attributes of the corresponding node based on the protocol type supported by the port and the microservice information running on the port; configuring the attributes of the corresponding edge based on the network transmission status between the port and other ports connected to the port.
[0051] By configuring the properties of the corresponding node based on the protocol type supported by the port and the microservice information running on the port, the connection protocol between ports can be displayed on the microservice topology map, for example, what protocol is used to connect from port A to port B. It can also be used for searching in the graph database, such as finding all topologies with name=app, which further facilitates the management of microservices. By configuring the properties of the corresponding edge through the network transmission status between the port and other ports connected to the port, the connection status between nodes can be displayed through the topology diagram. For example, if the property is 0, it means that the connection is normal. If it is higher than a certain threshold, it means that there is a backlog of messages between the two nodes. Therefore, it can be determined by the properties of the edge whether network traffic backlog occurs and the direction of network problems can be predicted in advance.
[0052] In some embodiments of the present invention, Figure 1 The microservice topology map generation method shown, in addition to S101 to S104, may also include: based on the integrator, obtaining information on several servers where several collectors connected to it are located, and sending the information to the map database.
[0053] On this basis, if Figure 1 In the step S104 shown, based on the graph database, the connection information of all ports sent by the integrator is received, and the microservice topology map is automatically generated according to the received connection information of all ports, which may include: based on the graph database, the information of several servers and the connection information of all ports sent by the integrator is received, and the microservice topology map is automatically generated according to the information of several servers and the connection information of all ports.
[0054] The port connection information may include: port address information and port identification information. When creating a port node, the created port node may be named based on the port address information and the port identification information. The port address information may be represented by the address information of the server where the port is located.
[0055] The server information may include: server address information. When creating a server node, the created server node may be named based on the server address information.
[0056] In order to further strengthen the management of various microservices deployed on the server and clearly understand the operation status of each microservice on the server, the port node and the server node can be associated through the port address information and the server address information.
[0057] In some embodiments of the present invention, automatically generating a microservice topology diagram based on information of several servers and connection information of all ports may include: automatically creating several corresponding server nodes based on information of several servers, and automatically creating several corresponding port nodes based on connection information of all ports; automatically connecting port nodes corresponding to multiple interconnected ports based on edges and according to connection information of ports; automatically associating server nodes with corresponding port nodes based on information of servers and connection information of ports.
[0058] In one example, the microservices split from an application system are deployed on servers 1 to 5. The IP addresses of servers 1 to 5 are 192.168.0.1, 192.168.0.2, 192.168.0.3, 192.168.1.2, and 192.168.1.3, respectively. Servers 1 to 5 have multiple ports such as 8080, 8089, and 4455. The microservice topology diagram generated based on server information and port connection information can be seen in Figure 2 .
[0059] pass Figure 2 It can be clearly seen the calling relationship between ports, the network status between ports, the relationship between ports and servers, and what type of microservices are executed between ports.
[0060] In some embodiments of the present invention, Figure 1 The method for generating a microservice topology diagram shown in the figure may further include the following steps before step S101: Figure 3 Step S301 is shown.
[0061] S301. Based on the integrator, a communication connection is established with several servers where several collectors are located.
[0062] In a specific implementation, a server list can be saved in advance in the integrator. The server list can include: the address information (e.g., server IP) and listening port (e.g., 9099) of the server where the client collector is located. When the integrator is started, a connection request is sent to the listening port of each server based on the server list. After receiving the connection response returned by the client server, it means that the connection has been successfully established with the server where the client collector is located.
[0063] In a specific implementation, for servers that have not been successfully connected, reconnection is performed. If the connection is still unsuccessful after multiple retries, an alarm is issued so that the staff can discover the problem and deal with the problem in a timely manner.
[0064] In some embodiments of the present invention, Figure 3 As shown, the microservice topology map generation method provided by the embodiment of the present invention may further include step S302 after establishing communication connections with several servers where several collectors are located based on the integrator (ie S301).
[0065] S302: In response to establishing a communication connection with the server where the client collector is located, periodically checking the connection status with the server where the client collector is located.
[0066] In a specific implementation, the connection status between the server where the integrator is located and the server where the client collector is located can be checked regularly through the heartbeat information sent by the server where the client collector is located. If the heartbeat information sent by the server where the collector is located is not detected for multiple consecutive cycles, an alarm will be issued, so that the staff can discover the problem and deal with it in time.
[0067] In some embodiments of the present invention, Figure 1 The microservice topology map generation method shown may also include, before step S101: based on the collector, in response to establishing a communication connection with the integrator, regularly sending heartbeat information to the server, so that the server periodically checks the connection status with the server where the client collector is located based on the heartbeat information.
[0068] When the collector is started, it can listen to a specific port, which is the port in the server list saved in advance by the integrator and is used to connect to the server where the integrator is located.
[0069] In response to receiving the connection request sent by the integrator, a connection is successfully established with the server where the integrator is located, and a connection response is returned to the server where the integrator is located.
[0070] After successfully establishing a connection with the server where the integrator is located, the collector can also periodically send heartbeat information to the server where the integrator is located based on the server where the collector is located. The heartbeat information can be used to detect the connection status between the server where the collector is located and the server where the integrator is located.
[0071] In a specific implementation, a blacklist may be maintained to shield connections that are not application services (such as system connections: NTP, SSH, etc.). The blacklist is initially generated based on operation and maintenance experience and may also be dynamically appended by remote configuration for customized service shielding.
[0072] In a specific implementation, when periodically obtaining the connection information of all ports, only the connection status (i.e., the status between ports that have established connections) is obtained, and the information in the blacklist is excluded, and the port connection information is processed into a format that can be recognized and stored by the graph database, for example, JSON format.
[0073] Based on the same inventive concept, according to another aspect of the present invention, an embodiment of the present invention further provides a microservice topology map generation system, such as Figure 4 As shown, the microservice topology map generation system 40 may include a server and a client, a collector 41 is deployed on the client, and an integrator 42 and a graph database 43 are deployed on the server.
[0074] The integrator 41 is configured to send configuration information to a plurality of collectors 42 connected to the integrator 41 respectively.
[0075] The collector 42 is configured to receive configuration information sent by the integrator 41 , and collect connection information of several ports of the server according to the received configuration information, and send the collected connection information of the several ports to the integrator 41 .
[0076] The integrator 41 is also configured to receive connection information of several ports sent by several collectors 42 , and send the received connection information of all ports to the graph database 43 .
[0077] The graph database 43 is configured to receive connection information of all ports sent by the integrator 41, and automatically generate a microservice topology graph based on the received connection information of all ports.
[0078] In the embodiment of the present invention, a collector can be configured based on an integrator, so that the collector collects the connection information of the server port according to the configuration information, and at the same time, the connection information of the server port collected by the collector can be received, and the received connection information of the server port can be sent to a graph database. Based on the graph database, the semantic storage of the server port connection information can be realized, and the automatic generation of the microservice topology map can be realized according to the connection information of each server port. In the embodiment of the present invention, the connection relationship between microservices is indicated by the connection relationship between server ports, which does not intrude the microservice's own business, is time-consuming, and improves the efficiency of generating the microservice topology map.
[0079] The embodiments of the present invention are described in detail below with reference to specific examples.
[0080] like Figure 5As shown, the microservice topology map generation system 50 may include: an integrator 51 located at the server end, a graph database 52, a memory 53, and several collectors 54 located at the client end. The memory 53 stores a server list. The server list includes: the IP address and listening port of the server where the collector is located. The integrator 51 includes: a setting module, a data receiving module, a remote configuration module and a listening module. The collector 54 includes a scanning module, a remote configuration module, a storage module and a format conversion module. A blacklist is stored in the storage module of the collector 54. The blacklist is configured with connections of non-application service classes.
[0081] Based on Figure 5 The microservice topology generation system shown in the figure can be executed as follows Figure 6 The microservice topology diagram generation method shown in Figure 1 is as follows. Figure 6 As shown, the microservice topology map generating method may include steps S601 to S612.
[0082] S601 , when the integrator 51 is started, it scans the server list stored in the memory 53 and sends connection requests to all collectors (ClientAgents).
[0083] S602, when the collector 54 is started, it monitors the designated port.
[0084] S603 , in response to receiving a connection request from the integrator 51 based on the designated port, replying a connection response to the integrator 51 .
[0085] The duplex-based long connection (Websocket) monitors the designated port. Once the designated port receives a connection request from the integrator 51 , the server where the collector 54 is located establishes a connection with the server where the integrator 51 is located through the port.
[0086] A blacklist can be maintained in the collector 54 to shield connections that are not application services (such as system connections: NTP, SSH, etc.). The list can be initially generated based on operation and maintenance experience and stored in the storage module of the collector 54, or it can be dynamically added by the remote configuration module of the integrator 51 for customized service shielding.
[0087] S604 , after the remote connection is established, the collector 54 may periodically send heartbeat information (Heartbeat) to the integrator 51 .
[0088] S605 , after receiving the connection response, the integrator 51 performs remote settings on the collector 54 as needed through the remote configuration module.
[0089] For example, you can configure the connection information collection period, configure the blacklist, etc.
[0090] S606. The collector 54 receives remote dynamic configuration information through the remote configuration module and automatically makes the configuration effective.
[0091] S607 . The collector 54 controls the collection cycle frequency of the collector based on the remote configuration, for example, 30 seconds, 1 minute, 2 minutes or 3 minutes.
[0092] S608 . The collector 54 obtains the network connection status (ie, port connection information) of all server ports based on the scanning module (netstat / ss).
[0093] S609 , the collector 54 periodically obtains the connection information of all scanned ports based on the format conversion module, processes it into JSON format, and sends it to the integrator 51 .
[0094] S610 , after receiving all the port connection information sent by the collector 54 , the integrator 51 regularly updates the information to the graph database 52 , so as to regularly update the microservice topology graph in the graph database 52 .
[0095] S611, the integrator 51 may also check the heartbeat periodically (for example, every 1 minute). If the heartbeat fails, the heartbeat failure is included in the alarm process.
[0096] S612, if the integrator 51 fails to connect to the server after 3 retries, the connection failure will be included in the alarm process.
[0097] The embodiment of the present invention is based on regular automatic data collection and incorporates the result data into a graph database, that is, all network topologies are semantically stored, thereby realizing real-time drawing of a visual topology map to display the call status between services; it can also judge circular dependencies based on graph retrieval capabilities and discover unreasonable dependencies between service nodes in advance; it can also judge network accumulation based on the network attributes of the edges and predict the direction of network problems in advance.
[0098] Based on the same inventive concept, according to another aspect of the present invention, Figure 7 As shown, an embodiment of the present invention further provides an electronic device 70, which includes a processor 710 and a memory 720. The memory 720 stores a computer program 721 that can be run on the processor. When the processor 710 executes the program, the steps of the above method are performed.
[0099] Among them, the memory, as a non-volatile storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as the program instructions / modules corresponding to the compression method in the embodiment of the present application. The processor executes various functional applications and data processing of the device by running the non-volatile software programs, instructions and modules stored in the memory, that is, realizing the compression method of the above method embodiment.
[0100] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the device, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the local module via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0101] Based on the same inventive concept, according to another aspect of the present invention, Figure 8 As shown, an embodiment of the present invention further provides a computer storage medium 80, which stores a computer program 81 that performs the above method when executed by a processor.
[0102] Finally, it should be noted that a person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium of the program can be a disk, an optical disk, a read-only storage memory (ROM) or a random access memory (RAM), etc. The above-mentioned computer program embodiments can achieve the same or similar effects as the corresponding above-mentioned any method embodiments.
[0103] It will also be appreciated by those skilled in the art that various exemplary logic blocks, modules, circuits and algorithm steps described in conjunction with the disclosure herein can be implemented as electronic hardware, computer software or a combination of the two. In order to clearly illustrate this interchangeability of hardware and software, a general description has been given to the functions of various schematic components, blocks, modules, circuits and steps. Whether this function is implemented as software or hardware depends on specific applications and the design constraints imposed on the entire system. Those skilled in the art can implement the function in various ways for each specific application, but this implementation decision should not be interpreted as causing a departure from the disclosed scope of the embodiments of the present invention.
[0104] The above are exemplary embodiments disclosed in the present invention, but it should be noted that various changes and modifications may be made without departing from the scope of the embodiments disclosed in the present invention as defined in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. The serial numbers of the embodiments disclosed in the above embodiments of the present invention are for description only and do not represent the advantages and disadvantages of the embodiments. In addition, although the elements disclosed in the embodiments of the present invention may be described or required in individual form, they may also be understood as multiple unless explicitly limited to the singular.
[0105] It should be understood that, as used herein, the singular forms "a", "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" refers to any and all possible combinations including one or more of the associated listed items.
[0106] A person skilled in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the disclosure of the embodiments of the present invention (including the claims) is limited to these examples; under the concept of the embodiments of the present invention, the technical features in the above embodiments or different embodiments can also be combined, and there are many other changes in different aspects of the above embodiments of the present invention, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.
Claims
1. A method for generating a microservice topology graph, characterized in that: Applied to a server, the server is deployed with an integrator and a graph database, and the method includes: Based on the integrator, the configuration information is sent to several collectors connected thereto respectively, so that the collectors collect the connection information of several ports of the server based on the configuration information; Based on the integrator, receiving the connection information of the plurality of ports sent by the plurality of collectors, and sending the received connection information of all the ports to the graph database; Based on the graph database, the connection information of all ports sent by the integrator is received, and a microservice topology graph is automatically generated according to the connection information of all ports received.
2. The method according to claim 1, characterized in that The configuration information includes a blacklist and a collection frequency, and the blacklist records non-service applications.
3. The method according to claim 1, characterized in that The automatically generating a microservice topology diagram according to the received connection information of all ports includes: According to the port information in the received connection information of all ports, a number of corresponding port nodes are automatically created, and based on the edge, the corresponding port nodes are automatically connected according to the port information.
4. The method according to claim 3, characterized in that After connecting the corresponding port nodes based on the edge, the method further includes: Based on the graph database, attribute information of the corresponding port node and attribute information of the corresponding edge are automatically configured according to the connection information of the port.
5. The method according to any one of claims 1 to 4, characterized in that: Also includes: Based on the integrator, information of several servers where several collectors connected to the integrator are located is obtained, and sent to the graph database; The graph database is based on receiving the connection information of all ports sent by the integrator, and automatically generating a microservice topology graph according to the received connection information of all ports, including: Based on the graph database, the information of several servers and the connection information of all ports sent by the integrator are received, and according to the information of the several servers and the connection information of all ports, the microservice topology graph is automatically generated or updated.
6. The method according to claim 5, characterized in that Automatically generating or updating the microservice topology map according to the information of the plurality of servers and the connection information of all ports includes: Automatically create a number of corresponding server nodes based on the information of the number of servers, and automatically create a number of corresponding port nodes based on the connection information of all the ports; Based on the edge, according to the connection information of the port, the port nodes corresponding to the plurality of ports connected to each other are automatically connected; Based on the information of the server and the connection information of the port, the server node is automatically associated with the corresponding port node.
7. A method for generating a microservice topology graph, characterized in that: Applied to a client, a collector is deployed on the client, and the method includes: Based on the collector, the configuration information sent by the integrator is received, and according to the received configuration information, the connection information of several ports of the server is collected, and the collected connection information of the several ports is sent to the integrator, so that the connection information of all the received ports can be sent to the graph database based on the integrator.
8. The method according to claim 7, characterized in that According to the received configuration information, the connection information of several ports of the server is collected, including: The connection information of several ports of the server is collected according to the collection frequency in the configuration information.
9. The method according to claim 7, characterized in that: The configuration information includes a blacklist, and the blacklist records non-service applications; According to the received configuration information, the connection information of several ports of the server is collected, including: The connection information of several ports of the server is collected, and during the collection process, the connection information of the ports corresponding to the non-service applications is shielded.
10. A microservice topology map generation system, characterized in that: include: A server and a client, wherein a collector is deployed on the client, and an integrator and a graph database are deployed on the server; Wherein, the integrator is configured to send configuration information to several collectors connected to the integrator respectively; The collector is configured to collect connection information of several ports of the server based on the configuration information sent by the receiving integrator and according to the received configuration information, and send the collected connection information of the several ports to the integrator; The integrator is also configured to receive connection information of several ports sent by the several collectors, and send the received connection information of all ports to the graph database; The graph database is configured to receive connection information of all ports sent by the integrator, and automatically generate a microservice topology graph based on the received connection information of all ports.
11. An electronic device, comprising: at least one processor; as well as A memory storing a computer program executable on the processor, wherein the processor executes the steps of the method according to any one of claims 1 to 9 when executing the program.
12. A computer storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are performed.
Citation Information
Cited By
GQL graph database server-side and client-side communication method based on gRPC protocol
CN120091053A
