Information processing method and device, processor and electronic equipment
By directly querying and returning the host port information of the container group Pod from the target database, the problem of low efficiency in the existing technology is solved, realizing efficient and reliable host port access, simplifying the process and reducing resource consumption.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-23
- Publication Date
- 2026-03-17
AI Technical Summary
In existing technologies, obtaining the host port information of a container group Pod is inefficient, which affects the effectiveness of accessing the container group Pod through the host port.
By receiving query requests from clients, the system queries and returns information from the host port information of container group Pods pre-stored in the target database. This directly retrieves host port information from the database, avoiding repeated reporting processes, reducing computational resource consumption, and ensuring the accuracy and reliability of the information through an automatic retry mechanism.
It improves the efficiency of obtaining host port information for container group Pods, enhances the effect of accessing container group Pods through host ports, simplifies the process, and reduces resource consumption.
Smart Images

Figure CN116233123B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing technology, and more specifically, to an information processing method and apparatus, processor and electronic device. Background Technology
[0002] Currently, PaaS (Platform as a Service) cloud infrastructure environments use a HostPort container networking solution to achieve service exposure and cross-cluster communication, but it does not support direct cross-node communication between containers. Furthermore, Figure 1 This is a schematic diagram of a HostPort network solution provided based on existing technology, such as... Figure 1 As shown, DNAT (Destination Network Address Translation) rules are used to map a random port on the host to a port on the container group Pod, thus enabling access to the container via the host port. Additionally, Figure 1 In this context, "container" represents a container, "client" represents a client, "dubbo" represents an open-source distributed service framework (a special type of client), "172.24.1.5" represents the address information, and "8080" represents the port information. Therefore, to access a container group's Pod, its HostPort information must first be obtained, and the management platform must support viewing the Pod's HostPort information. However, the Kubernetes platform does not support reporting this host port information by default, so an additional reporting channel is needed.
[0003] In related technologies, one approach to reporting host port information is to use an event monitor, and the reporting process is as follows:
[0004] (1) The kubelet calls the container running service to create the Pause container and the business container of the Pod in sequence, and reports the running status of the Pod to the kube-apiserver (the name of the database component) based on the results.
[0005] (2) The event-monitor receives container events from the container running service process and filters out container startup events;
[0006] (3) Based on the tag filter in the container event, call the container list of the service running in the container and query the interface to filter out the HostPort information of the Pause container belonging to the Pod;
[0007] (4) The event-monitor reports this HostPort information to each business container belonging to the Pod, and each port is reported to the management platform as a record;
[0008] (5) After receiving the request, the management platform will insert the record into the database.
[0009] Furthermore, after reporting using an event monitor, the process for querying the host port information of a Pod is as follows:
[0010] (1) The browser or client initiates a request to query Pod information;
[0011] (2) The management platform receives the request and queries the database for Pod information;
[0012] (3) The management platform queries the HostPort information in the database and returns it in conjunction with step (2).
[0013] However, using an event monitor to report and query Pod host port information has the following drawbacks:
[0014] (1) Since a Pod generally has at least two containers, let's say N, and the business containers may restart under abnormal conditions, let's say M times, and the number of ports is X, the event-monitor may receive multiple events and repeatedly execute steps (2), (3), and (4) of the above reporting process. This is equivalent to the number of times the HostPort reporting process Y is: Y = (N + M) * X, which wastes computing resources;
[0015] (2) An independent reporting component, event-monitor, needs to be deployed, and the management platform needs to record additional data in the relational database. Since there is one record per port, a Pod often occupies multiple data records, wasting computing resources and occupying storage space.
[0016] (3) Users need to query data from two locations simultaneously, making the query process inconvenient;
[0017] (4) When event-monitor listens to container running services, if network abnormalities or query errors occur and the event is lost, it cannot retry the reporting in time, lacking a retry mechanism.
[0018] In related technologies, another approach to reporting host port information is to use Pod-initiated reporting, and the reporting process is as follows:
[0019] (1) The kubelet calls the container running service to create the Pause container and the business container of the Pod in sequence, and reports the running status of the Pod to the kube-apiserver (the name of the database component) based on the results.
[0020] (2) When the Pod starts, it automatically executes the platform's preset Hook program (an application) and actively queries the port of this container;
[0021] (3) The Hook program actively reports each port record to the database.
[0022] Furthermore, after adopting the method of Pod proactively reporting, the process for querying the host port information of the Pod is as follows:
[0023] (1) The browser or client queries the database for Pod information;
[0024] (2) The browser or client queries the HostPort information in the database and combines it with the information from step (1) for display.
[0025] However, using the method of Pod actively reporting and querying the host port information of Pod has the following disadvantages:
[0026] (1) All base images need to be modified to add a script to report HostPort. This involves a wide range of applications, is complicated to modify, and is difficult to maintain in the long term.
[0027] (2) The management platform needs to hijack the Pod's Hook program to call the script, which violates the standard semantics of k8s;
[0028] (3) Users need to query data from two sources, which is inconvenient;
[0029] (4) Each Pod of the reporter needs to perform the reporting multiple times according to the number of ports, which consumes additional computing resources;
[0030] (5) It requires the maintenance of an additional database, which incurs high maintenance costs;
[0031] (6) The script uses a polling method for querying, which is not very real-time.
[0032] There is currently no effective solution to the problem that obtaining host port information of container group Pods in related technologies is inefficient and affects the effectiveness of accessing container group Pods through host ports. Summary of the Invention
[0033] The main objective of this application is to provide an information processing method, apparatus, processor, and electronic device to solve the problem in the related art of low efficiency in obtaining host port information of container group Pods, which affects the effectiveness of accessing container group Pods through host ports.
[0034] To achieve the above objectives, according to one aspect of this application, an information processing method is provided. The method includes: receiving a query request sent by a client, wherein the query request is for requesting to query host port information of a container group Pod, the container group Pod being the smallest load unit in a container scheduling and management platform; responding to the query request, querying the host port information of the container group Pod from a target database to obtain target information, wherein the host port information of the container group Pod is pre-stored in the target database; and returning the target information to the client.
[0035] Further, before responding to the query request and querying the host port information of the container group Pod from the target database to obtain the target information, the method further includes: obtaining target host port information, wherein the target host port information is the collected host port information of the container group Pod; determining whether the target host port information is the same as first host port information, and obtaining a determination result, wherein the first host port information is the host port information of the container group Pod stored in the target database; determining whether to update the first host port information stored in the target database based on the determination result, and obtaining a processing result; and determining the host port information of the container group Pod stored in the target database based on the processing result.
[0036] Further, based on the judgment result, it is determined whether to update the first host port information stored in the target database. The processing result includes: if the target host port information is the same as the first host port information, then the first host port information stored in the target database is not updated; if the target host port information is different from the first host port information, then the first host port information stored in the target database is updated to the obtained target host port information.
[0037] Furthermore, if the target host port information is different from the first host port information, after updating the first host port information stored in the target database to the obtained target host port information, the method further includes: obtaining an update result, wherein the update result is used to indicate whether the first host port information stored in the target database was successfully updated to the obtained target host port information; if the update result indicates that updating the first host port information stored in the target database to the obtained target host port information failed, then resending an update request, wherein the update request is used to request updating the first host port information stored in the target database to the obtained target host port information.
[0038] Further, determining whether the target host port information is the same as the first host port information, and obtaining the determination result includes: obtaining the ID information of the target container, wherein the target container is the first container in the container group Pod; and determining whether the host port information of the container group Pod is the same as the first host port information based on the ID information of the target container, and obtaining the determination result.
[0039] Further, based on the processing result, determining the host port information of the container group Pod stored in the target database includes: if the processing result indicates that the first host port information stored in the target database is not updated, then the first host port information is used as the host port information of the container group Pod stored in the target database; if the processing result indicates that the first host port information stored in the target database is updated, then the obtained target host port information is used as the host port information of the container group Pod stored in the target database.
[0040] Furthermore, after returning the target information to the client, the method further includes: accessing the container group Pod based on the target information.
[0041] To achieve the above objectives, according to another aspect of this application, an information processing apparatus is provided. The apparatus includes: a first receiving unit, configured to receive a query request sent by a client, wherein the query request is for querying host port information of a container group Pod, the container group Pod being the smallest load unit in a container scheduling and management platform; a first response unit, configured to respond to the query request, query the host port information of the container group Pod from a target database to obtain target information, wherein the host port information of the container group Pod is pre-stored in the target database; and a first returning unit, configured to return the target information to the client.
[0042] Furthermore, the device further includes: a first acquisition unit, configured to acquire target host port information before querying the host port information of the container group Pod from the target database in response to the query request, wherein the target host port information is the collected host port information of the container group Pod; a first judgment unit, configured to judge whether the target host port information is the same as the first host port information, and obtain a judgment result, wherein the first host port information is the host port information of the container group Pod stored in the target database; a first processing unit, configured to determine whether to update the first host port information stored in the target database based on the judgment result, and obtain a processing result; and a first determination unit, configured to determine the host port information of the container group Pod stored in the target database based on the processing result.
[0043] Further, the first processing unit includes: a first processing module, configured to not update the first host port information stored in the target database if the target host port information is the same as the first host port information; and a second processing module, configured to update the first host port information stored in the target database to the obtained target host port information if the target host port information is different from the first host port information.
[0044] Furthermore, the apparatus further includes: a second acquisition unit, configured to acquire an update result after updating the first host port information stored in the target database to the acquired target host port information if the target host port information is different from the first host port information, wherein the update result is used to indicate whether the first host port information stored in the target database has been successfully updated to the acquired target host port information; and a first sending unit, configured to resend an update request if the update result indicates that updating the first host port information stored in the target database to the acquired target host port information has failed, wherein the update request is used to request updating the first host port information stored in the target database to the acquired target host port information.
[0045] Further, the first judgment unit includes: a first acquisition module, used to acquire the ID information of the target container, wherein the target container is the first container in the container group Pod; and a first judgment module, used to determine whether the host port information of the container group Pod is the same as the first host port information based on the ID information of the target container, and obtain a judgment result.
[0046] Further, the first determining unit includes: a first determining module, configured to, if the processing result indicates that the first host port information stored in the target database is not updated, then use the first host port information as the host port information of the container group Pod stored in the target database; and a second determining module, configured to, if the processing result indicates that the first host port information stored in the target database is updated, then use the obtained target host port information as the host port information of the container group Pod stored in the target database.
[0047] Furthermore, the device further includes: a first access unit, configured to access the container group Pod based on the target information after returning the target information to the client.
[0048] To achieve the above objectives, according to another aspect of this application, a processor is provided for running a program, wherein the program, when running, performs the information processing method described in any one of the above claims.
[0049] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, the electronic device including one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the information processing method described in any of the above.
[0050] This application employs the following steps: receiving a query request from a client, wherein the query request requests the host port information of a container group Pod, where the container group Pod is the smallest load unit in the container scheduling and management platform; responding to the query request, querying the host port information of the container group Pod from a target database to obtain target information, wherein the host port information of the container group Pod is pre-stored in the target database; and returning the target information to the client. This solves the problem in related technologies where the efficiency of obtaining the host port information of a container group Pod is low, affecting the effectiveness of accessing the container group Pod through its host port. By directly querying the host port information of the container group Pod from a database that pre-stores the host port information of the container group Pod based on the received query request from the client, and returning the queried host port information of the container group Pod to the client, the efficiency of obtaining the host port information of the container group Pod is improved, thereby improving the effectiveness of accessing the container group Pod through its host port. Attached Figure Description
[0051] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0052] Figure 1 This is a schematic diagram of a HostPort network solution provided based on existing technology;
[0053] Figure 2 This is a flowchart of an information processing method provided according to an embodiment of this application;
[0054] Figure 3 This is a flowchart of the information processing method provided in the embodiments of this application. Figure 1 ;
[0055] Figure 4 This is a flowchart of the information processing method provided in the embodiments of this application. Figure 2 ;
[0056] Figure 5 This is a schematic diagram of the reporting process in an embodiment of this application;
[0057] Figure 6 This is a schematic diagram of the query usage process in the embodiments of this application;
[0058] Figure 7 This is a schematic diagram of an information processing apparatus according to an embodiment of this application;
[0059] Figure 8 This is a schematic diagram of an electronic device provided according to an embodiment of this application. Detailed Implementation
[0060] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0061] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0062] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0063] It should be noted that all information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this disclosure are information and data authorized by the user or fully authorized by all parties. For example, this system has an interface with the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving consent from the aforementioned user or organization.
[0064] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:
[0065] Kubernetes (k8s): A container scheduling and management platform.
[0066] HostPort: Host port.
[0067] Node: Host node.
[0068] DNAT: Target address mapping.
[0069] Pod: The smallest unit of load in Kubernetes, a group of strongly related containers.
[0070] Kubelet: A management component for managing containerized instances of Kubernetes deployed on each host node of Node.
[0071] Pause container: The first container of a Pod, used to build the Pod's isolation resources.
[0072] The present invention will now be described in conjunction with preferred implementation steps. Figure 2 This is a flowchart of an information processing method provided according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:
[0073] Step S201: Receive a query request sent by the client. The query request is used to query the host port information of the container group Pod. The container group Pod is the smallest load unit in the container scheduling and management platform.
[0074] For example, the client mentioned above can be a browser or a client application, and the container scheduling and management platform mentioned above can be the Kubernetes (k8s) platform. The browser or client initiates an HTTP (Hypertext Transfer Protocol) request to query the host port information of the container group Pod.
[0075] Step S202: In response to the query request, query the host port information of the container group Pod from the target database to obtain the target information, wherein the host port information of the container group Pod is pre-stored in the target database.
[0076] For example, based on a request from a browser or client to query the host port information of a container group Pod, a query is performed in the database. Before querying the host port information of the container group Pod, when the Kubelet process starts or creates a Pod, the original Pod management module calls the interface of the container runtime service to query / create a Pause container. The Pause container contains all the port information of the Pod. Then, the Pod management module submits the Pod and Pause container information to the HostPort information processing module, and then the HostPort information processing module reports the host port information of the Pod to the database.
[0077] Step S203: Return the target information to the client.
[0078] For example, after retrieving the host port information of the Pod from the database, the host port information is sent to the browser or client.
[0079] Through the above steps S201 to S203, by querying the host port information of the container group Pod based on the request sent by the client, the host port information of the container group Pod is directly queried from the database that stores the host port information of the container group Pod in advance, and the queried host port information of the container group Pod is returned to the client, thereby improving the efficiency of obtaining the host port information of the container group Pod and thus improving the effect of accessing the container group Pod through the host port.
[0080] To quickly and accurately determine whether the host port information of a container group Pod is the same as the first host port information, the information processing method provided in this application embodiment can also determine whether the host port information of a container group Pod is the same as the first host port information by the following steps: obtaining the ID information of the target container, wherein the target container is the first container in the container group Pod; and determining whether the host port information of the container group Pod is the same as the first host port information based on the ID information of the target container, thereby obtaining the determination result.
[0081] For example, the HostPort information processing module verifies whether the latest Pause container information (Pause container ID and HostPort information) exists in the Pod's annotation (a field in the Pod) based on the latest Pause container ID (Identification) provided by the Pod management module.
[0082] In summary, by using the ID information of the Pause container, it is possible to quickly and accurately determine whether there is any latest host port information.
[0083] To quickly and accurately determine whether to update the first host port information stored in the target database, the information processing method provided in this application embodiment can also determine whether to update the first host port information stored in the target database through the following steps: if the target host port information is the same as the first host port information, then the first host port information stored in the target database is not updated; if the target host port information is different from the first host port information, then the first host port information stored in the target database is updated to the obtained target host port information.
[0084] For example, if the ID of the Pause container indicates that there is no updated host port information, the host port information of the Pod will not be updated. If the ID of the Pause container indicates that there is updated host port information, the reporting task will be automatically added to the task queue, and the Pause container ID and HostPort information will be cached in the map (module memory in the process). Then, the reporting task processing goroutine will retrieve the task from the task queue, retrieve the information from the map, and report it to the Pod's annotation. Furthermore, the data format is as follows: {Port mapping relationship: [{IP address, container port, host port, network protocol}, ...]; Pause container ID: specific container ID}.
[0085] The above method can quickly obtain the host port information of a Pod while ensuring the accuracy of the host port information.
[0086] like Figure 3 As shown, in the information processing method provided in this application embodiment, updating the first host port information stored in the target database to the obtained target host port information includes:
[0087] Step S301: Obtain the update result, wherein the update result is used to indicate whether the first host port information stored in the target database has been successfully updated to the obtained target host port information;
[0088] Step S302: If the update result indicates that updating the first host port information stored in the target database to the obtained target host port information failed, then resend the update request, wherein the update request is used to request updating the first host port information stored in the target database to the obtained target host port information.
[0089] For example, when a report fails, the reporting task is automatically added to the task queue, and the HostPort information and Pause container ID are cached in the map, automatically retrying the report. Moreover, when the task queue receives new Pause information, the new information is proactively set in the map, thereby overwriting the old information and ensuring that the latest information is always reported.
[0090] With the above solution, when a report fails, it can be resubmitted through an automatic retry mechanism, thereby improving the reliability of the reporting process.
[0091] To quickly and accurately determine the host port information of the container group Pod stored in the target database, the information processing method provided in this application embodiment can also determine the host port information of the container group Pod stored in the target database through the following steps: if the processing result indicates that the first host port information stored in the target database is not updated, then the first host port information is used as the host port information of the container group Pod stored in the target database; if the processing result indicates that the first host port information stored in the target database is updated, then the obtained target host port information is used as the host port information of the container group Pod stored in the target database.
[0092] For example, if the host port information of the Pod is not updated, the original host port information of the Pod will be used as the host port information of the container group Pod stored in the database; if it is determined that the host port information of the Pod will be updated, the latest host port information obtained will be used as the host port information of the container group Pod stored in the database.
[0093] Using the above method, the host port information of the container group Pod stored in the database can be obtained quickly and accurately.
[0094] like Figure 4 As shown, in the information processing method provided in this application embodiment, determining the host port information of the container group Pod stored in the target database includes:
[0095] Step S401: Obtain target host port information, wherein the target host port information is the host port information of the collected container group Pod;
[0096] Step S402: Determine whether the target host port information is the same as the first host port information, and obtain the determination result. The first host port information is the host port information of the container group Pod stored in the target database.
[0097] Step S403: Based on the judgment result, determine whether to update the first host port information stored in the target database, and obtain the processing result;
[0098] Step S404: Based on the processing results, determine the host port information of the container group Pod stored in the target database.
[0099] For example, the HostPort information processing module checks whether the latest Pause container information (Pause container ID and HostPort information) exists in the Pod's annotation based on the latest local Pause container ID provided by the Pod management module. If it is missing, it automatically adds the reporting task to the task queue and caches the Pause container ID and HostPort information in the map. Then, the reporting task processing coroutine retrieves the task from the task queue, retrieves the information from the map, and reports it to the Pod's annotation. In other words, it reports the latest host port information to the database and stores it there.
[0100] In summary, this ensures the accuracy of the host port information for container group Pods stored in the database.
[0101] To facilitate access to container group Pods, the information processing method provided in this application embodiment can also access container group Pods through the following steps: access container group Pods based on target information.
[0102] For example, based on the host port information of the Pod retrieved from the database, the container can be accessed through the host port.
[0103] The above method allows for convenient access to containers via host ports.
[0104] For example, Figure 5 This is a schematic diagram of the reporting process in an embodiment of this application, such as... Figure 5 As shown, the reporting process includes the following steps:
[0105] (1) When the Kubelet process starts or creates a Pod, the original Pod management module calls the interface of the container running service to query / create a Pause container, which contains all the port information of the Pod;
[0106] (2) When the Pod management module receives the queried container information, it automatically submits the Pod and Pause container information to the HostPort information processing module;
[0107] (3) The HostPort information processing module verifies whether the latest Pause container information (Pause container ID and HostPort information) exists in the Pod's annotation based on the latest Pause container ID provided by the Pod management module. If it is missing, it automatically adds the reporting task to the task queue and caches the Pause container ID and HostPort information in the map. The reporting task processing coroutine retrieves the task from the task queue and the information from the map, and reports it to the Pod's annotation. Example data format: {port mapping relationship: [{IP address, container port, host port, network protocol}, ...]; Pause container ID: specific container ID};
[0108] (4) When a report fails, the reporting task is automatically added to the task queue, and the HostPort information and Pause container ID are cached in the map, and the report is automatically retried. Furthermore, when the task queue receives new Pause information, the new information is proactively added to the map, thereby overwriting the old information and ensuring that the latest information is always reported. Additionally, Figure 5 In this context, "pod_××××" represents a record in the database.
[0109] For example, Figure 6 This is a schematic diagram of the query usage process in the embodiments of this application, such as... Figure 6 As shown, the query process includes the following steps:
[0110] (1) The browser’s user interface (UI) or the client initiates an HTTP request to the database (master) to query Pod information. The Pod’s annotation field contains the reported HostPort information, so a single network request can complete the query of HostPort.
[0111] The above solution simplifies the process of reporting and obtaining HostPort and Pod information, achieving advantages such as high reliability, strong real-time performance, low resource consumption (no need to deploy separate reporting and database components), and simple querying and usage.
[0112] In summary, the information processing method provided in this application, by receiving a query request sent by a client (the query request being used to request the host port information of a container group Pod, where the container group Pod is the smallest load unit in the container scheduling and management platform); responding to the query request, querying the host port information of the container group Pod from a target database to obtain target information (where the host port information of the container group Pod is pre-stored in the target database); and returning the target information to the client, solves the problem of low efficiency in obtaining the host port information of container group Pods in related technologies, which affects the effectiveness of accessing container group Pods through host ports. By directly querying the host port information of container group Pods from a database that pre-stores the host port information of container group Pods based on the received query request sent by the client, and returning the queried host port information of container group Pods to the client, the efficiency of obtaining the host port information of container group Pods is improved, thereby improving the effectiveness of accessing container group Pods through host ports.
[0113] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0114] This application also provides an information processing apparatus. It should be noted that the information processing apparatus of this application can be used to execute the information processing method provided in this application. The information processing apparatus provided in this application will be described below.
[0115] Figure 7 This is a schematic diagram of an information processing apparatus according to an embodiment of this application. Figure 7 As shown, the device includes: a first receiving unit 701, a first response unit 702, and a first return unit 703.
[0116] Specifically, the first receiving unit 701 is used to receive a query request sent by the client, wherein the query request is used to query the host port information of the container group Pod, and the container group Pod is the smallest load unit in the container scheduling and management platform.
[0117] The first response unit 702 is used to respond to the query request, query the host port information of the container group Pod from the target database, and obtain the target information, wherein the host port information of the container group Pod is pre-stored in the target database;
[0118] The first return unit 703 is used to return the target information to the client.
[0119] In summary, the information processing apparatus provided in this application embodiment receives a query request sent by a client through a first receiving unit 701. The query request requests the host port information of a container group Pod, where the container group Pod is the smallest load unit in the container scheduling and management platform. A first response unit 702 responds to the query request by querying the host port information of the container group Pod from a target database to obtain target information, wherein the host port information of the container group Pod is pre-stored in the target database. A first return unit 703 returns the target information to the client. This solves the problem in related technologies where the efficiency of obtaining the host port information of the container group Pod is low, affecting the effectiveness of accessing the container group Pod through its host port. By directly querying the host port information of the container group Pod from a database that pre-stores the host port information of the container group Pod based on the received query request sent by the client, and returning the queried host port information of the container group Pod to the client, the efficiency of obtaining the host port information of the container group Pod is improved, thereby improving the effectiveness of accessing the container group Pod through its host port.
[0120] Optionally, in the information processing apparatus provided in the embodiments of this application, the apparatus further includes: a first acquisition unit, configured to acquire target host port information before querying the host port information of the container group Pod from the target database in response to a query request, wherein the target host port information is the collected host port information of the container group Pod; a first judgment unit, configured to judge whether the target host port information is the same as the first host port information, and obtain a judgment result, wherein the first host port information is the host port information of the container group Pod stored in the target database; a first processing unit, configured to determine whether to update the first host port information stored in the target database based on the judgment result, and obtain a processing result; and a first determination unit, configured to determine the host port information of the container group Pod stored in the target database based on the processing result.
[0121] Optionally, in the information processing apparatus provided in the embodiments of this application, the first processing unit includes: a first processing module, configured to not update the first host port information stored in the target database if the target host port information is the same as the first host port information; and a second processing module, configured to update the first host port information stored in the target database to the obtained target host port information if the target host port information is different from the first host port information.
[0122] Optionally, in the information processing apparatus provided in the embodiments of this application, the apparatus further includes: a second acquisition unit, configured to acquire an update result after updating the first host port information stored in the target database to the acquired target host port information if the target host port information is different from the first host port information, wherein the update result is used to indicate whether the first host port information stored in the target database has been successfully updated to the acquired target host port information; and a first sending unit, configured to resend an update request if the update result indicates that the update of the first host port information stored in the target database to the acquired target host port information has failed, wherein the update request is used to request the update of the first host port information stored in the target database to the acquired target host port information.
[0123] Optionally, in the information processing apparatus provided in the embodiments of this application, the first judgment unit includes: a first acquisition module, used to acquire the ID information of the target container, wherein the target container is the first container in the container group Pod; and a first judgment module, used to determine whether the host port information of the container group Pod is the same as the first host port information based on the ID information of the target container, and obtain a judgment result.
[0124] Optionally, in the information processing apparatus provided in the embodiments of this application, the first determining unit includes: a first determining module, configured to, if the processing result indicates that the first host port information stored in the target database is not updated, then use the first host port information as the host port information of the container group Pod stored in the target database; and a second determining module, configured to, if the processing result indicates that the first host port information stored in the target database is updated, then use the obtained target host port information as the host port information of the container group Pod stored in the target database.
[0125] Optionally, in the information processing apparatus provided in the embodiments of this application, the apparatus further includes: a first access unit, configured to access the container group Pod based on the target information after returning the target information to the client.
[0126] The information processing device includes a processor and a memory. The first receiving unit 701, the first response unit 702, and the first return unit 703 are all stored in the memory as program units. The processor executes the program units stored in the memory to realize the corresponding functions.
[0127] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and adjusting kernel parameters can improve the performance of accessing container pods via host ports.
[0128] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0129] This invention provides a processor for running a program, wherein the program executes a method for processing the information during runtime.
[0130] like Figure 8 As shown, this embodiment of the invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps: receiving a query request sent by a client, wherein the query request is used to request the query of the host port information of a container group Pod, wherein the container group Pod is the smallest load unit in the container scheduling and management platform; responding to the query request, querying the host port information of the container group Pod from a target database to obtain target information, wherein the host port information of the container group Pod is pre-stored in the target database; and returning the target information to the client.
[0131] When the processor executes the program, it also implements the following steps: Before responding to the query request and querying the host port information of the container group Pod from the target database to obtain the target information, the method further includes: obtaining the target host port information, wherein the target host port information is the collected host port information of the container group Pod; determining whether the target host port information is the same as the first host port information, and obtaining a determination result, wherein the first host port information is the host port information of the container group Pod stored in the target database; determining whether to update the first host port information stored in the target database based on the determination result, and obtaining a processing result; and determining the host port information of the container group Pod stored in the target database based on the processing result.
[0132] When the processor executes the program, it also performs the following steps: based on the judgment result, it determines whether to update the first host port information stored in the target database, and the processing result includes: if the target host port information is the same as the first host port information, then the first host port information stored in the target database is not updated; if the target host port information is different from the first host port information, then the first host port information stored in the target database is updated to the obtained target host port information.
[0133] When the processor executes the program, it further implements the following steps: if the target host port information is different from the first host port information, after updating the first host port information stored in the target database to the obtained target host port information, the method further includes: obtaining an update result, wherein the update result is used to indicate whether the first host port information stored in the target database was successfully updated to the obtained target host port information; if the update result indicates that updating the first host port information stored in the target database to the obtained target host port information failed, then resending an update request, wherein the update request is used to request updating the first host port information stored in the target database to the obtained target host port information.
[0134] When the processor executes the program, it also performs the following steps: determining whether the target host port information is the same as the first host port information, and obtaining the determination result includes: obtaining the ID information of the target container, wherein the target container is the first container in the container group Pod; and determining whether the host port information of the container group Pod is the same as the first host port information based on the ID information of the target container, and obtaining the determination result.
[0135] When the processor executes the program, it also performs the following steps: Based on the processing result, determining the host port information of the container group Pod stored in the target database includes: if the processing result indicates that the first host port information stored in the target database is not updated, then the first host port information is used as the host port information of the container group Pod stored in the target database; if the processing result indicates that the first host port information stored in the target database is updated, then the obtained target host port information is used as the host port information of the container group Pod stored in the target database.
[0136] When the processor executes the program, it also performs the following steps: after returning the target information to the client, the method further includes: accessing the container group Pod based on the target information.
[0137] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.
[0138] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having the following method steps: receiving a query request sent by a client, wherein the query request is used to request querying the host port information of a container group Pod, the container group Pod being the smallest load unit in a container scheduling and management platform; responding to the query request, querying the host port information of the container group Pod from a target database to obtain target information, wherein the host port information of the container group Pod is pre-stored in the target database; and returning the target information to the client.
[0139] When executed on a data processing device, the method is also adapted to execute an initialization program with the following steps: before responding to the query request and querying the host port information of the container group Pod from the target database to obtain the target information, the method further includes: obtaining target host port information, wherein the target host port information is the collected host port information of the container group Pod; determining whether the target host port information is the same as first host port information, and obtaining a determination result, wherein the first host port information is the host port information of the container group Pod stored in the target database; determining whether to update the first host port information stored in the target database based on the determination result, and obtaining a processing result; and determining the host port information of the container group Pod stored in the target database based on the processing result.
[0140] When executed on a data processing device, it is also suitable to execute an initialization program with the following steps: based on the judgment result, determine whether to update the first host port information stored in the target database, and obtain the processing result including: if the target host port information is the same as the first host port information, then do not update the first host port information stored in the target database; if the target host port information is different from the first host port information, then update the first host port information stored in the target database to the obtained target host port information.
[0141] When executed on a data processing device, the method is also adapted to execute an initialization program with the following steps: after updating the first host port information stored in the target database to the obtained target host port information if the target host port information is different from the first host port information, the method further includes: obtaining an update result, wherein the update result is used to indicate whether the first host port information stored in the target database has been successfully updated to the obtained target host port information; if the update result indicates that updating the first host port information stored in the target database to the obtained target host port information has failed, then resending an update request, wherein the update request is used to request updating the first host port information stored in the target database to the obtained target host port information.
[0142] When executed on a data processing device, it is also suitable to execute an initialization program with the following steps: determining whether the target host port information is the same as the first host port information, and obtaining the determination result includes: obtaining the ID information of the target container, wherein the target container is the first container in the container group Pod; and determining whether the host port information of the container group Pod is the same as the first host port information based on the ID information of the target container, and obtaining the determination result.
[0143] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: based on the processing result, determining the host port information of the container group Pod stored in the target database includes: if the processing result indicates that the first host port information stored in the target database is not updated, then the first host port information is used as the host port information of the container group Pod stored in the target database; if the processing result indicates that the first host port information stored in the target database is updated, then the obtained target host port information is used as the host port information of the container group Pod stored in the target database.
[0144] When executed on a data processing device, it is also suitable to execute an initialization procedure having the following method steps: after returning the target information to the client, the method further includes: accessing the container group Pod based on the target information.
[0145] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0146] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0147] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0148] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0149] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0150] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0151] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0152] It should also be noted that 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 process, method, article, or apparatus. Unless otherwise specified, 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 that element.
[0153] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0154] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method of processing information, characterized by, The method comprises the following steps: receiving a query request sent by a client, wherein the query request is used to request to query host port information of a container group Pod, and the container group Pod is a minimum load unit in a container scheduling management platform; in response to the query request, querying the host port information of the container group Pod from a target database to obtain target information, wherein the host port information of the container group Pod is pre-stored in the target database, and the host port information of the container group Pod is stored in the target database according to a Pod management module and an information processing module; returning the target information to the client; before querying the host port information of the container group Pod from the target database to obtain the target information in response to the query request, the method further comprises the following steps: obtaining target host port information, wherein the target host port information is the collected host port information of the container group Pod; judging whether the target host port information is the same as first host port information to obtain a judgment result, wherein the first host port information is the host port information of the container group Pod stored in the target database; determining whether to perform update processing on the first host port information stored in the target database according to the judgment result to obtain a processing result; determining the host port information of the container group Pod stored in the target database based on the processing result.
2. The method of claim 1, wherein, determining whether to perform update processing on the first host port information stored in the target database according to the judgment result to obtain a processing result comprises: if the target host port information is the same as the first host port information, no update processing is performed on the first host port information stored in the target database; if the target host port information is not the same as the first host port information, the first host port information stored in the target database is updated to the obtained target host port information.
3. The method of claim 2, wherein, after if the target host port information is not the same as the first host port information, the first host port information stored in the target database is updated to the obtained target host port information, the method further comprises the following steps: obtaining an update result, wherein the update result is used to indicate whether the first host port information stored in the target database is successfully updated to the obtained target host port information; if the update result indicates that the first host port information stored in the target database is failed to be updated to the obtained target host port information, an update request is re-sent, wherein the update request is used to request to update the first host port information stored in the target database to the obtained target host port information.
4. The method of claim 1, wherein, judging whether the target host port information is the same as the first host port information to obtain a judgment result comprises: obtaining ID information of a target container, wherein the target container is the first container in the container group Pod; Determine whether the host port information of the container group Pod is the same as the first host port information according to the ID information of the target container, and obtain a determination result.
5. The method of claim 1, wherein, Determine the host port information of the container group Pod stored in the target database based on the processing result, including: If the processing result indicates that the first host port information stored in the target database is not updated, the first host port information is taken as the host port information of the container group Pod stored in the target database. If the processing result indicates that the first host port information stored in the target database is updated, the target host port information obtained is taken as the host port information of the container group Pod stored in the target database.
6. The method according to any one of claims 1 to 5, characterized in that, After returning the target information to the client, the method further includes: Access the container group Pod according to the target information.
7. An information processing apparatus, characterized by comprising: Comprising: A first receiving unit is configured to receive a query request sent by a client, wherein the query request is used to request to query host port information of a container group Pod, and the container group Pod is a minimum load unit in a container scheduling management platform; A first response unit is configured to respond to the query request, query the host port information of the container group Pod from a target database, and obtain target information, wherein the host port information of the container group Pod is pre-stored in the target database, and the host port information of the container group Pod is stored in the target database according to a Pod management module and an information processing module; A first returning unit is configured to return the target information to the client; The device further comprises a first obtaining unit configured to obtain target host port information before responding to the query request, querying the host port information of the container group Pod from a target database, and obtaining target information, wherein the target host port information is the host port information of the container group Pod collected; a first determining unit configured to determine whether the target host port information is the same as the first host port information, and obtain a determination result, wherein the first host port information is the host port information of the container group Pod stored in the target database; a first processing unit configured to determine whether to update the first host port information stored in the target database according to the determination result, and obtain a processing result; and a first determining unit configured to determine the host port information of the container group Pod stored in the target database based on the processing result.
8. A processor, comprising: The processor is configured to run a program, wherein the program is executed to perform the information processing method of any one of claims 1 to 6.
9. An electronic device, comprising: Comprise one or more processors and memories, the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the information processing method of any one of claims 1 to 6. The processor is configured to run a program, wherein the program is executed to perform the information processing method of any one of claims 1 to 6. Comprise one or more processors and memories, the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the information processing method of any one of claims 1 to 6.
Citation Information
Patent Citations
Test resource access method and device, electronic equipment and storage medium
CN114070883A