A mirror backup method and device, electronic equipment and readable storage medium

By building a local repository when nodes start up and using a polling mechanism to back up images, the problems of large network bandwidth and disk space consumption for image repository data synchronization are solved, thus achieving high availability of the cluster.

CN113886021BActive Publication Date: 2026-05-29ZHENGZHOU YUNHAI INFORMATION TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHENGZHOU YUNHAI INFORMATION TECH CO LTD
Filing Date
2021-10-21
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

In existing technologies, data synchronization of mirror warehouses needs to be performed on all nodes, resulting in high network bandwidth and disk space consumption, which affects the high availability of the cluster.

Method used

A non-consistent distributed backup mechanism is adopted. A local repository is built when the node starts up, necessary images are obtained through node tags, and a round-robin mechanism is used to back up images with fewer than two backups to ensure high availability of the cluster.

Benefits of technology

This reduces the network bandwidth and disk space usage of image transmission and storage, ensuring that the cluster can still operate normally when nodes fail, thus achieving high availability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113886021B_ABST
    Figure CN113886021B_ABST
Patent Text Reader

Abstract

The application discloses a mirror backup method and device, electronic equipment and a computer readable storage medium. The method comprises the following steps: starting a mirror warehouse service, and constructing a node local warehouse; acquiring a node label, acquiring a node mirror corresponding to the node label from a complete mirror warehouse, and saving the node mirror to the node local warehouse; if it is detected that polling backup of a target mirror is required, acquiring the target mirror from the complete mirror warehouse, and saving the target mirror to the node local warehouse; the target mirror is a mirror which does not exist in the node local warehouse and the number of backup is less than two; the method adopts a non-consistent distributed backup mechanism to backup the mirror, all the mirrors have at least two backups in the cluster, when any node is abnormal, all the mirrors in the cluster can be guaranteed, the high availability of the cluster is guaranteed, and the bandwidth and disk space occupied by mirror transmission and storage can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of mirror technology, and in particular to a mirror backup method, mirror backup device, electronic device, and computer-readable storage medium. Background Technology

[0002] Container technology is now widely used in various fields. Container startup requires a container image, and the storage and download of container images are obtained from an image repository. High availability means that the services provided by the cluster remain unaffected when one or more nodes in the cluster fail. To ensure the high availability of the image repository, local image repository services are typically enabled on all nodes in the cluster, all accessing the image repository service of a unified VIP (a virtual IP address in the high-availability cluster; if the node hosting the VIP fails, the VIP will migrate to another node). This way, even after the VIP's node fails and it migrates to another node, the image repository service can still be provided through the VIP. However, this solution requires all nodes to synchronize the image repository data, consuming significant network bandwidth and disk space.

[0003] Therefore, the problems of large network bandwidth and disk space consumption in related technologies are technical problems that need to be solved by those skilled in the art. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide a mirror backup method, mirror backup device, electronic device and computer-readable storage medium that reduces the occupation of network bandwidth and disk space.

[0005] To address the aforementioned technical problems, this application provides a mirror backup method, comprising:

[0006] Start the image repository service and build the local repository on the node;

[0007] Obtain the node tag, retrieve the node image corresponding to the node tag from the full image repository, and save the node image to the local repository of the node;

[0008] If a polling backup of the target image is detected, the target image is retrieved from the complete image repository and saved to the node's local repository; the target image is an image that does not exist in the node's local repository and has a backup count of less than two.

[0009] Optionally, obtaining the node image corresponding to the node tag from the complete image repository includes:

[0010] If the node label is a blank label, then the base image is obtained from the complete image repository as the node image;

[0011] If the node label is a non-blank label, then according to the preset configuration, several non-base images are determined in the complete image repository, and the base image and the non-base image are obtained as the node image.

[0012] Optionally, detecting the need for polling backups of the target image includes:

[0013] Based on the polling list, determine whether it is a backup node;

[0014] If it is the backup node, then check if the target image exists;

[0015] If the target image exists, it is determined that a polling backup of the target image is required.

[0016] Optionally, detecting the existence of a target image includes:

[0017] Detect the number of backups corresponding to each image to be backed up in the complete image repository;

[0018] The target image is defined as all or part of the images to be backed up that have a backup quantity of less than two and are not present in the local repository of the node.

[0019] Optionally, it also includes:

[0020] Obtain the label update instruction, and update the node label according to the label update instruction to obtain the updated label;

[0021] The updated image is determined based on the updated tag, and the updated image is obtained from the repository of other nodes corresponding to other nodes in the cluster;

[0022] The updated label is determined as the new node label, and the updated image is stored in the node's local repository.

[0023] Optionally, it also includes:

[0024] If an anomaly is detected in the repository of another node on another node in the cluster, the number of backups corresponding to each image in the cluster is obtained;

[0025] If a polling backup of a specified image is detected, the specified image is obtained from the repository of the other node where the specified image is located, and the specified image is saved to the local repository of the node; the specified image is an image that does not exist in the local repository of the node and the number of backups is less than two.

[0026] Optionally, it also includes:

[0027] If a mirror repository failure occurs, the local repository on the node will be restored.

[0028] The node image corresponding to the node tag is obtained from the other node repository of other nodes in the cluster, and the node image is saved to the local repository of the node.

[0029] This application also provides a mirror backup device, including:

[0030] The startup module is used to start the image repository service and build the local repository on the node;

[0031] The first backup module is used to obtain node tags, retrieve the node image corresponding to the node tag from the complete image repository, and save the node image to the local repository of the node;

[0032] The second backup module is used to retrieve the target image from the complete image repository and save the target image to the node's local repository if a polling backup of the target image is detected.

[0033] This application also provides an electronic device, including a memory and a processor, wherein:

[0034] The memory is used to store computer programs;

[0035] The processor is used to execute the computer program to implement the above-described image backup method.

[0036] This application also provides a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the above-described mirror backup method.

[0037] The image backup method provided in this application starts the image repository service and builds a local node repository; obtains the node tag, retrieves the node image corresponding to the node tag from the complete image repository, and saves the node image to the local node repository; if it is detected that a polling backup of the target image is required, the target image is retrieved from the complete image repository and saved to the local node repository; the target image is an image that does not exist in the local node repository and whose backup quantity is less than two.

[0038] As can be seen, this method employs a non-consistent distributed backup mechanism to back up images, applied to nodes in the cluster. Specifically, each node builds its own local repository upon startup. In this application, each node is assigned a node tag, indicating its type; different node types require different images. Based on the node tag, the corresponding node image can be retrieved from the complete image repository and stored locally, ensuring the normal operation of the node. To ensure high availability of the cluster, this application uses a round-robin mechanism to back up images with fewer than two backups. When a round-robin backup of a target image is detected, it indicates that the node needs to provide bandwidth and disk space to store the target image. Since the number of backups of the target image in the cluster is less than two, if the node storing the target image fails, the nodes in the cluster can no longer use the target image. Therefore, even if the node does not need the target image, it still needs to store it when the node is round-robin. Through this backup method, all images have at least two backups in the cluster. Even if any node fails, all images in the cluster are guaranteed, ensuring high availability of the cluster. Furthermore, since not all images are stored on every node, the bandwidth and disk space required for image transfer and storage can be reduced.

[0039] In addition, this application also provides a mirror backup device, an electronic device, and a computer-readable storage medium, which also have the above-mentioned beneficial effects. Attached Figure Description

[0040] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0041] Figure 1 A flowchart of a mirror backup method provided in this application embodiment;

[0042] Figure 2 This application provides a specific cluster structure diagram.

[0043] Figure 3 A specific image backup flowchart is provided for an embodiment of this application;

[0044] Figure 4 Another specific image backup flowchart provided in this application embodiment;

[0045] Figure 5 This is a schematic diagram of the structure of a mirror backup device provided in an embodiment of this application;

[0046] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0047] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0048] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a mirror backup method provided in an embodiment of this application. The method includes:

[0049] S101: Start the image repository service and build the local repository on the node.

[0050] Each step in this application can be executed by a node in the cluster, with the nodes forming a cluster to provide services such as container services. During initialization, a node starts an image repository service and builds a corresponding node repository to cache the images required for node runtime.

[0051] S102: Obtain the node tag, retrieve the node image corresponding to the node tag from the full image repository, and save the node image to the node's local repository.

[0052] A node label is a tag used to identify the type of a node. Its format is not limited; it can be a location, number, or symbol. Different types of nodes perform different tasks in the cluster, and their runtime image requirements also differ. Therefore, by obtaining node labels during initialization, the necessary images can be retrieved from the full image repository based on these labels. A node image is the image corresponding to its node label, i.e., the image that the node should use during runtime. The full image repository is the image repository that provides all images to the cluster during initialization. This repository can be provided by a pre-configured node within the cluster or by an external device. After obtaining the node image, it can be stored in the node's local repository for later use.

[0053] It is understandable that in some implementations, certain nodes are not assigned a specific type during initialization, such as as reserve nodes. In this case, only the base image can be obtained as the node image. Specifically, the process of obtaining the node image corresponding to the node tag from the full image repository may include:

[0054] Step 11: If the node label is blank, obtain the base image from the full image repository as the node image.

[0055] Step 12: If the node label is not blank, determine several non-base images in the complete image repository according to the preset configuration, and obtain the base image and non-base image as node images.

[0056] A blank label indicates that the node type cannot be specified. If a node label is blank, it means that the node type cannot be determined at present. In this case, an image corresponding to a specific type cannot be obtained. In the complete image repository, in addition to the images corresponding to specific node types, there are also base images. A base image is an image that any type of node needs at runtime; its specific content is not limited. For example, a base image can serve as the basis for running other images.

[0057] If a node label is not blank, the corresponding non-base image can be determined according to the preset configuration. The preset configuration refers to the configuration that limits the correspondence between node labels and non-base images. After determining the non-base image, it is obtained together with the base image as the node image.

[0058] It should be noted that a node can have multiple node labels, and the number and content of these labels can be changed as needed. By changing the node labels, the node type can be set, thereby adjusting the node's functionalities.

[0059] S103: If a polling backup of the target image is detected, the target image is retrieved from the full image repository and saved to the node's local repository.

[0060] By obtaining the node image corresponding to the node tag, the number of images obtained can be minimized while ensuring the node can function normally. However, to guarantee high availability of the cluster, each image in the complete image repository should be stored in the local repository of at least two nodes, meaning each image should have at least two backups in the cluster. Therefore, this application employs a round-robin mechanism to back up the target image.

[0061] The target image is defined as an image that does not exist in the local repository of a node and has fewer than two backups. The number of backups refers to the number of local repositories of the target image on different nodes. For the target image, each node uses a round-robin mechanism for backup, which reduces the problem of excessive bandwidth and storage space consumption on any single node. If a round-robin backup of the target image is detected, it means that the node needs to provide additional bandwidth and storage space to store an image unrelated to its own operation; this image is the target image. In this case, the target image is retrieved from the full image repository and saved to the node's local repository, increasing the number of backups of the target image in the cluster by one, ensuring high availability of the cluster.

[0062] Specifically, the process of detecting the need for a round-robin backup of the target image may include:

[0063] Step 21: Determine whether you are a backup node based on the polling list.

[0064] Step 22: If it is a backup node, check if the target image exists.

[0065] Step 23: If the target image exists, then it is determined that a polling backup of the target image is required.

[0066] The polling list refers to the list of nodes in the cluster that perform polling backups in a specific order. Based on this list, it can be determined whether the current node is responsible for backing up a potential target image. In other words, if the polling list identifies the node as a backup node, then it's determined that the target image needs to be backed up by this node, and therefore, it further checks if the target image already exists. For example, it can check if there are images in the complete image repository with fewer than two backups. If so, it further checks if the node already possesses that image. If not, it can be determined that the image is the target image for this node, and thus, the target image exists. If the target image exists, it can be determined that a polling backup of that target image is necessary.

[0067] Furthermore, detecting the presence of a target image includes:

[0068] Step 31: Detect the number of backups corresponding to each image to be backed up in the complete image repository.

[0069] Step 32: Identify all or part of the images to be backed up that have fewer than two backups and are not present in the local repository of the node as target images.

[0070] In this embodiment, all images to be backed up that are less than two in number and not present on the current node can be used as target images to expedite cluster initialization. Alternatively, a subset of these images can be used as target images to avoid consuming excessive bandwidth and storage space on the current node. Once no node requires polling for backups, it indicates that no target images exist, confirming that cluster initialization is complete. The number and distribution of image backups within the cluster are reasonable, enabling the entire cluster to achieve high availability.

[0071] After initialization, if it's necessary to expand a node's local repository to enable it to provide additional services, the node's node tag can be updated. Specifically, this may also include:

[0072] Step 41: Obtain the label update instruction, and update the node label according to the label update instruction to obtain the updated label.

[0073] Step 42: Determine the update image based on the updated tag, and obtain the update image from the other node repositories corresponding to other nodes in the cluster.

[0074] Step 43: Determine the updated label as the new node label and store the updated image in the node's local repository.

[0075] A tag update command is an instruction to update a node's tag. It can indicate the updated state of the node tag or the update method. After updating the node tag according to the tag update command, the updated tag is determined and set as the new node tag. Based on the updated tag, the missing image can be identified, i.e., the updated image. In this case, the updated image can be obtained from the local repository of other nodes in the cluster (i.e., other node repositories) and stored in this node's local repository. Through data interaction within the cluster, this ensures that the node has an image that matches the updated tag.

[0076] Furthermore, if a node in the cluster experiences an anomaly, timely image backups are necessary to maintain high availability of the cluster. Specifically, this may include the following steps:

[0077] Step 51: If an anomaly is detected in the repository of another node on another node in the cluster, obtain the number of backups corresponding to each image in the cluster.

[0078] Step 52: If it is detected that a round-robin backup of the specified image is required, the specified image is obtained from the repository of other nodes where the specified image is located, and the specified image is saved to the local repository of the node.

[0079] If a repository on another node (not the current node) in the cluster experiences an anomaly, all images in that repository will become unusable. To ensure high availability, all image repositories on all nodes in the current cluster that are in a normal state must contain at least two backups of each image.

[0080] By obtaining the backup count, images with fewer than two backups can be detected promptly. The backup process following an anomaly also employs a round-robin backup mechanism; therefore, the specified image is one that does not exist in the node's local repository and has fewer than two backups. If a round-robin backup of a specified image is detected, the specified image can be retrieved from the repositories of other nodes containing that image and saved to the node's local repository.

[0081] For nodes experiencing anomalies in their local repository, the following steps can be performed:

[0082] Step 61: If a mirror repository error occurs, restore the local repository on the node.

[0083] Step 62: Obtain the node image corresponding to the node tag from the other node repository of other nodes in the cluster, and save the node image to the node's local repository.

[0084] After a mirror repository failure, the first step is to restore the local repository on the node. The specific method of restoration is not limited; for example, the mirror repository service can be restarted to rebuild the local repository. Once the local repository is restored, the corresponding node image is retrieved from the repositories of other nodes based on its own node tag, and the node image is saved in the local repository, completing the fault recovery.

[0085] The image backup method provided in this application employs a non-consistent distributed backup mechanism to back up images, applied to nodes in a cluster. Specifically, a local node repository is built when a node starts up. In this application, each node is assigned a node tag, indicating its type; different node types require different images. Based on the node tag, the corresponding node image can be retrieved from the complete image repository and stored locally, ensuring the normal operation of the node. To ensure high availability of the cluster, this application uses a round-robin mechanism to back up images with fewer than two backups. When a round-robin backup of a target image is detected, it indicates that the node needs to provide bandwidth and disk space to store the target image. Since the number of backups of the target image in the cluster is less than two, if the node storing the target image fails, the nodes in the cluster can no longer use the target image. Therefore, even if the node does not need the target image, it still needs to store it when the node is round-robin. Through the above backup method, all images have at least two backups in the cluster. Even if any node fails, all images in the cluster can be guaranteed, ensuring high availability of the cluster. Furthermore, since not all images are stored on every node, the bandwidth and disk space required for image transfer and storage can be reduced.

[0086] Based on the above embodiments, this embodiment will describe a specific image backup process. Please refer to... Figure 2 , Figure 2 This is a schematic diagram of a specific cluster structure provided in an embodiment of this application. The complete image repository is an image repository provided by external devices such as external servers. During cluster initialization, each node can access the external devices through preset links, thereby accessing the complete image repository and obtaining its node image. In this embodiment, nodes 1, 2, and 3 each have different labels, and all are non-blank entries. For node 1, it obtains the images1 and images2 (two non-base images) and the imagebase (one base image) from the complete image repository. For node 2, it obtains the images2 and images3 (two non-base images) and the imagebase (one base image). For node 3, it obtains the images1 and images3 (two non-base images) and the imagebase (one base image). After nodes 1, 2, and 3 have obtained and backed up their respective node images, the target image is no longer present in the complete image repository; therefore, cluster initialization is complete.

[0087] Please refer to Figure 3 , Figure 3This document provides a specific image backup flowchart for an embodiment of this application. It details the image acquisition process when the node label of node 1 changes. After node 1's node label is updated, it needs to obtain the image "images3". This is achieved by communicating with node 2, which possesses the image, to obtain "images3". It is understood that node 1 can also obtain "images3" by communicating with node 3.

[0088] Please refer to Figure 4 , Figure 4 This application provides another specific image backup flowchart, which describes the image backup process when the local repository of node 3 experiences an anomaly. When the image repository of node 3 becomes abnormal, nodes 1 and 2 can detect it; the specific detection method is not limited. For example, the three nodes can perform heartbeat checks on each other regarding the image repository to determine if an anomaly has occurred. After determining that the image repository of node 3 has become abnormal, nodes 1 and 2 count the number of backups for each image. They can then determine that the number of backups for images1 and images3 is less than 2. Therefore, node 1 obtains images3 from node 2 (which has images3) and stores it in its own local repository. Correspondingly, node 3 obtains images1 from node 1 (which has images1) and stores it in its own local repository, ensuring high availability of the cluster.

[0089] The image backup device provided in the embodiments of this application is described below. The image backup device described below and the image backup method described above can be referred to each other.

[0090] Please refer to Figure 5 , Figure 5 A schematic diagram of a mirror backup device provided in this application embodiment includes:

[0091] Startup module 110 is used to start the image repository service and build the local repository on the node;

[0092] The first backup module 120 is used to obtain node tags, retrieve the node image corresponding to the node tag from the complete image repository, and save the node image to the node's local repository;

[0093] The second backup module 130 is used to retrieve the target image from the full image repository and save the target image to the node's local repository if a polling backup of the target image is detected.

[0094] Optionally, the first backup module 120 includes:

[0095] The first backup unit is used to obtain the base image from the complete image repository as the node image if the node label is blank.

[0096] The second backup unit is used to determine several non-base images in the complete image repository according to the preset configuration if the node label is not a blank label, and to obtain the base image and non-base image as node images.

[0097] Optionally, the second backup module 130 includes:

[0098] The list detection unit is used to determine whether it is a backup node based on the polled list;

[0099] The target image detection unit is used to detect whether a target image exists if the node is a backup node.

[0100] The determination unit is used to determine, if a target image exists, that a polling backup of the target image is required.

[0101] Optionally, the target image detection unit includes:

[0102] The quantity detection subunit is used to detect the number of backups corresponding to each image to be backed up in the complete image repository.

[0103] The target determination subunit is used to determine all or part of the images to be backed up that have fewer than two backups and are not present in the node's local repository as target images.

[0104] Optionally, it also includes:

[0105] The update module is used to obtain the tag update instruction and update the node tag according to the tag update instruction to obtain the updated tag;

[0106] The update image acquisition module is used to determine the update image based on the updated tag and obtain the update image from the repository of other nodes corresponding to other nodes in the cluster;

[0107] The update storage module is used to determine the updated label as the new node label and store the updated image in the node's local repository.

[0108] Optionally, it also includes:

[0109] The quantity statistics module is used to obtain the number of backups for each image in the cluster if an anomaly is detected in the repository of another node on another node in the cluster.

[0110] The abnormal polling backup module is used to retrieve the specified image from the repositories of other nodes where the specified image is located if it is detected that a polling backup of the specified image is required, and save the specified image to the local repository of the node; the specified image is an image that does not exist in the local repository of the node and whose backup quantity is less than two.

[0111] Optionally, it also includes:

[0112] The repository recovery module is used to restore the local repository on the node if a mirror repository error occurs.

[0113] The node image recovery module is used to retrieve the node image corresponding to the node tag from the other node repository of other nodes in the cluster, and save the node image to the node's local repository.

[0114] The electronic device provided in the embodiments of this application is described below. The electronic device described below and the image backup method described above can be referred to in correspondence.

[0115] Please refer to Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 100 may include a processor 101 and a memory 102, and may further include one or more of a multimedia component 103, an information input / output (I / O) interface 104, and a communication component 105.

[0116] The processor 101 controls the overall operation of the electronic device 100 to complete all or part of the steps in the aforementioned mirror backup method. The memory 102 stores various types of data to support the operation of the electronic device 100. This data may include, for example, instructions for any application or method operating on the electronic device 100, as well as application-related data. The memory 102 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as one or more of Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0117] Multimedia component 103 may include a screen and an audio component. The screen may be, for example, a touchscreen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in memory 102 or transmitted via communication component 105. The audio component also includes at least one speaker for outputting audio signals. I / O interface 104 provides an interface between processor 101 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual or physical buttons. Communication component 105 is used for wired or wireless communication between electronic device 100 and other devices. Wireless communication may include Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, or 4G, or a combination of these. Therefore, the corresponding communication component 105 may include a Wi-Fi component, a Bluetooth component, or an NFC component.

[0118] The electronic device 100 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to execute the mirror backup method given in the above embodiments.

[0119] The computer-readable storage medium provided in the embodiments of this application is described below. The computer-readable storage medium described below and the image backup method described above can be referred to in correspondence.

[0120] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described mirror backup method.

[0121] The computer-readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0122] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0123] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0124] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0125] Finally, it should be noted that in this document, relationships such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "include," "contain," or any other variations are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus.

[0126] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A mirror backup method, characterized in that, include: Start the image repository service and build the local repository on the node; Obtain the node tag, retrieve the node image corresponding to the node tag from the full image repository, and save the node image to the local repository of the node; If a polling backup of the target image is detected, the target image is retrieved from the complete image repository and saved to the node's local repository. The target image is an image that does not exist in the local repository of the node and has fewer than two backups. The step of obtaining the node image corresponding to the node tag from the complete image repository includes: If the node label is a blank label, then the base image is obtained from the complete image repository as the node image; the node label is a label used to indicate the node type; the blank label is a label that cannot indicate the type of the node; If the node label is a non-blank label, then according to the preset configuration, several non-base images are determined in the complete image repository, and the base image and the non-base image are obtained as the node image; the preset configuration is a configuration that limits the correspondence between node labels and non-base images. The image backup method further includes: Obtain the label update instruction, and update the node label according to the label update instruction to obtain the updated label; The updated image is determined based on the updated tag, and the updated image is obtained from the repository of other nodes corresponding to other nodes in the cluster; The updated label is determined as the new node label, and the updated image is stored in the node's local repository; wherein, the label update instruction is an instruction used to instruct the node's local repository to update the updated image; The image backup method further includes: If an anomaly is detected in the repository of another node on another node in the cluster, the number of backups corresponding to each image in the cluster is obtained; If a round-robin backup of a specified image is detected, the specified image is retrieved from the repository of the other node where the specified image is located, and the specified image is saved to the local repository of the node; the specified image is an image that does not exist in the local repository of the node and the number of backups is less than two. The image backup method further includes: If a mirror repository failure occurs, the local repository on the node will be restored. The node image corresponding to the node tag is obtained from the other node repository of other nodes in the cluster, and the node image is saved to the local repository of the node.

2. The mirror backup method according to claim 1, characterized in that, The detection that a polling backup of the target image is required includes: Based on the polling list, determine whether it is a backup node; If it is the backup node, then check if the target image exists; If the target image exists, it is determined that a polling backup of the target image is required.

3. The mirror backup method according to claim 2, characterized in that, The detection of whether a target image exists includes: Detect the number of backups corresponding to each image to be backed up in the complete image repository; The target image is defined as all or part of the images to be backed up that have a backup quantity of less than two and are not present in the local repository of the node.

4. A mirror backup device, characterized in that, include: The startup module is used to start the image repository service and build the local repository on the node; The first backup module is used to obtain node tags, retrieve the node image corresponding to the node tag from the complete image repository, and save the node image to the local repository of the node; The second backup module is used to retrieve the target image from the complete image repository and save the target image to the local repository of the node if it is detected that a polling backup of the target image is required. The first backup module includes: The first backup unit is configured to obtain a base image from the complete image repository as the node image if the node label is a blank label; the node label is a label used to indicate the node type; the blank label is a label that cannot indicate the type of the node; The second backup unit is used to determine several non-base images in the complete image repository according to a preset configuration if the node label is a non-blank label, and to obtain the base image and the non-base image as the node image; the preset configuration is a configuration that limits the correspondence between node labels and non-base images. The mirror backup device further includes: The update module is used to obtain the tag update instruction and update the node tag according to the tag update instruction to obtain the updated tag; The update image acquisition module is used to determine the update image based on the updated tag and obtain the update image from the repository of other nodes corresponding to other nodes in the cluster; An update storage module is used to determine the updated tag as the new node tag and store the updated image in the node's local repository; wherein, the tag update instruction is an instruction used to instruct the node's local repository to update the updated image; The mirror backup device further includes: The quantity statistics module is used to obtain the number of backups for each image in the cluster if an anomaly is detected in the repository of another node on another node in the cluster. The abnormal polling backup module is used to retrieve the specified image from the repositories of other nodes where the specified image is located if it is detected that a polling backup of the specified image is required, and save the specified image to the local repository of the node; the specified image is an image that does not exist in the local repository of the node and whose backup quantity is less than two. The mirror backup device further includes: The repository recovery module is used to restore the local repository on the node if a mirror repository error occurs. The node image recovery module is used to retrieve the node image corresponding to the node tag from the other node repository of other nodes in the cluster, and save the node image to the node's local repository.

5. An electronic device, characterized in that, Includes memory and processor, wherein: The memory is used to store computer programs; The processor is configured to execute the computer program to implement the image backup method as described in any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that, Used to store computer programs, wherein the computer programs, when executed by a processor, implement the mirror backup method as described in any one of claims 1 to 3.