Container management method, device, equipment, medium and product
By using the target database as the container replica for task election in a distributed system, the stability problem caused by node management cluster failure is solved, and high availability and robustness are improved.
Patent Information
- Application Number
- CN202510808163.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2025-09-26
AI Technical Summary
When a distributed system encounters problems such as downtime in the node management cluster, its operational stability and reliability are poor, and management operations such as elections cannot be performed normally, resulting in poor robustness.
A pre-set target database is used to elect tasks for each container copy in the target node, and the elected target copy is controlled to execute the target task. This serves as a backup solution for the node management cluster, overcoming the strong dependence on the node management cluster.
It improves the robustness, fault tolerance and high availability of the distributed system, ensuring that the system can seamlessly continue to process tasks when the node management cluster is unable to continue management.
Smart Images

Figure CN120704801A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of distributed system management technology, and in particular to a container management method, apparatus, device, medium, and product. Background Art
[0002] With the rapid development of the internet and the continuous expansion of business, traditional monolithic applications are increasingly unable to meet requirements for high concurrency, high availability, and scalability. To address these challenges, users are turning to distributed system architectures to build large-scale, high-performance applications. In a distributed system, each node (server, instance, or container, etc.) operates independently, and the number of nodes can be dynamically increased or decreased to form a collaborative cluster. To improve system reliability and stability, the management of nodes, containers, and tasks has become a crucial component of distributed systems.
[0003] Currently, distributed systems are generally managed using a preset node management cluster. However, when the node management cluster experiences problems such as downtime, the operation of the distributed system is easily affected, and management operations such as elections cannot be performed normally, resulting in the stability and reliability of the entire distributed system being affected and its robustness being poor. Summary of the Invention
[0004] The present application provides a container management method, apparatus, device, medium, and product to improve the fault tolerance and high availability of distributed systems.
[0005] According to one aspect of the present application, a container management method is provided, including:
[0006] Use node management cluster to manage each node in the target distributed system;
[0007] In response to the node management cluster stopping management of each node, a pre-set target database is used to perform task election for each container replica in the target node;
[0008] Control the elected target replica to execute the target task.
[0009] Optionally, the step of using a preset target database to perform task election for each container replica in the target node includes:
[0010] In response to the target node being started, controlling the target container in the target node to connect to the target database; the target database is used to store the lock record of the target replica, the lock record including the replica number, task number, container number, creation time and last update time;
[0011] According to the order of the replicas in the target container, each replica is controlled to query the task status in the pre-set task lock table in the target database according to the target task number;
[0012] Based on the query results, task election is performed on each container replica.
[0013] Optionally, performing task election on each container replica based on the query result includes:
[0014] In response to the query result that the target task corresponding to the target task number exists, determining whether the target task is owned by the current copy and whether the lock duration of the target task exceeds a preset lock duration;
[0015] Based on the judgment results, task election is performed on each container copy.
[0016] Optionally, performing task election on each container replica based on the judgment result includes:
[0017] In response to the current copy having the target task and the lock duration of the target task does not exceed the preset lock duration, or in response to the current copy not having the target task and the lock duration exceeds the preset lock duration, the current copy is used as the target copy to execute the target task, and the lock time is updated to the current time of the target database.
[0018] Optionally, performing task election on each container replica based on the judgment result further includes:
[0019] In response to the current copy not having the target task and the locking time length not exceeding the preset locking time limit, the current copy is prohibited from executing the target task.
[0020] Optionally, performing task election on each container replica based on the query result includes:
[0021] In response to the query result that the target task corresponding to the target task number does not exist, the current replica is controlled to create a lock record in the task lock table, and the current replica is controlled to become the target replica after the election.
[0022] According to another aspect of the present application, a container management device is provided, including:
[0023] Cluster management module, used to manage each node in the target distributed system using a node management cluster;
[0024] A database management module is configured to, in response to the node management cluster stopping management of each node, use a preset target database to perform task election for each container replica in the target node;
[0025] The task execution module is used to control the elected target replica to execute the target task.
[0026] According to another aspect of the present application, an electronic device is provided, comprising:
[0027] at least one processor; and
[0028] a memory communicatively connected to the at least one processor; wherein,
[0029] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the container management method described in any embodiment of the present application.
[0030] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the container management method described in any embodiment of the present application when executed.
[0031] According to another aspect of the present application, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the container management method according to any embodiment of the present application is implemented.
[0032] In the technical solution of the embodiment of the present application, a node management cluster is used to manage each node in the target distributed system. After the node management cluster encounters a problem and stops managing the nodes and containers, a pre-set target database is used to perform task elections for each container copy in the target node. The database is used as a backup solution for the node management cluster. After the node management cluster can no longer manage the distributed system, the database is used to perform the election operation of the target task on the container copy, thereby overcoming the strong dependence of the distributed system on the node management cluster and improving the robustness, fault tolerance and high availability of the distributed system.
[0033] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0035] Figure 1This is a flowchart of a container management method provided according to Example 1 of the present application;
[0036] Figure 2 This is a flowchart of a container management method provided according to Example 2 of the present application;
[0037] Figure 3 This is a structural diagram of a container management device provided according to the third embodiment of the present application;
[0038] Figure 4 Schematic diagram of the structure of an electronic device that implements the container management method of an embodiment of the present application. DETAILED DESCRIPTION
[0039] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0040] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0041] Example 1
[0042] Figure 1 A flowchart of a container management method is provided for the first embodiment of the present application. This embodiment is applicable to the case where containers and executed tasks are adjusted in a distributed system. The method can be executed by a container management device, which can be implemented in the form of hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:
[0043] S110: Use a node management cluster to manage each node in the target distributed system.
[0044] Among them, the node management cluster can be a cluster service for managing distributed systems, for example, it can be a distributed, open source distributed application coordination service, which can be used to provide consistency service software for distributed applications. The functions it provides may include configuration maintenance, domain name services, distributed synchronization and group services, etc. The embodiments of the present application and each implementation method are intended to ensure the election process for container execution tasks in a distributed system. The target distributed system can be any distributed system that requires distributed node management and container management. The embodiments of the present application do not limit the specific information of the target distributed system. A node is a physical / virtual resource pool in a distributed system, which can be the smallest hardware unit in a distributed system (such as a physical server or a virtual machine); a container can be an application instance running on a node.
[0045] Each node in the target distributed system is managed through a pre-configured node management cluster. Under normal circumstances, the node management cluster is responsible for managing and electing all nodes and containers in the distributed system. However, when a node management cluster encounters problems (such as a downtime), the distributed system lacks an administrator and is prone to failure. This application aims to solve the problem of ensuring the stability of container task execution when a node management cluster encounters problems.
[0046] S120 : In response to the node management cluster stopping management of each node, a preset target database is used to perform task election for each container replica in the target node.
[0047] Among them, the target database can be the main body that replaces the node management cluster to perform task elections on the containers in the node. The target database can adopt any database in the form of a table that can be carried in the relevant technology, and the embodiments of the present application are not limited here. The target node can be the node that executes the target task that needs to be executed currently among all nodes. Task election can be the process of selecting a copy that executes the target task from all container copies in the target node. A container can have multiple copies opened at the same time, and any copy can be used to execute the target task. A task can be any processing process in which a business function requires a distributed system to perform calculations.
[0048] Specifically, when a problem occurs in the node management cluster, the pre-set target database is used to perform task elections for container replicas. It should be noted that when any distributed node starts up, it attempts to join the node management cluster. If the node discovers that there is no primary node or the current primary node is unavailable, it initiates a voting request to other nodes. Upon receiving the request, the other nodes determine whether to vote for the requesting node. If a node receives more than half of the votes, it becomes the new primary node. Simultaneously, the new primary node broadcasts a message to inform other nodes of its new status. If the current primary node is unavailable, other nodes initiate a new primary node election. This entire process ensures high availability and fault tolerance for the system. In addition to the node management cluster in a distributed system, cluster availability monitoring is also implemented. This monitoring performs regular health checks on the node management cluster (for example, every 5 minutes). Heartbeat requests are sent to check the response time and status of each node in the node management cluster. If a node responds with a timeout or cannot connect, it means that the node may be faulty. If the health check responds with a timeout or cannot connect for multiple consecutive times (for example, three times), the task of selecting and managing container replicas can be automatically switched to the target database.
[0049] S130. Control the elected target replica to execute the target task.
[0050] The target replica can be the container replica obtained by performing the task selection operation on the target database in the aforementioned step. The target replica is controlled to execute the target task.
[0051] In the technical solution of the embodiment of the present application, a node management cluster is used to manage each node in the target distributed system. After the node management cluster encounters a problem and stops managing the nodes and containers, a pre-set target database is used to perform task elections for each container copy in the target node. The database is used as a backup solution for the node management cluster. After the node management cluster can no longer manage the distributed system, the database is used to perform the election operation of the target task on the container copy, thereby overcoming the strong dependence of the distributed system on the node management cluster and improving the robustness, fault tolerance and high availability of the distributed system.
[0052] Example 2
[0053] Figure 2 This is a flowchart of a container management method provided in Example 2 of this application. This example further refines the task selection operation of the container replica in the above example based on the above example and various implementation methods. Figure 2 As shown, the method includes:
[0054] S210: Use a node management cluster to manage each node in the target distributed system.
[0055] S220. In response to the target node starting, control the target container in the target node to connect to the target database; the target database is used to store the lock record of the target replica, and the lock record includes the replica number, task number, container number, creation time and last update time.
[0056] In one optional embodiment, the container in the target node is used to execute the target task. Due to the failure of the node management cluster, the target node cannot connect to the node management cluster when it starts, and instead connects to the pre-set target database. The table in the target database is used to store the lock record of the target copy. The target copy can be one of the container copies used to execute the target task. Of course, the target copy must be elected from the container copy after the task election. The lock record can be a record of executing the target task on the target copy, and the record is stored in the table of the target database. The information recorded in the table of the lock record may include but is not limited to the number of the target copy, the number of the target task, the number of the container corresponding to the target copy, the time when the target task was created, and the time information of the last update of the target copy to execute the target task.
[0057] It is understood that a table for storing lock records is pre-set in the pre-set target database, and the relevant information about the target replica executing the target task is recorded. This allows for efficient and timely querying of the table in the target database to obtain information about the currently executing task and the replica executing the task, which helps determine whether a replica is executing the task and whether re-election of the target replica is necessary.
[0058] S230 , controlling each replica to query the task status in the pre-set task lock table in the target database according to the target task number in accordance with the replica order in the target container.
[0059] The order of replicas can be the order in which the target container builds each replica, and also the order in which each replica is elected to perform a task. It is understandable that in order to improve processing efficiency and concurrency, multiple identical replicas can be created under one target container, and the replicas that perform tasks are recommended or elected according to the order of the replicas. For example, there are replicas A, B, and C in the target container. For task a, replica A can be elected first in order to determine whether replica A is eligible to undertake task a. If replica A is eligible to undertake task a, then replica A is determined to have been successfully elected. The process of determining whether a replica is eligible to undertake a task requires confirmation of the locking information stored in the target database.
[0060] The task lock table can be a table in the target database used to store lock information. The task status can correspond to the status of the target task being undertaken or executed. The target task number can be a pre-set code for the target task, such as Task A in the above example. The target task number can be used to query the task lock table for relevant information about the target task.
[0061] S240: Based on the query results, perform task election on each container replica.
[0062] According to the query result obtained from the query of the task lock table in the above step, it is determined which replica in the target container can be used to execute the target task.
[0063] In an optional implementation, performing task election on each container replica according to the query result in S240 may include:
[0064] S241. In response to the query result indicating that the target task corresponding to the target task number exists, determine whether the target task is owned by the current copy and whether the lock duration of the target task exceeds a preset lock duration.
[0065] Among them, the locking time can be the interval time that the target copy has the target task. Since the copies executing the task need to be checked regularly, the locking time has a preset fixed maximum time limit, that is, the preset locking time limit, which can be 2 minutes, for example.
[0066] Specifically, the target task number is used to query the task lock table for relevant information about the target task. If a target task corresponding to the target task number does exist in the task lock table, the target task is determined to be executed by the current replica and whether the target task's lock duration exceeds the preset lock duration.
[0067] S242. Based on the judgment result, a task election is performed on each container replica.
[0068] According to the judgment result obtained in the above steps, it is determined whether the current copy being checked in the container can be used as the target copy to execute the target task.
[0069] In a further optional implementation, the step of performing task election on each container replica based on the judgment result in S242 may include:
[0070] In response to the current copy having the target task and the lock duration of the target task does not exceed the preset lock duration, or in response to the current copy not having the target task and the lock duration exceeds the preset lock duration, the current copy is used as the target copy to execute the target task, and the lock time is updated to the current time of the target database.
[0071] In one scenario, the current replica owns the target task. This means that the replica information recorded in the lock record corresponding to the target task is the current replica. This indicates that the current replica executed the target task before the current lock time limit was checked. In this case, the lock duration is determined to have not exceeded the preset lock time limit, indicating that the current replica's eligibility to execute the target task has not expired. This indicates that the current replica is actually processing the target task. In this case, the current replica is the target replica, continues to execute the target task, and updates the lock time to the latest real-time data.
[0072] In another case, the current replica does not own the target task, that is, the replica information recorded in the lock record corresponding to the target task is not the current replica, which means that the current replica has not yet executed the target task. At this time, it is judged that the lock duration of the target task has exceeded the time limit, which means that the last replica that executed the target task is not executing the task now and has timed out. In order to ensure the high availability and continuity of the target task, other replicas are needed to take over and process it. It is understandable that the replicas in the same container are exactly the same, and taking over the processing task has no effect. At this time, the current replica that is currently undergoing task execution qualification verification is used as the new target replica to execute the target task, and the lock time is updated to the latest real-time time data.
[0073] In another optional implementation, performing task election on each container replica based on the judgment result in S242 may further include:
[0074] In response to the current copy not having the target task and the locking time length not exceeding the preset locking time limit, the current copy is prohibited from executing the target task.
[0075] In another case, if the current replica does not have the target task, it means that the current replica has not yet executed the target task, and the lock duration is within the limit. This means that another replica has executed the target task and the execution process did not time out. This means that another replica is processing the target task and does not need to intervene. Therefore, it is necessary to prevent the current replica from intervening in the target task and affecting the execution and processing of tasks by other replicas.
[0076] In another optional implementation, performing task election on each container replica according to the query result in S240 may further include:
[0077] In response to the query result that the target task corresponding to the target task number does not exist, the current replica is controlled to create a lock record in the task lock table, and the current replica is controlled to become the target replica after the election.
[0078] Of course, there are other situations. For example, when querying the task lock table in the target database, it is found that the lock record for the target task corresponding to the target task number does not exist. This indicates that the task is newly created and no replica has ever executed the target task. In this case, the current replica is designated as the target replica and the target task is processed. The processing of the target task is recorded in the task lock table, which means that a new lock record is created.
[0079] S250: Control the elected target replica to execute the target task.
[0080] The embodiments and implementations of the present application provide a practical solution for how the target database performs task elections on container replicas, so that the target database can serve as a backup for the node management cluster and can seamlessly execute tasks, enabling the distributed database to process tasks uninterruptedly, thereby ensuring the fault tolerance and high availability of the distributed database.
[0081] Example 3
[0082] Figure 3 This is a structural diagram of a container management device provided in Example 3 of this application. Figure 3 As shown, the device 300 includes:
[0083] Cluster management module 310, for managing each node in the target distributed system using a node management cluster;
[0084] The database management module 320 is configured to, in response to the node management cluster stopping management of each node, use a preset target database to perform task election for each container replica in the target node;
[0085] The task execution module 330 is used to control the selected target replica to execute the target task.
[0086] In the technical solution of the embodiment of the present application, a node management cluster is used to manage each node in the target distributed system. After the node management cluster encounters a problem and stops managing the nodes and containers, a pre-set target database is used to perform task elections for each container copy in the target node. The database is used as a backup solution for the node management cluster. After the node management cluster can no longer manage the distributed system, the database is used to perform the election operation of the target task on the container copy, thereby overcoming the strong dependence of the distributed system on the node management cluster and improving the robustness, fault tolerance and high availability of the distributed system.
[0087] In an optional implementation, the database management module 320 may include:
[0088] A database connection unit is configured to control the target container in the target node to connect to the target database in response to the target node starting; the target database is configured to store the lock record of the target replica, the lock record including the replica number, task number, container number, creation time and last update time;
[0089] The task query unit is used to control each replica to query the task status in the task lock table pre-set in the target database according to the target task number in the order of the replicas in the target container;
[0090] The task election unit is used to elect tasks for each container replica based on the query results.
[0091] In an optional implementation, the task selection unit may include:
[0092] The lock determination subunit is configured to determine, in response to a query result indicating that a target task corresponding to the target task number exists, whether the target task is owned by the current copy and whether the lock duration of the target task exceeds a preset lock duration;
[0093] The task election subunit is used to perform task elections on each container replica based on the judgment results.
[0094] In an optional implementation manner, the task selection subunit may be specifically configured to:
[0095] In response to the current copy having the target task and the lock duration of the target task does not exceed the preset lock duration, or in response to the current copy not having the target task and the lock duration exceeds the preset lock duration, the current copy is used as the target copy to execute the target task, and the lock time is updated to the current time of the target database.
[0096] In another optional implementation, the task selection subunit may also be specifically configured to:
[0097] In response to the current copy not having the target task and the locking time length not exceeding the preset locking time limit, the current copy is prohibited from executing the target task.
[0098] In an optional implementation manner, the task selection unit may also be specifically configured to:
[0099] In response to the query result that the target task corresponding to the target task number does not exist, the current replica is controlled to create a lock record in the task lock table, and the current replica is controlled to become the target replica after the election.
[0100] The container management device provided in the embodiments of the present application can execute the container management method provided in any embodiment of the present application, and has the functional modules and beneficial effects corresponding to executing each container management method.
[0101] Example 4
[0102] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0103] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0104] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0105] Processor 11 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors that run machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 executes the various methods and processes described above, such as the container management method.
[0106] In some embodiments, the container management method can be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the container management method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the container management method in any other suitable manner (e.g., via firmware).
[0107] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0108] Computer programs for implementing the methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0109] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. A computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0110] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0111] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0112] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.
[0113] The present application also discloses a computer program product comprising a computer program that, when executed by a processor, implements the container management method provided in any of the embodiments of the present application. This program product shares the same inventive concept as the container management method disclosed in each embodiment of the present application and is therefore not further described here.
[0114] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this application can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of this application can be achieved. This is not limited herein.
[0115] The above specific embodiments do not constitute a limitation on the scope of protection of this application. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application shall be included within the scope of protection of this application.
Claims
1. A container management method, characterized in that: include: Use node management cluster to manage each node in the target distributed system; In response to the node management cluster stopping management of each of the nodes, using a preset target database to perform task election for each container replica in the target node; Control the elected target replica to execute the target task.
2. The method according to claim 1, characterized in that The process of using a preset target database to perform task election for each container replica in the target node includes: In response to the target node being started, controlling the target container in the target node to connect to the target database; the target database is used to store a lock record of the target replica, the lock record including a replica number, a task number, a container number, a creation time, and a last update time; According to the order of the copies in the target container, each copy is controlled to query the task status in the task lock table preset in the target database according to the target task number; According to the query result, a task election is performed on each of the container replicas.
3. The method according to claim 2, characterized in that The step of performing task selection on each container replica according to the query result includes: In response to the query result indicating that the target task corresponding to the target task number exists, determining whether the target task is owned by the current copy and whether the lock duration of the target task exceeds a preset lock duration; According to the judgment result, task election is performed on each of the container copies.
4. The method according to claim 3, characterized in that The step of performing task election on each container replica according to the judgment result includes: In response to the current copy owning the target task and the lock duration of the target task does not exceed the preset lock duration, or in response to the current copy not owning the target task and the lock duration exceeds the preset lock duration, the current copy is used as the target copy to execute the target task, and the lock time is updated to the current time of the target database.
5. The method according to claim 3, characterized in that The step of performing task election on each of the container replicas according to the judgment result further includes: In response to the current copy not having the target task and the locking time duration not exceeding the preset locking time limit, the current copy is prohibited from executing the target task.
6. The method according to claim 2, characterized in that The step of performing task selection on each container replica according to the query result includes: In response to the query result that the target task corresponding to the target task number does not exist, the current replica is controlled to create a lock record in the task lock table, and the current replica is controlled to become the target replica after the election.
7. A container management device, characterized in that: include: Cluster management module, used to manage each node in the target distributed system using a node management cluster; a database management module, configured to, in response to the node management cluster ceasing to manage each of the nodes, use a preset target database to perform task election for each container replica in the target node; The task execution module is used to control the elected target replica to execute the target task.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to perform the container management method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the container management method according to any one of claims 1 to 6 when executed.
10. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, implements the container management method according to any one of claims 1 to 6.