Method and apparatus for acquiring data in path analysis process
By synchronizing public network segment information in the path analysis database and querying other configuration information using third-party interfaces, the problem of high data overhead in path analysis is solved, and efficient data synchronization is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
- Filing Date
- 2022-08-04
- Publication Date
- 2026-04-17
AI Technical Summary
In existing technologies, during path analysis, resource configuration information from all cloud vendors needs to be synchronized to the path analysis database, resulting in excessive data overhead.
By synchronizing public network segment information through the path analysis database and using a target data query interface independent of the path analysis database, other configuration information can be queried from a pre-specified regional database, reducing the amount of data synchronized.
It reduces data overhead during path analysis and improves data synchronization efficiency.
Smart Images

Figure CN115238007B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method and apparatus for acquiring data during path analysis. Background Technology
[0002] Analyzing whether any two resources are connected requires information about these two resources and their related network configuration information. Existing technologies obtain this information in ways such as... Figure 1 As shown, when creating cloud network-related resources, cloud network information is synchronized to the path analysis service's database. This includes resource changes, deletions, and any modifications to status information. The path analysis service then analyzes the configuration information of these resources to generate the final results.
[0003] However, currently, resources from all cloud vendors are not deployed in the same data center, nor are they configured in the same database. Each resource has its corresponding region, and data for different regions resides in different databases. Cloud vendors have tens of thousands, even hundreds of thousands, of servers, plus corresponding subnet information, elastic IP information, security group rules, access control lists (ACLs), and routing table information, resulting in a massive amount of data. To ensure consistency between path analysis data and network resource data, the data synchronization interval cannot be too long. Almost every moment, a large amount of information needs to be synchronized from these databases, leading to significant data overhead. Summary of the Invention
[0004] The purpose of this application is to provide a method and apparatus for acquiring data during path analysis, solving the problem in the prior art where all configuration information for path analysis needs to be synchronized to the path analysis database, resulting in significant data overhead. The specific technical solution is as follows:
[0005] In a first aspect of this application, a method for acquiring data during path analysis is provided, comprising: after initiating a query request for path analysis, obtaining public network segment information matching a first resource identifier from a path analysis database; wherein the query request carries a first resource associated with the first resource identifier; determining a first regional database corresponding to the first resource based on the public network segment information; wherein the path analysis database synchronously contains public network segment information associated with multiple regional databases; querying a second resource identifier associated with the first resource from a pre-specified second regional database through a target data query interface, wherein the target data query interface is independent of the path analysis database, and the second resource identifier is other configuration information to be synchronized in the multiple regional databases besides the public network segment information.
[0006] In a second aspect of this application, a data acquisition device for path analysis is also provided, comprising: an acquisition module, configured to acquire public network segment information matching a first resource identifier from a path analysis database after initiating a query request for path analysis; wherein the query request carries a first resource associated with the first resource identifier; a determination module, configured to determine a first regional database corresponding to the first resource based on the public network segment information; wherein the path analysis database synchronously contains public network segment information associated with multiple regional databases; and a query module, configured to query a second resource identifier associated with the first resource from a pre-specified second regional database through a target data query interface, wherein the target data query interface is independent of the path analysis database, and the second resource identifier is other configuration information to be synchronized in the multiple regional databases besides the public network segment information.
[0007] In a third aspect of this application, a computer-readable storage medium is also provided, wherein instructions are stored therein, which, when executed on a computer, cause the computer to perform the data acquisition method in the path analysis process described in the first aspect.
[0008] In a fourth aspect of this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute the method for acquiring data during the path analysis process described in the first aspect above.
[0009] In this embodiment, during resource path analysis, since the path analysis database synchronously contains public network segment information associated with multiple regional databases, the public network segment information matching the first resource identifier can be obtained from the path analysis database using the first resource identifier of the first resource. Meanwhile, the second resource identifier associated with the first resource can be queried from the pre-specified second regional database through a target data query interface independent of the path analysis database. Because the public network segment information changes less frequently than other configuration information, and the data volume is relatively small, the overhead of synchronizing public network segments is very low. Furthermore, the resource identifier, which has a higher overhead, is invoked through a target data query interface independent of the path analysis database. This avoids the need for the path analysis database to synchronize a large amount of data during path analysis, thus solving the problem in the prior art where all configuration information for path analysis needs to be synchronized to the path analysis database, resulting in significant data overhead. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0011] Figure 1 This is a schematic diagram of the structure of path analysis in the prior art;
[0012] Figure 2 This is a flowchart illustrating the data acquisition method during path analysis in this application embodiment;
[0013] Figure 3 This is a schematic diagram of the path analysis structure in an embodiment of this application;
[0014] Figure 4 This is a schematic diagram of the data acquisition device during the path analysis process in this application embodiment;
[0015] Figure 5 This is a schematic diagram of the structure of the electronic device in the embodiments of this application. Detailed Implementation
[0016] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0017] In the following description, suffixes such as "module" and "unit" used to denote elements are used only for the purposes of this application and have no specific meaning in themselves. Therefore, "module" and "component" can be used interchangeably.
[0018] The technical solutions of the embodiments of this application will be described below with reference to the accompanying drawings. The embodiments of this application provide a method for acquiring data during path analysis, such as... Figure 2 As shown, the method includes the following steps:
[0019] Step 202: After initiating a query request for path analysis, obtain the public network segment information matching the first resource identifier from the path analysis database; wherein, the query request carries the first resource associated with the first resource identifier;
[0020] In a specific example, the first resource is the resource that needs to be analyzed for path. Furthermore, the first resource can be a virtual machine in a cloud network, or it can refer to two cloud servers in a public cloud that need to be analyzed for path. Therefore, the identifier of the first resource can be the IP address corresponding to the cloud server.
[0021] Step 204: Determine the first regional database corresponding to the first resource based on the public network segment information; wherein, the path analysis database synchronously contains public network segment information associated with multiple regional databases;
[0022] Different resources correspond to different regional databases. For example, resource A corresponds to regional database A, resource B corresponds to regional database B, and resource C corresponds to regional database C. Each regional database stores the resource information and configuration information of the corresponding resource. The different regional databases here usually refer to regional databases in different places, that is, regional databases A, B, and C are located in different places.
[0023] Step 206: Query the second resource identifier associated with the first resource from the pre-specified second regional database through the target data query interface. The target data query interface is independent of the path analysis database. The second resource identifier is other configuration information to be synchronized in multiple regional databases, excluding public network segment information.
[0024] It should be noted that the target data query interface is independent of the path analysis database, meaning that the target data query interface is a third-party data query interface; the second resource identifier can be subnet information, elastic IP information, security group rule information, ACL rules, and routing table information, etc. in specific examples.
[0025] Through steps 202 to 206 above, during the resource path analysis process, since the path analysis database synchronizes public network segment information associated with multiple regional databases, the public network segment information matching the first resource identifier can be obtained from the path analysis database using the first resource identifier of the first resource. Meanwhile, the second resource identifier associated with the first resource is queried from the pre-specified second regional database through a target data query interface independent of the path analysis database. Because the public network segment information changes less frequently and has a relatively small data volume compared to other configuration information, the overhead of synchronizing public network segments is very small. Furthermore, the resource identifier, which has a higher overhead, is invoked through the target data query interface independent of the path analysis database. This avoids the need for the path analysis database to synchronize a large amount of data during path analysis, thus solving the problem of high data overhead caused by the need to synchronize all configuration information for path analysis to the path analysis database in existing technologies.
[0026] In an optional embodiment of this application, before initiating a query request for path analysis, the method steps of this application may further include:
[0027] Step 200: Synchronize the public network segment information associated with multiple regional databases to the path analysis database.
[0028] As can be seen, in this embodiment, only the public network segment information is synchronized to the path analysis database. Other configuration information, besides the public network segment information, is queried by a third-party target query interface. Since the public network segment changes very infrequently and the data volume is relatively small, resources with high overhead are used to query via the third-party interface, thereby improving data synchronization efficiency.
[0029] For steps 200 to 206 above, in a specific example, such as Figure 3 As shown, the public network segment information of each region (Region A database, Region B database, and Region C database) is periodically synchronized to the path analysis database. When the path analysis service initiates a query request, it uses the IP address (first resource identifier) of the resource (first resource) to match the public network segment information in the path analysis database to obtain the region of the resource. For other resource identifiers (second resource identifiers), the console provides the region information, and then calls a third-party data query interface based on the resource information with the region information. The third-party data query interface queries the cloud network service database of the specified region, and the result is returned to the path analysis service for analysis.
[0030] In an optional embodiment of this application, before initiating a query request for path analysis, the method further includes:
[0031] Step 201: Configure the configuration file for the target data query interface. The configuration file is used to represent the database paths of multiple regional databases.
[0032] Based on step 201, the method of querying the second resource identifier associated with the first resource from a pre-specified second area database through the target data query interface in step 206 may further include:
[0033] Step 11: Determine the region information of the pre-specified second region database, wherein the region information is used to characterize the path of the second region database;
[0034] Step 12: If the database path of the second regional database is found in the configuration file based on the regional information, the second resource identifier associated with the first resource is retrieved from the second regional database based on the database path.
[0035] In a specific example, steps 11 and 12 above could be as follows: If there are databases in region A, region B, and region C, then the corresponding region information includes region information A (representing the database path of database A), region information B (representing the database path of database B), and region information C (representing the database path of database C). If region information B is specified in advance, then the database path of database B is retrieved from the configuration file, and the second resource identifier associated with the first resource is retrieved from database B.
[0036] In another optional embodiment of the present application, the method of the present application may further include:
[0037] 208. If the database path of the second regional database is not found in the configuration file based on the regional information, traverse multiple regional databases to query the second resource identifier associated with the first resource.
[0038] As can be seen, in the configuration file of the third-party query interface (target data query interface) in this application embodiment, the database path of each region is configured. If the path analysis interface provides regional information, it directly queries the database of the specified region. If not, it traverses the database of all regions to ensure that the corresponding resource identifier can be found to realize the path analysis of the resource.
[0039] This application provides a data acquisition device for path analysis, such as... Figure 4 As shown, the device includes:
[0040] The acquisition module 42 is used to obtain public network segment information matching the first resource identifier from the path analysis database after initiating a query request for path analysis; wherein the query request carries the first resource associated with the first resource identifier;
[0041] In a specific example, the first resource is the resource that needs to be analyzed for path. Furthermore, the first resource can be a virtual machine in a cloud network, or it can refer to two cloud servers in a public cloud that need to be analyzed for path. Therefore, the identifier of the first resource can be the IP address corresponding to the cloud server.
[0042] The determination module 44 is used to determine the first regional database corresponding to the first resource based on the public network segment information; wherein, the path analysis database synchronously contains public network segment information associated with multiple regional databases;
[0043] Different resources correspond to different regional databases. For example, resource A corresponds to regional database A, resource B corresponds to regional database B, and resource C corresponds to regional database C. Each regional database stores the resource information and configuration information of the corresponding resource. The different regional databases here usually refer to regional databases in different places, that is, regional databases A, B, and C are located in different places.
[0044] The query module 46 is used to query the second resource identifier associated with the first resource from the pre-specified second regional database through the target data query interface. The target data query interface is independent of the path analysis database, and the second resource identifier is other configuration information to be synchronized in multiple regional databases, excluding public network segment information.
[0045] It should be noted that the target data query interface is independent of the path analysis database, meaning that the target data query interface is a third-party data query interface; the second resource identifier can be subnet information, elastic IP information, security group rule information, ACL rules, and routing table information, etc. in specific examples.
[0046] With the aforementioned device, during resource path analysis, since the path analysis database synchronously contains public network segment information associated with multiple regional databases, the public network segment information matching the first resource identifier can be obtained from the path analysis database using the first resource identifier of the first resource. Meanwhile, the second resource identifier associated with the first resource can be queried from the pre-specified second regional database through a target data query interface independent of the path analysis database. Because the public network segment information changes less frequently and has a relatively small data volume compared to other configuration information, the overhead of synchronizing public network segments is very small. Furthermore, the resource identifier, which has a higher overhead, is invoked through the target data query interface independent of the path analysis database. This avoids the need for the path analysis database to synchronize a large amount of data during path analysis, thus solving the problem of high data overhead caused by the need to synchronize all configuration information for path analysis to the path analysis database in existing technologies.
[0047] Optionally, the apparatus in this application embodiment may further include: a synchronization module, used to synchronize public network segment information associated with multiple regional databases to the path analysis database before initiating a query request for path analysis.
[0048] As can be seen, in this embodiment, only the public network segment information is synchronized to the path analysis database. Other configuration information, besides the public network segment information, is queried by a third-party target query interface. Since the public network segment changes very infrequently and the data volume is relatively small, resources with high overhead are used to query via the third-party interface, thereby improving data synchronization efficiency.
[0049] In specific examples, such as Figure 3 As shown, public network segment information for each region is periodically synchronized to the path analysis database. When the path analysis service initiates a query request, it uses the IP address (first resource identifier) of the resource (first resource) to match the public network segment information in the path analysis database to obtain the region of the resource. For other resource identifiers (second resource identifiers), the console provides the region information, and then, based on the resource information with the region information, it calls a third-party data query interface. The third-party data query interface then queries the cloud network service database of the specified region, and the result is returned to the path analysis service for analysis.
[0050] Optionally, the apparatus in this application embodiment further includes: a configuration module, configured to configure a configuration file of the target data query interface before initiating a query request for path analysis, wherein the configuration file is used to characterize the database paths of multiple regional databases.
[0051] Optionally, the query module 46 in this embodiment may further include: a determining unit, configured to determine the region information of a pre-specified second region database, wherein the region information is used to characterize the path of the second region database; and a querying unit, configured to query the second resource identifier associated with the first resource from the second region database based on the database path when the database path of the second region database is found from the configuration file based on the region information.
[0052] In a specific example, if there are databases in region A, region B, and region C, then the corresponding region information includes region information A (representing the database path of database A), region information B (representing the database path of database B), and region information C (representing the database path of database C). If region information B is specified in advance, the database path of database B is retrieved from the configuration file, and the second resource identifier associated with the first resource is retrieved from database B.
[0053] Optionally, the apparatus in this application embodiment further includes: a traversal module, used to traverse multiple regional databases to query the second resource identifier associated with the first resource when the database path of the second regional database is not found in the configuration file based on regional information.
[0054] As can be seen, in the configuration file of the third-party query interface (target data query interface) in this application embodiment, the database path of each region is configured. If the path analysis interface provides regional information, it directly queries the database of the specified region. If not, it traverses the database of all regions to ensure that the corresponding resource identifier can be found to realize the path analysis of the resource.
[0055] This application also provides an electronic device, such as... Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503, and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.
[0056] Memory 503 is used to store computer programs;
[0057] Processor 501, when executing the program stored in memory 503, implements... Figure 1 The methods and steps described, and their functions and effects Figure 1 The methods and steps are the same as those in the previous section, so they will not be repeated here.
[0058] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0059] The communication interface is used for communication between the aforementioned terminal and other devices.
[0060] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0061] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0062] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform the data acquisition method in any of the path analysis processes described in the above embodiments.
[0063] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute the data acquisition method in any of the path analysis processes described in the above embodiments.
[0064] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0065] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0066] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0067] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. A method of acquiring data in a path analysis process, characterized by, include: After initiating a query request for path analysis, the public network segment information matching the first resource identifier is obtained from the path analysis database; wherein, the query request carries a first resource associated with the first resource identifier; The first regional database corresponding to the first resource is determined based on the public network segment information; wherein, the path analysis database synchronously contains public network segment information associated with multiple regional databases; The target data query interface queries the second resource identifier associated with the first resource from the pre-specified second regional database. The target data query interface is independent of the path analysis database. The second resource identifier is other configuration information to be synchronized in the multiple regional databases, excluding the public network segment information. Before initiating a query request for path analysis, the method further includes: configuring a configuration file for the target data query interface, wherein the configuration file is used to characterize the database paths of the multiple regional databases; The step of querying the second resource identifier associated with the first resource from a pre-specified second regional database through the target data query interface includes: determining the regional information of the pre-specified second regional database, wherein the regional information is used to characterize the path of the second regional database; and if the database path of the second regional database is found from the configuration file based on the regional information, querying the second resource identifier associated with the first resource from the second regional database based on the database path.
2. The method of claim 1, wherein, Before initiating a query request for path analysis, the method further includes: The public network segment information associated with the multiple regional databases is synchronized to the path analysis database.
3. The method of claim 1, wherein, The method further includes: If the database path of the second regional database is not found in the configuration file based on the regional information, the multiple regional databases are traversed to query the second resource identifier associated with the first resource.
4. An apparatus for acquiring data in a path analysis process, characterized by comprising: include: The acquisition module is used to obtain public network segment information matching the first resource identifier from the path analysis database after initiating a query request for path analysis; wherein, the query request carries a first resource associated with the first resource identifier; The determination module is used to determine the first regional database corresponding to the first resource based on the public network segment information; wherein, the path analysis database synchronously contains public network segment information associated with multiple regional databases; The query module is used to query a second resource identifier associated with the first resource from a pre-specified second regional database through a target data query interface. The target data query interface is independent of the path analysis database, and the second resource identifier is other configuration information to be synchronized in the multiple regional databases, excluding the public network segment information. The device further includes a configuration module, configured to configure a configuration file of the target data query interface before initiating a query request for path analysis, wherein the configuration file is used to characterize the database paths of the multiple regional databases; The query module includes: a determining unit, configured to determine the region information of a pre-specified second region database, wherein the region information is used to characterize the path of the second region database; and a querying unit, configured to, when the database path of the second region database is found in the configuration file based on the region information, query the second resource identifier associated with the first resource from the second region database based on the database path.
5. An electronic device, comprising: It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method described in any one of claims 1-3.
6. A computer-readable storage medium having stored thereon a computer program, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-3.
Citation Information
Patent Citations
Distributed database processing method and device
CN105512200A
Data configuration query method and device
CN109977175A