Image management method, system and readable storage medium

Through the mirror management method, the mirror synchronization process is optimized, the problem of low image synchronization management efficiency is solved, efficient image storage and synchronization is achieved, the mirror multiplexing rate and server bandwidth utilization are improved, and the impact of network failures on services is reduced.

CN115914260BActive Publication Date: 2025-08-22E SURFING VISION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211483193.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-24
Publication Date
2025-08-22
Estimated Expiration
2042-11-24

AI Technical Summary

Technical Problem

In the prior art, the image synchronization management efficiency is low, resulting in the image download bandwidth of enterprises or units becoming a bottleneck, and the existing image management server deployment cost is high.

Method used

Through the mirror management method, the mirror information reported by each node is received, the target image exists in the image mapping table and the shared cache, the dispatching node imports or downloads the image from the shared cache, avoiding bandwidth congestion caused by multiple nodes' simultaneous requests, and optimizes the image storage and synchronization process.

Benefits of technology

It improves the mirror synchronization rate, reduces node waiting time, improves the mirror multiplexing rate, saves bandwidth, improves the deployment efficiency of mirror management servers, and reduces the impact of network failures on services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115914260B_ABST
    Figure CN115914260B_ABST
Patent Text Reader

Abstract

The present application provides an image management method, system and readable storage medium. The present application can receive image information reported by each node; if it is found that there is no record of the target image, the record of the target image is inserted into the image mapping table; and the status of the target image is set to downloading; at the same time, the first node requesting the target image is scheduled to perform the download task, and the scheduling record is registered and the remaining nodes requesting the target image are notified to wait; bandwidth congestion and slow download speed can be avoided. After the download is completed, the image mapping table is updated, and the remaining nodes are notified to obtain the target image. The synchronization rate is increased and the waiting time of each node is reduced. It can effectively improve the image reuse rate of an enterprise or unit, improve the utilization rate of the enterprise or unit's resources within the limited resources of the enterprise or unit, and help the enterprise or unit manage images efficiently. Improve the deployment efficiency of the image management server of the enterprise or unit.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data processing, and in particular to an image management method, system, and readable storage medium. Background Art

[0002] With the development of cloud technology, K8s technology has become the foundation of cloud technology applications. Kubernetes, also known as K8s or Kube, is currently the most popular container orchestrator. Many enterprises or organizations generally use K8s technology to manage images. For example, some enterprises or organizations may have a server for storing images and may deploy multiple K8s clusters in different areas. As the business of an enterprise or organization develops, the number and scale of clusters continue to increase, and the services and frequency deployed by the enterprise or organization also increase significantly. The bandwidth of the server used by the enterprise or organization to store images may become a bottleneck for image downloads.

[0003] Based on this, some enterprises or organizations may further consider deploying an edge warehouse in each region to regularly synchronize images from the enterprise's central warehouse; or consider expanding the bandwidth of the enterprise's or organization's central warehouse, or modifying the architecture of the enterprise's or organization's central warehouse. The enterprise's or organization's central warehouse sets up regional nodes in multiple regions and synchronizes images through point-to-point technology. Each cluster downloads the image from the nearest regional node. However, this approach requires changing the original server deployment architecture of image management, which has high development costs. Summary of the Invention

[0004] The present application aims to solve at least one of the above-mentioned technical defects. In view of this, the present application provides a mirror management method, system and readable storage medium to solve the technical defect of low efficiency of mirror synchronization management in the prior art.

[0005] A mirror management method, comprising:

[0006] Receive mirror information reported by each node;

[0007] According to the image information reported by each node, determining whether a preset image mapping table contains a record of the target image required by each node;

[0008] If the image mapping table contains a record of the target image, determining whether the target image exists in the shared cache of the node requesting the target image;

[0009] If the image mapping table contains a record of the target image, and the shared cache of the node requesting the target image contains the target image, the node requesting the target image is scheduled to import the target image from the shared cache;

[0010] If the image mapping table does not contain a record of the target image, inserting a record of the target image into the image mapping table;

[0011] Setting the target image status to downloading;

[0012] Determining a first node that requests the target image;

[0013] Schedule the first node that requests the target image to execute the task of downloading the target image, register the scheduling record and notify the remaining nodes that request the target image to wait;

[0014] After the target image is downloaded, the target image is stored in a preset shared cache directory, the image mapping table is updated, and the remaining nodes requesting the target image are notified to obtain the target image from the preset shared cache directory.

[0015] Preferably, the method further comprises:

[0016] If the image mapping table contains a record of the target image, and the target image does not exist in the shared cache of the node requesting the target image, a node in the image mapping table containing the target image is randomly determined as the target node;

[0017] Scheduling the target node to export the target image to a preset shared cache directory;

[0018] All nodes requesting the target image are scheduled to import the target image from the preset shared cache directory.

[0019] Preferably, if the image mapping table contains a record of the target image, determining whether the target image exists in the shared cache of the node requesting the target image includes:

[0020] If the image mapping table contains a record of the target image, determining, based on the record of the target image in the image mapping table, whether the storage path of the target image includes a shared cache of the node requesting the target image;

[0021] If the storage path of the target image includes the shared cache of the node requesting the target image, it is determined that the target image exists in the shared cache of the node requesting the target image.

[0022] An image management system, comprising:

[0023] An image management control device, several nodes, and several image management clients;

[0024] Each of the nodes corresponds to an image management client, a workload of each node includes an initialization container component, and the image management control device includes an image management component;

[0025] Each initialization container component of the node sends a query instruction of the target image to the image management component;

[0026] The image management component receives the query instructions sent by each of the initialization container components, searches the preset image mapping table for a record of the target image according to each of the query instructions, and returns the query result of the target image to the initialization container component;

[0027] The initialization container component receives the query result of the target image and feeds it back to the node where the corresponding workload is located; if the query result of the target image is that the target image does not exist in the shared cache of the node, the image management client of the corresponding node obtains the information of the target image and reports it to the image management component;

[0028] The image management component receives the target image information sent by the image management client corresponding to each node requesting the target image, and analyzes the target image information to obtain the demand information of each node for the target image.

[0029] and searching the preset image mapping table and determining whether the image mapping table contains a record of the target image; if it is determined that the image mapping table does not contain a record of the target image, inserting the record of the target image into the image mapping table and setting the status of the target image to being downloaded; and simultaneously determining the first node requesting the target image, sending a first scheduling instruction to the image management client corresponding to the first node requesting the target image, registering the scheduling record and notifying the remaining nodes requesting the target image to wait, and feeding back relevant information of the target image to the initialization container component;

[0030] The image management client corresponding to the node that first requests the target image receives the first scheduling instruction, executes the task of downloading the target image according to the first scheduling instruction, and sends a first feedback instruction to the image management component after completing the task of downloading the target image, wherein the first feedback instruction includes feedback information that the download task of the target image has been completed;

[0031] After receiving the first feedback instruction, the image management component identifies the first feedback instruction, determines that the target image has been downloaded, stores the target image in a preset shared cache directory, updates the image mapping table, and notifies the remaining nodes requesting the target image to obtain the target image from the preset shared cache directory.

[0032] Preferably, if the image management component determines that the image mapping table contains a record of the target image, it determines whether the target image exists in the shared cache of the node requesting the target image;

[0033] If the image management component determines that the image mapping table contains a record of the target image, and the target image exists in the shared cache of the node requesting the target image, then the image management component feeds back relevant information of the target image to the initialization container component;

[0034] The initialization container component receives the relevant information of the target image fed back by the image management component, and then feeds it back to the image management client of the corresponding node to import the target image from the shared cache of the corresponding node.

[0035] Preferably, if the image management component determines that the image mapping table contains a record of the target image, and the target image does not exist in the shared cache of the node requesting the target image, a node in the image mapping table where the target image exists is randomly determined as the target node; relevant information about the target image is fed back to the initialization container component, and a second scheduling instruction is sent to the image management client corresponding to the target node;

[0036] After receiving the second scheduling instruction, the image management client corresponding to the target node exports the target image to a shared cache directory according to the second scheduling instruction and sends a second feedback instruction to the image management component, wherein the second instruction includes feedback information of exporting the target image to the preset shared cache directory;

[0037] After receiving the second feedback instruction, the image management component sends a third scheduling instruction to the image management client corresponding to each node requesting the target image;

[0038] After receiving the third scheduling instruction, the image management client corresponding to each node requesting the target image imports the target image from the preset shared cache directory according to the third scheduling instruction.

[0039] Preferably, after the initialization container component receives the relevant information of the target image fed back by the image management component, the initialization container component analyzes the relevant information of the target image to obtain an analysis result of the target image;

[0040] According to the analysis result of the target image, if it is determined that the image status of the target image is a preset first threshold, the status of the target image is fed back to the image management client corresponding to the node requesting the target image, and the operation is terminated.

[0041] Preferably, the image management and control device further comprises an injection component;

[0042] The injection component determines whether the initialization container component needs to be started by monitoring the request instructions created by each workload corresponding to each node.

[0043] A readable storage medium stores computer-readable instructions, which, when executed by one or more processors, enable the one or more processors to implement the steps of any of the image management methods described above.

[0044] As can be seen from the technical solutions described above, when a node needs to synchronize a target image, the method provided in the embodiment of the present application can receive the image information reported by each node; and based on the image information reported by each node, determine whether the preset image mapping table contains a record of the target image; if the image mapping table contains a record of the target image, it can further determine whether the target image exists in the shared cache of the node requesting the target image; if the image mapping table contains a record of the target image and the target image exists in the shared cache of the node requesting the target image, the node requesting the target image can be scheduled to import the target image from the shared cache of the node requesting the target image; if the image mapping table does not contain a record of the target image, the record of the target image can be inserted into the image mapping table; and the status of the target image can be set to downloading; at the same time, the first node requesting the target image can be determined; and the first node requesting the target image can be scheduled to execute the task of downloading the target image, while registering the scheduling record and notifying the remaining nodes requesting the target image to wait; so as to avoid all nodes requesting the target image requesting and downloading the target image at the same time, resulting in bandwidth congestion and slow download speed. After the target image is downloaded, it can be stored in a preset shared cache directory, the image mapping table can be updated, and other nodes requesting the target image can be notified to obtain the target image from the preset shared cache directory. This improves the synchronization rate of the target image and reduces the waiting time for each node to request the target image.

[0045] The method provided in the embodiments of the present application can effectively improve the image reuse rate of an enterprise or organization, improve the utilization rate of the enterprise or organization's limited resources, and help the enterprise or organization efficiently manage images. It improves the deployment efficiency of the enterprise or organization's image management server, saves the bandwidth of the enterprise or organization's image management server, and reduces the impact on the enterprise or organization's business during network failures. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments provided by the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0047] Figure 1 A schematic diagram of an image management system architecture according to an embodiment of the present application;

[0048] Figure 2 A flowchart of a method for implementing image management provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0050] Traditional image management methods typically involve enterprises or organizations deploying edge warehouses in various regions, which regularly synchronize images from the enterprise's central warehouse. Alternatively, as the enterprise's business expands, the bandwidth of the central warehouse is expanded, or the central warehouse architecture is modified, with the central warehouse setting up regional nodes in multiple regions. Images are synchronized via peer-to-peer (P2P) protocols, and clusters deployed in various regions download images from the nearest regional node. However, this approach requires changes to the existing image management server deployment architecture, resulting in high development costs and a disadvantageous scaling issue.

[0051] Given that most current image management solutions struggle to adapt to complex and ever-changing business needs, the applicant has developed an image management solution that can effectively increase an enterprise's or organization's image reuse rate, improve resource utilization within its limited resources, and help it efficiently manage images. This solution improves the deployment efficiency of an enterprise's or organization's image management servers, conserves bandwidth on its image management servers, and reduces the impact on its business during network failures.

[0052] The methods provided in the embodiments of the present application can be used in a variety of general-purpose or specialized computing device environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multi-processor devices, and distributed computing environments including any of the above.

[0053] An embodiment of the present application provides an image management solution, which can be applied to various data management systems and can also be applied to various computer terminals or smart terminals. Its execution entity can be the processor or server of the computer terminal or smart terminal.

[0054] The following combination Figure 1 , introduces an optional system architecture that can implement image management given in the embodiment of this application, such as Figure 1As shown, the system architecture may include: an image management control device, several nodes, and several image management clients.

[0055] Each of the nodes corresponds to one image management client, a workload of each node includes an initialization container component, and the image management control device may include an image management component.

[0056] In actual application, in order to better manage images, an enterprise or organization may build a dedicated server to store images.

[0057] For example, some companies or organizations may deploy a Harbor specifically for storing images. Harbor is an open source registry server project designed by a company for enterprise users. It includes essential enterprise features such as permission management (RBAC), LDAP, auditing, management interface, self-registration, HA, and other functions. It also includes features such as image replication and Chinese language support. Harbor is an enterprise-level registry server for storing and distributing Docker images. It extends the open source Docker Distribution by adding some enterprise-essential features such as security, identification, and management. As an enterprise-level private registry server, Harbor provides better performance and security. It improves the efficiency of users using the registry to build and run environments to transfer images.

[0058] As their business develops, some enterprises or organizations may deploy multiple k8s clusters in different areas. As their business continues to grow and develop, the number and scale of k8s clusters deployed by the enterprises or organizations may also continue to increase, and the services and frequency deployed by the enterprises or organizations will also increase significantly.

[0059] Therefore, in actual applications, enterprises may deploy multiple nodes to increase the reuse rate of images, and each node may correspond to an image management client. In actual applications, each image management client can be deployed on each k8s node through daemonset, and shared storage such as NFS can be mounted to each k8s node using PV. The read and write operations of each image management client are all stored in the same shared storage directory.

[0060] DaemonSet is also called a daemon set. Similar to a daemon process, a daemon set is deployed on a node that meets the matching conditions.

[0061] The image management client can regularly obtain the image information of the corresponding node and report it to the image management device. It is also responsible for executing the image download and import and export tasks issued by the image management device.

[0062] Therefore, each of the image management clients may be deployed in each node, and the image management client may be used to obtain and manage relevant information of the target image required by the corresponding node.

[0063] For example, each of the nodes can be a k8s node, and each of the image management clients can be deployed on each k8s node through daemonset. PV can be used to mount shared storage such as NFS to each k8s node, and the read and write operations of each of the image management clients are stored in the same shared storage directory. Each of the image management clients can regularly obtain the image information of the corresponding node and report it to the image management device, and is responsible for executing the image download and import and export tasks issued by the image management device.

[0064] For example,

[0065] Each initialization container component of each node may send a query instruction of the target image to the image management component;

[0066] The image management component receives query instructions sent by each initialization container component, can search the preset image mapping table for records of the target image based on each query instruction, and return the query result of the target image to the initialization container component.

[0067] The initialization container component receives the query result of the target image and feeds it back to the node where the corresponding workload is located; if the query result of the target image is that the target image does not exist in the shared cache of its node, the image management client of the node corresponding to it obtains the information of the target image and reports it to the image management component.

[0068] After receiving the target image requirement information from the image management client corresponding to each node requesting the target image, the image management component can further analyze the target image requirement information to obtain the target image requirement information of each node.

[0069] In actual application, the image management component can create an image mapping table to better manage images and provide image services for each node.

[0070] For example, the image management component can create an image mapping table to manage image information, use the image as an index, and record the storage information of the image in the image mapping table. The information stored in the image can be determined by querying the image mapping table.

[0071] The image management component may also provide an API interface for interaction between the initialization container component and the image management client.

[0072] Therefore, after receiving the target image requirement information, the image management component can search a preset image mapping table and determine whether the image mapping table contains a record for the target image. If it is determined that the image mapping table does not contain a record for the target image, the image management component can insert a record for the target image into the image mapping table and set the target image's status to be downloading. Furthermore, the component can determine the first node to request the target image and send a first scheduling instruction to the image management client corresponding to the first node to request the target image. To facilitate recording image processing progress, the image management component can also register this scheduling record.

[0073] In order to avoid multiple nodes downloading the target image at the same time and causing bandwidth congestion, while sending the first scheduling instruction to the image management client corresponding to the node that first requests the target image, the image management component can also notify the remaining nodes requesting the target image to wait.

[0074] After the image management client corresponding to the node that first requests the target image receives the first scheduling instruction, the image management client corresponding to the node that first requests the target image may execute the task of downloading the target image according to the first scheduling instruction.

[0075] For example, the image management client corresponding to the node that first requests the target image may download the target image from the storage target storing the target image according to the first scheduling instruction.

[0076] Generally, the central repository of an enterprise or unit can contain all images of the enterprise or unit. A cluster also has image information of each node.

[0077] Therefore, when the target image needs to be downloaded, the target image can be downloaded from the storage storing the target image.

[0078] After completing the task of downloading the target image, the image management client corresponding to the node that first requests the target image can further send a first feedback instruction to the image management component. The first feedback instruction includes feedback information that the download task of the target image has been completed, so that the image management component can timely understand the download progress of the target image.

[0079] For example, after the image management client corresponding to the first node requesting the target image completes the task of downloading the target image, it can send a feedback message to the image management component to notify the image management component that the target image has been downloaded. Therefore, after receiving the first feedback instruction, the image management component can further identify the first feedback instruction to understand whether the target image has been downloaded. When the image management component determines that the target image has been downloaded, it can further store the target image in a preset shared cache directory and update the image mapping table in a timely manner. At the same time, it can notify the remaining nodes requesting the target image to obtain the target image from the preset shared cache directory.

[0080] Furthermore,

[0081] When the image management component determines that the image mapping table contains a record of the target image or an associated record of the target image request node, it means that the target image may already exist in the node and there is no need to download the target image again from the storage directory where the target image is stored.

[0082] Therefore, when the image management component determines that the image mapping table contains a record of the target image or an associated record of the target image requesting node, it can further determine whether the target image exists in the shared cache of the node requesting the target image.

[0083] If the image management component determines that the image mapping table contains a record of the target image, and the target image exists in the shared cache of the node requesting the target image, relevant information about the target image may be fed back to the initialization container component.

[0084] The initialization container component receives the relevant information of the target image fed back by the image management component, and then feeds it back to the image management client of the corresponding node to import the target image from the shared cache of the corresponding node.

[0085] Further,

[0086] If the image management component determines that the image mapping table has a record of the target image, and finds that the target image does not exist in the shared cache of the node requesting the target image, it means that the image management component needs to download the target image from the node storing the target image.

[0087] Therefore, if the image management component determines that there is a record of the target image in the image mapping table, and finds that the target image does not exist in the shared cache of the node requesting the target image, the image management component can randomly determine a node in the image mapping table where the target image exists as the target node; and feedback relevant information of the target image to the initialization container component, and at the same time, can send a second scheduling instruction to the image management client corresponding to the target node, wherein the second scheduling instruction may include scheduling the image management client corresponding to the target node to export the target image to the preset shared cache directory.

[0088] As can be seen from the above description, the second scheduling instruction may include scheduling the image management client corresponding to the target node to export the target image to a shared cache directory. Therefore, after receiving the second scheduling instruction, the image management client corresponding to the target node may export the target image to the preset shared cache directory according to the second scheduling instruction. At the same time, a second feedback instruction may be sent to the image management component, wherein the second instruction includes feedback information on exporting the target image to the preset shared cache directory; so that the image management component can be notified as to whether the target image has been exported to the preset shared cache directory.

[0089] After receiving the second feedback instruction, the image management component can determine that the target node has exported the target image to the preset shared cache directory. Therefore, a third scheduling instruction can be sent to the image management client corresponding to each node requesting the target image, wherein the third scheduling instruction may include relevant instructions for scheduling the image management client corresponding to each node requesting the target image to import the target image from the shared cache.

[0090] As can be seen from the above description, the third scheduling instruction may include instructions for scheduling the image management client corresponding to each node requesting the target image to import the target image from the shared cache. Therefore, after receiving the third scheduling instruction, the image management client corresponding to each node requesting the target image may import the target image from the preset shared cache according to the third scheduling instruction.

[0091] Furthermore,

[0092] After the initialization container component receives the relevant information of the target image fed back by the image management component, the initialization container component can also analyze the relevant information of the target image to obtain the analysis result of the target image. Based on the analysis result of the target image, if the initialization container component determines that the image status of the target image is a preset first threshold, it means that the image management device cannot provide the target image for the node requesting the target image. The initialization container component can then feed back the status of the target image to the image management client corresponding to the node requesting the target image and end the operation.

[0093] in,

[0094] The initialization container component can obtain relevant information of the target image through the interface of the image management component.

[0095] The preset first threshold can be set according to actual application requirements.

[0096] For example,

[0097] The preset first threshold may be set to done.

[0098] When it is found that the image status is done or the image status has not all changed to done for more than 30 seconds, the initialization container component will end its operation, and each node will enter the next life cycle to complete a new startup process.

[0099] Furthermore, the image management control device of the image management system may further include an injection component.

[0100] The injection component may determine whether the initialization container component needs to be started by monitoring request instructions created by each workload corresponding to each node.

[0101] The conditions for starting the initialization container component may include:

[0102] If a preset label is injected into the annotation of the workload corresponding to each node, it means that the workload corresponding to each node has created a request instruction. When the workload corresponding to the node that created the request instruction is started, the initialization container component is started.

[0103] As can be seen from the technical solutions described above, the image management system provided by the embodiments of the present application can effectively improve the image reuse rate of an enterprise or organization, improve the utilization rate of the enterprise or organization's limited resources, and help the enterprise or organization manage images efficiently. It improves the deployment efficiency of the enterprise or organization's image management server, saves the bandwidth of the enterprise or organization's image management server, and reduces the impact on the enterprise or organization's business during network failures.

[0104] The following combination Figure 2 , introduces the process of the image management method given in the embodiment of this application, such as Figure 2 As shown, the process can include the following steps:

[0105] Step S101: receiving mirror information reported by each node.

[0106] Specifically, in actual application, the method provided in the embodiment of the present application can receive the mirror information reported by each node in real time, so that the preset mirror mapping table can be updated according to the mirror information reported by each node.

[0107] As can be seen from the above description, when a node needs to request the target image, the method provided in the embodiment of the present application can receive the image information reported by each node, so as to determine the relevant information of each node on the target image required by each node by analyzing the image information reported by each node.

[0108] The image information may include relevant information for requesting the target image.

[0109] The method provided in the embodiment of the present application can simultaneously receive the mirror information reported by multiple nodes, wherein the mirror information may include relevant information of multiple target mirrors.

[0110] Step S102 : judging whether a preset image mapping table contains a record of the target image required by each node based on the image information reported by each node.

[0111] Specifically, as can be seen from the above introduction, when a node needs to request the target image, the method provided in the embodiment of the present application can receive the image information reported by each node.

[0112] The image information reported by each node may include relevant information requested by each node for the target image.

[0113] Therefore, after receiving the image information reported by each node, it can be determined whether the preset image mapping table contains a record of the target image requested by each node based on the image information reported by each node.

[0114] If it is determined that the image mapping table contains a record of the target image, it means that the storage path of the target image may be known through the record of the target image in the image mapping table. If the target image exists or there is an association between the node requesting the target image, it means that the node requesting the target image may already have the target image and may not need to download the target image again.

[0115] Therefore, if it is determined that there is no associated record of the target image or the requesting node in the image mapping table, step S103 may be executed.

[0116] Step S103: Determine whether the target image exists in the shared cache of the node requesting the target image.

[0117] Specifically, from the above introduction, it can be seen that when a node needs to request the target image, the method provided in the embodiment of the present application can receive the image information reported by each node, and based on the image information reported by each node, determine whether the preset image mapping table contains a record of the target image.

[0118] If the target image has a record in the image mapping table, it means that the storage path of the target image may be known through the record of the target image in the image mapping table, and it may be unnecessary to download the target image again.

[0119] In order to further confirm whether the target image needs to be downloaded again, it may be further determined whether the target image exists in the shared cache of the node requesting the target image.

[0120] If the image mapping table contains a record of the target image, and the target image exists in the shared cache of the node requesting the target image, it means that the target image does not need to be downloaded again, and step S104 can be executed.

[0121] Step S104: Schedule the node requesting the target image to import the target image from the shared cache.

[0122] Specifically, from the above introduction, it can be seen that when a node needs to request the target image, the method provided in the embodiment of the present application can receive the image information reported by each node, and based on the image information reported by each node, determine whether the preset image mapping table contains a record of the target image.

[0123] When it is determined that a record of the target image exists in the image mapping table, a further determination is made as to whether the target image exists in the shared cache of the node requesting the target image. If a record of the target image exists in the image mapping table and the target image exists in the shared cache of the node requesting the target image, it indicates that the target image does not need to be re-downloaded. The node requesting the target image can then be scheduled to import the target image from the shared cache.

[0124] If the image mapping table does not contain a record of the target image, it indicates that a record of the target image needs to be inserted into the image mapping table. Therefore, when it is determined that the image mapping table does not contain a record of the target image, step S105 can be executed.

[0125] Step S105: inserting a record of the target image into the image mapping table.

[0126] Specifically, as can be seen from the above introduction, the method provided in the embodiment of the present application can determine whether there is a record of the target image in the image mapping table.

[0127] When it is determined that the image mapping table does not contain a record of the target image, it indicates that a record about the target image needs to be inserted into the image mapping table.

[0128] Therefore, when it is determined that the image mapping table does not have a record of the target image, the record of the target image can be inserted into the image mapping table so that when another node requests the target image next time, services can be provided to other nodes requesting the target image in a timely manner.

[0129] Step S106: setting the status of the target image to downloading.

[0130] Specifically, as can be seen from the above introduction, the method provided in the embodiment of the present application can insert a record of the target image into the image mapping table when it is determined that the record of the target image does not exist in the image mapping table.

[0131] After inserting the record of the target image into the image mapping table, the method provided in the embodiment of the present application can also set the status of the target image to downloading, so that during the period when the image mapping table is updated but the target image is not downloaded, if other nodes requesting the target image are received, the status of the target image can be understood.

[0132] Step S107: determining the first node that requests the target image.

[0133] Specifically, as can be seen from the above introduction, the method provided in the embodiment of the present application can set the status of the target image to downloading after inserting the record of the target image into the image mapping table.

[0134] After the state of the target image is set to downloading, the target image needs to be downloaded.

[0135] In order to improve the downloading efficiency of the target image, the first node requesting the target image may be determined among all nodes that have received requests for the target image, so that the first node requesting the target image may be scheduled to execute the task of downloading the target image.

[0136] Step S108 : Schedule the first node that requests the target image to execute the task of downloading the target image, register the scheduling record and notify the remaining nodes that request the target image to wait.

[0137] Specifically, as can be seen from the above introduction, the method provided in the embodiment of the present application can determine the first node requesting the target image among all nodes that have received requests for the target image.

[0138] After determining the first node requesting the target image, to reduce the waiting time of the first node requesting the target image, the first node requesting the target image can be scheduled to perform the task of downloading the target image, and a scheduling record can be simultaneously registered. To avoid bandwidth congestion caused by multiple nodes downloading the target image simultaneously, after scheduling the first node requesting the target image to perform the task of downloading the target image, the remaining nodes requesting the target image can be notified to wait. This prevents all nodes requesting the target image from downloading the target image simultaneously, reducing the target download rate.

[0139] Step S109: After the target image is downloaded, the target image is stored in a preset shared cache directory, the image mapping table is updated, and the remaining nodes requesting the target image are notified to obtain the target image from the preset shared cache directory.

[0140] Specifically, as can be seen from the above introduction, the method provided in the embodiment of the present application can schedule the first node that requests the target image to execute the task of downloading the target image.

[0141] After the target image is downloaded completely, the target image may be stored in a preset shared cache directory, and the image mapping table may be updated.

[0142] Since in the process of scheduling the first node requesting the target image to execute the task of downloading the target image, the remaining nodes requesting the target image have been notified to wait.

[0143] Therefore, after the target image is downloaded, since the target image has been stored in the preset shared cache directory, the remaining nodes requesting the target image can be notified to obtain the target image from the preset shared cache directory.

[0144] As can be seen from the technical solutions described above, the image management method provided by the embodiments of the present application can effectively improve the image reuse rate of an enterprise or organization, improve the utilization rate of the enterprise or organization's limited resources, and help the enterprise or organization manage images efficiently. It improves the deployment efficiency of the enterprise or organization's image management server, saves the bandwidth of the enterprise or organization's image management server, and reduces the impact on the enterprise or organization's business during network failures.

[0145] In actual application, even if the target image mapping table contains a record of the target image, the target image may not exist in the shared cache. If the shared cache of the node requesting the target image does not contain the target image, the implementation method for the node requesting the target image to obtain the target image will be different.

[0146] Therefore, the method provided in the embodiment of the present application can also provide another implementation method for obtaining the target image when it is determined that the image mapping table has a record of the target image and the target image does not exist in the shared cache of the node requesting the target image. The process is described below, which may include:

[0147] Step S201: randomly determine a node in the image mapping table where the target image exists as a target node.

[0148] Specifically, when it is determined that there is a record of the target image in the image mapping table, and the target image does not exist in the shared cache of the node requesting the target image, it means that the target image does not exist in the shared cache of the node requesting the target image. If the target image does not exist in the shared cache of the node requesting the target image, it is necessary to re-download the target image to the preset shared cache directory so that the image synchronization service can be provided for the node requesting the target image.

[0149] From the above introduction, we can see that the central warehouse of an enterprise or unit generally stores all the images of the enterprise or unit.

[0150] Therefore, when it is found that the shared cache of the node requesting the target image does not have the target image, if a request is made directly to the central warehouse storing the target image to download the target image, the pressure on the central warehouse storing the target image will also increase.

[0151] Therefore, when it is found that the shared cache of the node requesting the target image does not have the target image, a node that has the target image can be randomly determined in the image mapping table as the target node, so that the target image can be requested to be downloaded from the target node.

[0152] Step S202: Schedule the target node to export the target image to a preset shared cache directory.

[0153] Specifically, as can be seen from the above description, the method provided in the embodiment of the present application can determine whether the target image exists on the target node. Therefore, after determining the target node, the target node can be scheduled to export the target image to the preset shared cache directory, so that the image synchronization service can be provided to the node requesting the target image.

[0154] Step S203: Schedule all nodes requesting the target image to import the target image from the preset shared cache directory.

[0155] Specifically, as can be seen from the above introduction, the method provided in the embodiment of the present application can schedule the target node to export the target image to the preset shared cache directory.

[0156] After the target node is scheduled to export the target image to the preset shared cache directory, the target image exists in the preset shared cache directory, and the node requesting the target image can import the target image from the preset shared cache directory. Therefore, after the target node is scheduled to export the target image to the preset shared cache directory, all nodes requesting the target image can be scheduled to import the target image from the preset shared cache directory. The node requesting the target image does not need to request the target image from the central warehouse storing the target image, which can reduce the processing pressure of the central warehouse to a certain extent.

[0157] It can be seen from the technical solution introduced above that, when it is determined that there is a record of the target image in the image mapping table, and the target image does not exist in the shared cache of the node requesting the target image, the image management method provided in the embodiment of the present application can also randomly determine a node in the image mapping table where the target image exists as the target node; and schedule the target node to export the target image to the shared cache directory; after scheduling the target node to export the target image to the shared cache directory, all nodes requesting the target image are scheduled to import the target image from the preset shared cache directory. The method provided in the embodiment of the present application can effectively improve the image reuse rate of an enterprise or unit, improve the utilization rate of the enterprise or unit's resources within the limited resources of the enterprise or unit, and help the enterprise or unit to manage images efficiently. It improves the deployment efficiency of the enterprise or unit's image management server, saves the bandwidth of the enterprise or unit's image management server, and reduces the impact of the enterprise or unit on the business of the enterprise or unit during network failures.

[0158] As can be seen from the above description, if the image mapping table contains a record of the target image, the method provided in the embodiment of the present application can determine whether the target image exists in the shared cache of the node requesting the target image. The following describes the judgment process, which may include the following structural steps:

[0159] Step S301 : judging whether the storage path of the target image includes a shared cache according to the record of the target image in the image mapping table.

[0160] Specifically, from the above introduction, it can be seen that the image mapping table records the storage information of each image stored in all nodes in the cluster. If the image mapping table contains a record of the target image, it means that the storage path of the target image can be understood through the record of the target image.

[0161] Therefore, if it is determined that the image mapping table has a record of the target image, it can be determined whether the storage path of the target image includes the shared cache of the node requesting the target image based on the record of the target image in the image mapping table.

[0162] If it is determined that the storage path of the target image includes the shared cache of the node requesting the target image, it means that the target image exists in the shared cache of the node requesting the target image.

[0163] Step S302: Determine whether the target image exists in the shared cache of the node requesting the target image.

[0164] Specifically, based on the record of the target image in the image mapping table, if it is determined that the storage path of the target image includes the shared cache of the node requesting the target image, it means that the target image exists in the shared cache of the node requesting the target image.

[0165] Therefore, after determining that the storage path of the target image includes the shared cache of the node requesting the target image, it can be determined that the target image exists in the shared cache of the node requesting the target image.

[0166] It can be seen from the technical solutions introduced above that the image management method provided by the embodiment of the present application can determine whether the target image exists in the shared cache of the node requesting the target image when it is determined that there is a record of the target image in the image mapping table, so that all nodes requesting the target image can be scheduled to import the target image from the shared cache of the node requesting the target image. The node requesting the target image does not need to request the target image from the central warehouse storing the target image, which can reduce the processing pressure of the central warehouse to a certain extent. The method provided by the embodiment of the present application can effectively improve the image reuse rate of an enterprise or unit, improve the utilization rate of the enterprise or unit's resources within the limited resources of the enterprise or unit, and can help the enterprise or unit manage images efficiently. It improves the deployment efficiency of the image management server of the enterprise or unit, saves the bandwidth of the image management server of the enterprise or unit, and reduces the impact of the enterprise or unit on the business of the enterprise or unit during network failure.

[0167] An embodiment of the present application further provides a readable storage medium, which may store a program suitable for execution by a processor, wherein the program is used to implement various processing flows of the aforementioned terminal in the image management solution.

[0168] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.

[0169] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0170] The above description of the disclosed embodiments is intended to enable those skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. The various embodiments may be combined with one another. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A mirror management method, characterized in that: include: Receive mirror information reported by each node; According to the image information reported by each node, determining whether a preset image mapping table contains a record of the target image required by each node; If the image mapping table contains a record of the target image, determining whether the target image exists in the shared cache of the node requesting the target image; If the image mapping table contains a record of the target image, and the shared cache of the node requesting the target image contains the target image, the node requesting the target image is scheduled to import the target image from the shared cache; If the image mapping table does not contain a record of the target image, inserting a record of the target image into the image mapping table; Setting the target image status to downloading; Determining a first node that requests the target image; Schedule the first node that requests the target image to execute the task of downloading the target image, register the scheduling record and notify the remaining nodes that request the target image to wait; After the target image is downloaded, the target image is stored in a preset shared cache directory, the image mapping table is updated, and the remaining nodes requesting the target image are notified to obtain the target image from the preset shared cache directory; The method further includes: If the image mapping table contains a record of the target image, and the target image does not exist in the shared cache of the node requesting the target image, a node in the image mapping table containing the target image is randomly determined as the target node; Scheduling the target node to export the target image to a preset shared cache directory; All nodes requesting the target image are scheduled to import the target image from the preset shared cache directory.

2. The method according to claim 1, characterized in that If the image mapping table contains a record of the target image, determining whether the target image exists in the shared cache of the node requesting the target image includes: If the image mapping table contains a record of the target image, determining, based on the record of the target image in the image mapping table, whether the storage path of the target image includes a shared cache of the node requesting the target image; If the storage path of the target image includes the shared cache of the node requesting the target image, it is determined that the target image exists in the shared cache of the node requesting the target image.

3. An image management system related to an image management method according to claim 1, characterized in that: include: An image management control device, several nodes, and several image management clients; Each of the nodes corresponds to an image management client, a workload of each node includes an initialization container component, and the image management control device includes an image management component; Each initialization container component of the node sends a query instruction of the target image to the image management component; The image management component receives the query instructions sent by each of the initialization container components, searches the preset image mapping table for a record of the target image according to each of the query instructions, and returns the query result of the target image to the initialization container component; The initialization container component receives the query result of the target image and feeds it back to the node where the corresponding workload is located; if the query result of the target image is that the target image does not exist in the shared cache of the node, the image management client of the corresponding node obtains the information of the target image and reports it to the image management component; The image management component receives the target image information sent by the image management client corresponding to each node requesting the target image, and analyzes the target image information to obtain the demand information of each node for the target image. and searching the preset image mapping table and determining whether the image mapping table contains a record of the target image; if it is determined that the image mapping table does not contain a record of the target image, inserting the record of the target image into the image mapping table and setting the status of the target image to being downloaded; and simultaneously determining the first node requesting the target image, sending a first scheduling instruction to the image management client corresponding to the first node requesting the target image, registering the scheduling record and notifying the remaining nodes requesting the target image to wait, and feeding back relevant information of the target image to the initialization container component; The image management client corresponding to the node that first requests the target image receives the first scheduling instruction, executes the task of downloading the target image according to the first scheduling instruction, and sends a first feedback instruction to the image management component after completing the task of downloading the target image, wherein the first feedback instruction includes feedback information that the download task of the target image has been completed; After receiving the first feedback instruction, the image management component identifies the first feedback instruction, determines that the target image has been downloaded, stores the target image in a preset shared cache directory, updates the image mapping table, and notifies the remaining nodes requesting the target image to obtain the target image from the preset shared cache directory.

4. The system according to claim 3, characterized in that If the image management component determines that the image mapping table contains a record of the target image, then determining whether the target image exists in the shared cache of the node requesting the target image; If the image management component determines that the image mapping table contains a record of the target image, and the target image exists in the shared cache of the node requesting the target image, then the image management component feeds back relevant information of the target image to the initialization container component; The initialization container component receives the relevant information of the target image fed back by the image management component, and then feeds it back to the image management client of the corresponding node to import the target image from the shared cache of the corresponding node.

5. The system according to claim 4, characterized in that If the image management component determines that the image mapping table contains a record of the target image, and the target image does not exist in the shared cache of the node requesting the target image, then randomly determining a node in the image mapping table where the target image exists as the target node; feeding back relevant information about the target image to the initialization container component, and sending a second scheduling instruction to the image management client corresponding to the target node; After receiving the second scheduling instruction, the image management client corresponding to the target node exports the target image to a shared cache directory according to the second scheduling instruction and sends a second feedback instruction to the image management component, wherein the second feedback instruction includes feedback information of exporting the target image to the preset shared cache directory; After receiving the second feedback instruction, the image management component sends a third scheduling instruction to the image management client corresponding to each node requesting the target image; After receiving the third scheduling instruction, the image management client corresponding to each node requesting the target image imports the target image from the preset shared cache directory according to the third scheduling instruction.

6. The system according to any one of claims 3 to 5, characterized in that: After the initialization container component receives the relevant information of the target image fed back by the image management component, the initialization container component analyzes the relevant information of the target image to obtain an analysis result of the target image; According to the analysis result of the target image, if it is determined that the image status of the target image is a preset first threshold, the status of the target image is fed back to the image management client corresponding to the node requesting the target image, and the operation is terminated.

7. The system according to any one of claims 3 to 5, characterized in that: The image management and control device further includes an injection component; The injection component determines whether the initialization container component needs to be started by monitoring the request instructions created by each workload corresponding to each node.

8. The system according to claim 7, characterized in that The conditions for starting the initialization container component include: If a preset label is injected into the annotation of the workload corresponding to each node, it means that the workload corresponding to each node has created a request instruction. When the workload corresponding to the node that created the request instruction is started, the initialization container component is started.

9. A readable storage medium, characterized in that: The readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors implement the steps of the image management method according to any one of claims 1 to 2.

Citation Information

Patent Citations

  • Deep learning platform container mirror image acquisition method and system and deep learning platform container mirror image sharing method and system

    CN111131487A

  • Container mirror image sharing method and device, server, equipment and medium

    CN112799780A