A method, platform, and storage medium for managing processes within a container
By introducing a dual management mechanism of the first management process and the second management process into the container cluster management software, the problem that the existing technology cannot deeply manage the internal processes of the container is solved, and efficient and convenient management of processes in the container collection is achieved.
Patent Information
- Application Number
- CN202111210442.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-18
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2041-10-18
AI Technical Summary
Existing container cluster management software cannot manage processes inside the container in depth, resulting in insufficient management depth and poor convenience.
By introducing a dual management mechanism of the first management process and the second management process, the first management process obtains management requests for the processes to be managed in the container set from the outside, and the second management process acts as an internal management process in the container set, and responds to and processes these management requests to achieve in-depth management of the processes in the container set.
It improves the depth and convenience of management of processes in container collections, saves relevant technical personnel the time required for learning and deployment, and avoids difficulties caused by limited cluster management software documentation.
Smart Images

Figure CN114035939B_ABST
Abstract
Description
Technical Field
[0001] This application relates to, but is not limited to, the field of computer technology, and in particular, to a method for managing processes in a container, a management platform for processes in a container, and a computer-readable storage medium. Background Art
[0002] With the development and wide application of cloud platform technology, container cluster technology and automated deployment technology have developed and been gradually implemented. Compared with traditional virtual machine technology, in the container cluster technology, the container environment runs directly on the host operating system, and the additional demand for system resources is much lower than that of virtual machines. Therefore, the container cluster technology has the advantages of low resource occupancy rate and high operating efficiency. In the container cluster technology, a container cluster management software is used to manage containerized applications on multiple hosts in the cloud platform. Physically, the container cluster management software consists of a group of hosts monitored by a master node; among them, the master node is responsible for cross-node container management, status tracking, and exposing cluster control through the Representational State Transfer Application Programming Interface (REST API) and the User Interface (UI). Logically, from the application level, the container cluster management software is arranged in a hierarchical manner. Multiple services managed by the container cluster management software can be distributed in the same physical infrastructure. Each service consists of multiple container sets, and each container set consists of multiple containers. Among them, the container set is the smallest unit that can be created and deployed in the container cluster management software, and is an application instance in the container cluster management software cluster. It includes resources shared by each container such as storage and network, can support multiple container environments, and is always deployed on the same node. A container is a set of processes with isolation characteristics (a set of processes in a virtual server). When using a container, an image will be selected to provide an independent file system and specify the corresponding running program. It should be noted that the container cluster management software provides a set of functions such as resource scheduling, automated deployment, service discovery, scaling, fault discovery, and self-healing for containerized applications, thereby making the deployment of containerized applications simple and efficient, and realizing one-time deployment and running everywhere.
[0003] Although the container cluster management software can significantly simplify the process of deploying containerized applications in containers and cloud platforms, the container cluster management software in related technologies has limited management scope and depth for containers and cannot deeply manage the processes inside the containers. Therefore, there is an urgent need to provide a method for managing processes inside container sets. Summary of the Invention
[0004] Embodiments of the present application are expected to provide a method for managing processes in a container, a management platform for processes in a container, and a computer-readable storage medium.
[0005] The technical solution of the present application is implemented as follows:
[0006] A method for managing processes in a container, the method comprising:
[0007] Invoking a first management process to obtain a management request for managing a process to be managed in a container set; wherein, the process to be managed corresponds to the working state of the container set;
[0008] Invoking a second management process to receive the management request sent by the first management process; wherein, the second management process belongs to the container set, and the first management process does not belong to the container set;
[0009] Invoking the second management process to respond to the management request and manage the process to be managed.
[0010] A management platform for processes in a container, the management platform for processes in a container comprising:
[0011] An obtaining module, configured to invoke a first management process to obtain a management request for managing a process to be managed in a container set; wherein, the process to be managed corresponds to the working state of the container set;
[0012] A processing module, configured to invoke a second management process to receive the management request sent by the first management process; wherein, the second management process belongs to the container set, and the first management process does not belong to the container set;
[0013] The processing module is further configured to invoke the second management process to respond to the management request and manage the process to be managed.
[0014] A management platform for processes in a container, the management platform for processes in a container comprising:
[0015] A memory, configured to store executable instructions;
[0016] A processor, configured to execute the executable instructions stored in the memory to implement the steps of the above method for managing processes in a container.
[0017] A computer storage medium, the computer storage medium storing one or more programs, the one or more programs being executable by one or more controllers to implement the steps of the above method for information processing.
[0018] The management method for processes within a container, the management platform for processes within a container, and the computer-readable storage medium provided by the embodiments of the present application call a first management process to obtain a management request for managing processes to be managed in a container set, where the processes to be managed correspond to the working state of the container set; call a second management process to receive the management request sent by the first management process, where the second management process belongs to the container set and is also called the internal management process, and the first management process does not belong to the container set and is also called the external management process; call the second management process to respond to the management request and manage the processes to be managed. That is to say, the present application provides a method capable of managing processes inside a container set. Based on two different management processes inside and outside the container set and based on the management request capable of managing processes within the container, the management of processes inside the container set is realized, the depth of the management of processes within the container set by the management platform is improved, and it is more convenient for relevant technical personnel to manage the container set. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 FIG. is an alternative schematic architecture diagram of a server provided by an embodiment of the present application;
[0020] Figure 2 FIG. is a flowchart of the management method for processes within a container provided by an embodiment of the present application Figure 1 ;
[0021] Figure 3 FIG. is a flowchart of the management method for processes within a container provided by an embodiment of the present application Figure 2 ;
[0022] Figure 4 FIG. is a flowchart of the second management process notifying the first management process to execute a process management operation provided by an embodiment of the present application;
[0023] Figure 5 FIG. is a flowchart of switching the container set from the business processing state to the standby state provided by the present application. DETAILED DESCRIPTION
[0024] In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0025] In the description, claims and the above-mentioned drawings of this application, terms such as "first" and "second" are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally further include steps or units not listed, or may optionally further include other steps or units inherent to these processes, methods, products or devices.
[0026] Reference to "embodiment" herein means that a particular feature, structure or characteristic described in connection with the embodiment can be included in at least one embodiment of this application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0027] The following describes an exemplary application of the management platform for processes within a container provided in an embodiment of this application. The management platform for processes within a container provided in an embodiment of this application can be implemented as a terminal such as a laptop computer, a tablet computer, a desktop computer, a mobile device, etc., or can also be implemented as a server. Below, the exemplary application when the management platform for processes within a container is implemented as a server will be described.
[0028] See Figure 1 , Figure 1 is a schematic structural diagram of server 100 provided in an embodiment of this application. Figure 1 The server 100 shown includes: at least one processor 110, at least one network interface 120, a user interface 130, and a memory 150. Each component in the server 100 is coupled together through a bus system 140. It can be understood that the bus system 140 is used to implement connection and communication between these components. In addition to including a data bus, the bus system 140 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clear illustration, in Figure 1 all kinds of buses are labeled as the bus system 140.
[0029] The processor 110 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0030] The user interface 130 includes one or more output devices 131 that enable the presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 130 also includes one or more input devices 132, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons, and controls.
[0031] The memory 150 can be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid state memory, hard disk drives, optical disk drives, etc. The memory 150 optionally includes one or more storage devices that are physically located remote from the processor 110. The memory 150 includes volatile memory or non-volatile memory, and may also include both volatile and non-volatile memory. The non-volatile memory can be Read Only Memory (ROM), and the volatile memory can be Random Access Memory (RAM). The memory 150 described in the embodiments of the present application is intended to include any suitable type of memory. In some embodiments, the memory 150 is capable of storing data to support various operations, examples of such data include programs, modules, and data structures, or subsets or supersets thereof, which are exemplarily described below.
[0032] The operating system 151 includes system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0033] The network communication module 152 is used to reach other computing devices via one or more (wired or wireless) network interfaces 120. Exemplarily, the network interface 120 includes: Bluetooth, Wireless Fidelity (WiFi), and Universal Serial Bus (USB), etc.;
[0034] The input processing module 153 is used to detect and translate one or more user inputs or interactions from one or more of the one or more input devices 132.
[0035] In some embodiments, the device provided by the embodiments of the present application can be implemented in software. Figure 1Shows a management platform 154 for in-container processes stored in a memory 150. The management platform 154 for in-container processes can be the management platform for in-container processes in a server 100, and it can be software in the form of programs and plugins, etc., including the following software modules: an acquisition module 1541 and a processing module 1542. These modules are logical, so they can be combined or further split arbitrarily according to the functions implemented. The functions of each module will be described below.
[0036] In some other embodiments, the device provided by the embodiments of the present application can be implemented in a hardware manner. As an example, the management platform provided by the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the management method for in-container processes provided by the embodiments of the present application. For example, a processor in the form of a hardware decoding processor can adopt one or more application specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs), or other electronic components.
[0037] Next, the management method for in-container processes provided by the embodiments of the present application will be described in combination with the exemplary applications and implementations of the management platform for in-container processes provided by the embodiments of the present application. Refer to Figure 2 , Figure 2 is an optional flowchart of the management method for in-container processes provided by the embodiments of the present application, and will be described in combination with Figure 2 the steps shown.
[0038] Step 201: Invoke a first management process to obtain a management request for managing the processes to be managed in a container set.
[0039] Among them, the processes to be managed correspond to the working states of the container set.
[0040] In the embodiments of the present application, a first management process is called to obtain a management request for managing the processes to be managed in a container set; among them, the management request may be generated by the first management process or sent by other management processes to the first management process. In this regard, the present application does not make any limitations. The management request includes, but is not limited to, a request for switching the working state of the container set, a request for starting or stopping the processes to be managed in the container set, a request for starting or stopping the containerized applications managed by the management platform of the processes in the container, a request for sharding the services processed by the processes to be managed, a request for querying the process information or database information associated with the processes to be managed, and a request for managing the scheduled tasks of the processes to be managed.
[0041] Exemplarily, if the first management process detects a management notification sent by other management processes for managing the processes to be managed in the container set, the first management process responds to the management notification and generates a management request. Here, the other management processes are processes different from the first management process on the management platform of the processes in the container, and may belong to the same container set as the first management process or different container sets from the first management process.
[0042] In some embodiments, after the user clicks on the icon corresponding to the management interface presented by the management platform of the processes in the container, the management platform of the processes in the container generates a management request for managing the processes to be managed in the container set and sends the management request to the first management process; the first management process obtains the management request. Of course, the management platform of the processes in the container can also generate the above management request based on other methods. For example, the user sends a voice message to the management platform of the processes in the container, such as a message to update the running state of process A, and the management platform of the processes in the container receives the message and generates the management request. The present application does not make specific limitations on the method of generating the management request.
[0043] In the embodiments of the present application, the first management process is a process in the management platform of the processes in the container that does not include the container set corresponding to the process to be managed, that is, the first management process does not belong to the container set. The process to be managed is the smallest unit that can be managed in the management platform of the processes in the container.
[0044] In the embodiments of the present application, the working states of the container set include a service processing state, a standby state, and a fault state. Among them, the service processing state of the container set is used to represent that the services processed by all processes in the container set that match the service processing state are in a processed state, and all the processes that match can communicate normally with the databases required by all the processes that match the service processing state. The standby state of the container set is used to represent that the services processed by all processes in the container set that match the standby state are in a to-be-processed state, and the database information required by all the processes that match can communicate normally with all the processes that match the standby state. The fault state of the container set is used to represent a state in which at least one process in the container set cannot execute the specified function for the processed service. It should be noted that the working states of the container set can be switched to each other.
[0045] In the embodiments of the present application, for the containerized application managed by the management platform of the processes in the container, at any moment, there can only be one container set in the service processing state, and there can be at least one container set in the standby state. The to-be-managed processes of the present application are associated with the working states of the container set, and the to-be-managed processes corresponding to different working states are different.
[0046] Exemplarily, if the management request is a request to switch the working state of the container set to the standby state, the to-be-managed processes are the processes that need to be started but have not been started, or do not need to be started but have been started in the standby state of the container set.
[0047] Exemplarily, if the management request is a request to start the to-be-managed processes in the container set, the to-be-managed processes correspond to the working state of the container set. For example, container set A is in the service processing state, and in this state, processes A.1, A.2, and A.3 are in the started state, and A.4 is in the closed state. If the first management process is called to obtain a start request for the to-be-managed processes A.1 and A.4 in the container set, at this time, since process A.1 has been started, the to-be-managed process is process A.4.
[0048] Exemplarily, if the management request is a request to start the containerized application managed by the management platform of the processes in the container, determine the container set corresponding to the service of the to-be-started containerized application, that is, switch the working state of the container set to the service processing state. Here, the to-be-managed processes are the processes that need to be started but have not been started, or do not need to be started but have been started in the service processing state of the container set.
[0049] Exemplarily, if the management request is a query request for process information or database information associated with the process to be managed, the process to be managed corresponds to the working state of the container set. For example, container set A is in a fault state, and in this state, processes A.1 and A.2 are in a fault state; container set B is in a standby state, and in this state, process B.1 is in a closed state. If the first management process is called to obtain a query request for the processes A.1 and B.1 to be managed in the container set, at this time, since process A.1 is faulty, the process to be managed is process B.1.
[0050] Step 202: Call the second management process to receive the management request sent by the first management process.
[0051] Among them, the second management process belongs to the container set and is different from the process to be managed.
[0052] In the embodiment of the present application, the management platform of the process in the container calls the second management process, and through the communication interface, receives the management request for managing the process to be managed in the container set.
[0053] Step 203: Call the second management process to respond to the management request and manage the process to be managed.
[0054] In the embodiment of the present application, the management platform of the process in the container calls the second management process to respond to the management request and manage the process to be managed in the container set. For example, switch the working state of the container set, start or stop the process to be managed in the container set, start or stop the containerized application managed by the management platform of the process in the container, shard the service processed by the process to be managed, query the process information or database information associated with the process to be managed. That is to say, through the management request, the present application can manage the processes inside the container set. In this way, it saves the time for relevant technical personnel to fully understand the principles and uses of the cluster management software in the related art, and there will be no problem that it is difficult for relevant technical personnel to learn and deploy due to the limited documentation of the cluster management software in the related art.
[0055] The container-internal process management method provided by the embodiments of this application calls a first management process to obtain a management request for managing a process to be managed in a container set, where the process to be managed corresponds to the working state of the container set; calls a second management process to receive the management request sent by the first management process, where the second management process belongs to the container set and is also called an internal management process, and the first management process does not belong to the container set and is also called an external management process; calls the second management process to respond to the management request and manage the process to be managed. That is to say, this application provides a method capable of managing the internal processes of a container set. Based on two different management processes inside and outside the container set and a management request capable of managing the internal processes of the container, the management of the internal processes of the container set is realized, the depth of the management of the internal processes of the container set by the management platform is improved, and it is more convenient for relevant technical personnel to manage the container set.
[0056] See Figure 3 , Figure 3 is an optional flowchart of the container-internal process management method provided by the embodiments of this application, which will be described in combination with Figure 3 the steps shown.
[0057] Step 301: If the second management process detects that the running state of at least one process to be managed in the container set is the closed state, call the second management process to notify the first management process to perform a process management operation.
[0058] In the embodiments of this application, if the second management process detects that the running state of at least one process to be managed in the container set is converted to the closed state, call the second management process to send a management notification through the communication interface of the second management process, so that the first management process performs a process management operation.
[0059] In some embodiments, if the second management process detects that the running status of at least one process to be managed in the container set changes from the status of processing business to the status of stopping processing business, and the number of times the at least one process to be managed stops running is less than or equal to the configured value, the second management process is called. Through the communication interface of the second management process, a switching notice is sent to the first management process, which carries the set identifier of the container set, the request type for switching the running status of the container set to the standby state, and the target running status of the container set, so that the first management process generates a request to switch the working status of the container set to the standby state based on the switching notice and sends it to the second management process. Further, the second management process is called to respond to the request, manage the process to be managed, obtain the management result, and send the management result to the communication interface of the first management process. It should be noted that when the return code in the management result received by the communication interface of the first management process is 0, it indicates that the working status of the container set has been successfully switched; otherwise, it indicates that the switching of the working status of the container set fails.
[0060] In other embodiments, if the second management process detects that the running status of at least one process to be managed in the container set changes from the status of processing business to the status of stopping processing business, and the number of times the at least one process to be managed stops running is greater than the configured value, the second management process is called. Through the communication interface of the second management process, a failure notice is sent to the first management process, which carries the set identifier of the container set, the request type for switching the running status of the container set to the failure state, and the target running status of the container set, so that the first management process generates a request to switch the working status of the container set to the failure state based on the failure notice and sends it to the second management process. Further, the second management process is called to respond to the request, manage the process to be managed, obtain the management result, and send the management result to the communication interface of the first management process. It should be noted that when the return code in the management result received by the communication interface of the first management process is 0, it indicates that the working status of the container set has been successfully switched; otherwise, it indicates that the switching of the working status of the container set fails.
[0061] Refer to Figure 4 , Figure 4 FIG. is a schematic flowchart of the second management process notifying the first management process to perform process management operations provided by the embodiments of the present application.
[0062] Step 401: The second management process monitors all processes in the container set and executes step 402.
[0063] Step 402: The second management process determines whether there is at least one process whose running status is switched to the closed state and executes step 403.
[0064] Step 403: If the running status of at least one process switches to the closed state, the second management process determines whether the number of times the at least one process stops running exceeds the configured value, and executes Step 404 or Step 405.
[0065] If the running status of at least one process does not switch to the closed state, execute Step 401.
[0066] Step 404: If the number of times the at least one process stops running exceeds the configured value, the second management process sends a notification to the first management process to switch the running status of the container set to the fault state.
[0067] Step 405: If the number of times the at least one process stops running does not exceed the configured value, the second management process determines whether the working status of the container set is the business processing status, and executes Step 406.
[0068] Step 406: If the working status of the container set is the business processing status, the second management process sends a notification to the first management process to switch the running status of the container set to the standby state.
[0069] If the working status of the container set is not the business processing status, execute Step 401.
[0070] In the embodiment of the present application, based on the notification sent by the second management process, the first management process performs process management operations.
[0071] Step 302: Invoke the first management process to obtain a management request for managing the processes to be managed in the container set.
[0072] Among them, the processes to be managed correspond to the working status of the container set, and the first management process does not belong to the container set.
[0073] Step 303: Invoke the second management process to receive the management request sent by the first management process.
[0074] Among them, the second management process belongs to the container set and is different from the processes to be managed.
[0075] Step 304: Invoke the second management process to respond to the management request and manage the processes to be managed.
[0076] In the embodiment of the present application, Step 304 invokes the second management process to respond to the management request and manage the processes to be managed, which can be implemented through the following Steps A1 to A4, or can be implemented through Steps A1, B5 to A6, or can be implemented through Steps A1 and A7:
[0077] Step A1: Invoke the second management process to determine the management operation requested by the management request.
[0078] Step A2: If the management operation is a switching operation, call the second management process to obtain the working status.
[0079] In the embodiment of the present application, the switching operation may be an operation of switching the working state of the container set to another working state different from the current container set, that is, the switching operation specifies that the working state of the container set will be switched, but does not specify the working state of the container set before the switch and the working state of the container set after the switch. For example, if the working state of the current container set is the business processing state, the switching operation is to switch the working state of the current container set to the standby state.
[0080] In the embodiment of the present application, the switching operation may also be to switch the working state of the container set from the reference state to the target state, that is, the switching operation specifies the working state of the container set before the switching and the working state of the container set after the switching.
[0081] In the embodiment of the present application, if the management operation is a switching operation, the second management process is called to obtain the working status of the container set.
[0082] Step A3: If the working state is the business processing state, call the second management process, determine that in the standby state corresponding to the business processing state, the process in the container set that meets the state switching condition is the process to be managed, and control the process to be managed to switch state.
[0083] In the embodiment of the present application, if the switching operation specifies the working state of the container set before the switching and the working state of the container set after the switching, when the second management process determines that the working state of the container set is the business processing state, it is determined whether the working state of the container set before the switching specified by the switching operation is the business processing state. If not, a prompt message is output to prompt the first management process that the current switching operation has failed. If so, the second management process is called to determine the specified state after the switching corresponding to the business processing state based on the list of all processes in the container set. For example, in the standby state, the process in the container set that meets the state switching condition is the process to be managed, and the process to be managed is controlled to switch the state.
[0084] Here, the output prompt information may include but is not limited to output color, output text, output sound, output graphic, output symbol, output picture, etc., which are all convenient for prompting the first management process that the current switching operation fails.
[0085] In the embodiments of the present application, if the switching operation only specifies that the working state of the container set will be switched, and the working state of the container set is the business processing state, the second management process is called, and based on the list of all processes of the container set, another state corresponding to the business processing state is determined. For example, in the standby state, the processes in the container set that meet the state switching conditions are processes to be managed, and the processes to be managed are controlled to perform state switching.
[0086] In the embodiments of the present application, the processes to be managed that meet the state switching conditions include the processes that are not started in the standby state of the container set and need to be started. The second management process is called, and the processes that are not started in the standby state and need to be started are started through the start interface. The processes to be managed that meet the state switching conditions also include the processes that are prohibited from starting in the standby state of the container set and have been started in the business processing state. The second management process is called, and the processes that are prohibited from starting in the standby state and have been started in the business processing state are closed through the close interface.
[0087] In the embodiments of the present application, closing the processes that are prohibited from starting in the standby state and have been started in the business processing state through the close interface can be achieved through the following steps:
[0088] Step B1: Determine whether the processes that are prohibited from starting in the standby state and have been started in the business processing state meet the forced termination condition; that is, determine whether the processes to be closed meet the forced termination condition.
[0089] Step B2: If the processes to be closed meet the forced termination condition, call the close interface to forcibly close the processes to be closed.
[0090] Step B3: If the processes to be closed do not meet the forced termination condition, call the close interface to obtain the end time of the processes to be closed from the process information of the processes to be closed; call the timed task process in the second management process to detect whether the end time has been reached. If the processes to be closed have not been automatically closed when the end time is reached, call the close interface to forcibly close the processes to be closed.
[0091] Step A4: Control the working state of the container set to switch from the business processing state to the standby state.
[0092] In the embodiments of the present application, if the state switching of all processes to be managed in the second management process is successful, control the working state of the container set to switch from the business processing state to the standby state.
[0093] Exemplarily, referring to Figure 5 , Figure 5 is the flowchart provided by the present application for switching the container set from the business processing state to the standby state.
[0094] Step 501: The first management process sends a switching request to the second management process to switch the working state of the container set from the business processing state to the standby state.
[0095] Step 502: The second management process receives the switching request.
[0096] Step 503: Determine whether the working line state of the current container set is the business processing state.
[0097] Step 504: If the working line state of the current container set is not the business processing state, output a prompt message.
[0098] Step 505: When the working line state of the current container set is the business processing state, traverse all the processes recorded in the process list in the container set.
[0099] Step 506: Identify the to-be-managed processes that need to be executed in the standby state but have not been started among all the processes, and execute Step 507.
[0100] Step 507: Start the to-be-managed processes through the start interface.
[0101] Step 508: Identify the to-be-managed processes that are prohibited from being executed in the standby state but have been started among all the processes, and execute Step 509.
[0102] Step 509: Call the shutdown interface to stop the to-be-managed processes.
[0103] In the embodiment of the present application, after waiting for all the operations of starting and stopping processes to be completed, the running state of the container set is set to standby.
[0104] Step A5: If the management operation is a sharding operation for the business processed by the to-be-managed processes, call the second management process to generate business sharding information for each process to be balanced for the processed business based on the load of each process in the container set.
[0105] Step A6: Call the second management process to allocate the business sharding information of each process to the corresponding process.
[0106] In the embodiment of the present application, if the management operation is a sharding operation on the service processed by the process to be managed, the second management process is called to perform sharding processing on the service process processed by the process to be managed. Here, the sharding processing on the service process processed by the process to be managed may generate service sharding information for each process of the service to be balanced according to the load of each process in the container set, that is, determine the service sharding information corresponding to other processes according to the service processing capabilities of other processes in the container set. The second management process performs string processing on the service sharding information, and based on the processing sharding list recording the mapping relationship between the service sharding information and the process to be processed with the service sharding information, distributes the service sharding information of each process to the corresponding process.
[0107] In the embodiment of the present application, if the management operation is a sharding operation on the service processed by the process to be managed, the second management process is called to perform sharding processing on the service process processed by the process to be managed. Here, the sharding processing on the service process processed by the process to be managed may generate service sharding information for each process of the service to be balanced according to the type of service data processed by each process in the container set; the second management process performs string processing on the service sharding information, and based on the processing sharding list recording the mapping relationship between the service sharding information and the process to be processed with the service sharding information, distributes the service sharding information of each process to the corresponding process.
[0108] Step A7: If the management operation is a query operation, call the second management process to find the query result associated with the process to be managed based on the process identifier through the query interface.
[0109] Among them, the management request carries the process identifier of the process to be managed.
[0110] In the embodiment of the present application, if the management operation is a query operation, call the second management process to find the query result associated with the process to be managed based on the process identifier through the query interface, and return the feedback result converted by serialization of the query result to the first management process. The query result may include the process information of the process to be managed or the information of the database associated with the process to be managed.
[0111] In some other embodiments, when the second management process sends a start request to start the process to be managed to the first management process, the first management process receives the start request, and will query the process information of the process to be managed in the container set according to the process identifier included in the start request, and based on the process information, splice it into an executable command, call the start interface, and execute the executable command. When the result returned by the start interface is 0, the process to be managed is successfully started; otherwise, the process to be managed fails to start.
[0112] In some other embodiments, when the second management process sends a shutdown request to the first management process to shut down the process to be managed, the second management process receives the shutdown request and will query the process information of the process to be managed in the container set according to the process identifier of the process to be managed included in the shutdown request. Based on the process information, an executable command is assembled; the shutdown interface is called to determine whether the process to be managed belongs to forced termination. If so, the shutdown interface immediately stops the process to be managed. Otherwise, it waits for the process to be managed to finish execution. If the process to be managed does not stop after finishing execution, the shutdown interface immediately shuts down the process to be managed.
[0113] In some other embodiments, when the second management process sends a startup request to the first management process to start a containerized application, the first management process receives the startup request and will query whether the application exists in the container set according to the application identifier included in the startup request. If not, a prompt message is output; if it exists, the startup interface is called to start each database service process in the container set and each process corresponding to the application.
[0114] In some other embodiments, when the second management process sends a shutdown request to the first management process to shut down a containerized application, the first management process receives the shutdown request and will query whether the application exists in the container set according to the application identifier included in the startup request. If not, a prompt message is output; if it exists, the shutdown interface is called to shut down each database service process in the container set and each process corresponding to the application.
[0115] In some other embodiments, when the second management process sends a shutdown request to the first management process to shut down the process to be managed, the second management process receives the shutdown request and will query the process information of the process to be managed in the container set according to the process identifier of the process to be managed included in the shutdown request. Based on the process information, an executable command is assembled; the shutdown interface is called to determine whether the process to be managed belongs to forced termination. If so, the shutdown interface immediately stops the process to be managed. Otherwise, it waits for the process to be managed to finish execution. If the process to be managed does not stop after finishing execution, the shutdown interface immediately shuts down the process to be managed.
[0116] It should be noted that the descriptions of the same steps and the same content in this embodiment and other embodiments can be referred to the descriptions in other embodiments, and will not be repeated here.
[0117] Next, the exemplary structure of the management platform 154 for processes in a container provided in the embodiments of the present application implemented as software modules will be continued. In some embodiments, as Figure 1 shown, the software modules in the management platform 154 for processes in a container stored in the memory 150 can be the management platform for processes in a container in the server 100, including:
[0118] An acquisition module 1541, configured to call a first management process to obtain a management request for managing a process to be managed in a container set, where the process to be managed corresponds to the working state of the container set.
[0119] A processing module 1542, configured to call a second management process to receive the management request sent by the first management process, where the second management process belongs to the container set and the first management process does not belong to the container set.
[0120] The processing module 1542 is further configured to call the second management process to respond to the management request and manage the process to be managed.
[0121] In other embodiments of the present application, the processing module 1542 is configured to call the second management process to determine the management operation requested by the management request. If the management operation is a switching operation, call the second management process to obtain the working state. If the working state is a service processing state, call the second management process to determine that the process in the container set that meets the state switching condition in the standby state corresponding to the service processing state is the process to be managed, and control the process to be managed to perform a state switch; control the working state of the container set to switch from the service processing state to the standby state.
[0122] In other embodiments of the present application, the state switching condition includes: not started in the standby state and needs to be started.
[0123] The processing module 1542 is configured to start the process to be managed.
[0124] In other embodiments of the present application, the state switching condition includes: prohibited from starting in the standby state and already started in the service processing state.
[0125] The processing module 1542 is configured to shut down the process to be managed.
[0126] In other embodiments of the present application, the processing module 1542 is configured to, if the second management process detects that the running state of at least one process to be managed in the container set is a shutdown state, call the second management process to notify the first management process to perform a process management operation.
[0127] In other embodiments of the present application, the processing module 1542 is configured to call the second management process to determine the management operation requested by the management request. If the management operation is a sharding operation for the service processed by the process to be managed, call the second management process to generate service sharding information for each process that needs to balance the processed service based on the load of each process in the container set; call the second management process to allocate the service sharding information of each process to the corresponding process.
[0128] In other embodiments of the present application, the processing module 1542 is configured to call a second management process to determine the management operation requested by the management request; if the management operation is a query operation, call the second management process to find a query result associated with the process to be managed based on the process identifier through a query interface; wherein, the management request carries the process identifier of the process to be managed.
[0129] It should be noted that for the specific implementation process of the steps executed by the processor in this embodiment, reference can be made to Figures 2 to 3 the implementation process in the method for managing processes in a container provided in the corresponding embodiment, which will not be elaborated here.
[0130] Embodiments of the present application provide a computer-readable storage medium that stores one or more programs, and the one or more programs can be executed by one or more processors to implement the same as Figures 2 to 3 the implementation process in the method for managing processes in a container provided in the corresponding embodiment, which will not be elaborated here.
[0131] It should be pointed out here that the descriptions of the above storage medium and device embodiments are similar to those of the above method embodiments and have similar beneficial effects to the method embodiments. For the technical details not disclosed in the storage medium and device embodiments of the present application, please refer to the descriptions of the method embodiments of the present application for understanding.
[0132] The above computer storage medium / memory can be a ROM, a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a ferromagnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM), etc.; it can also be various terminals including one or any combination of the above memories, such as a mobile phone, a computer, a tablet device, a personal digital assistant, etc.
[0133] It should be understood that the "one embodiment" or "an embodiment" or "the embodiments of the present application" or "the foregoing embodiments" or "some embodiments" or "some implementation manners" mentioned throughout the specification mean that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, the "in one embodiment" or "in an embodiment" or "the embodiments of the present application" or "the foregoing embodiments" or "some embodiments" or "some implementation manners" that appear throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the magnitude of the serial numbers of the above processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application. The serial numbers of the embodiments of the present application above are only for description and do not represent the advantages or disadvantages of the embodiments.
[0134] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of units is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed with each other can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0135] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units; they can be located in one place or distributed to multiple network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0136] In addition, each functional unit in the embodiments of the present application can be all integrated in one processing unit, or each unit can be separately used as a unit, or two or more units can be integrated in one unit; the above integrated unit can be implemented in the form of hardware, or in the form of hardware plus software functional units.
[0137] The methods disclosed in several method embodiments provided by the present application can be arbitrarily combined without conflict to obtain new method embodiments.
[0138] The features disclosed in several product embodiments provided by the present application can be arbitrarily combined without conflict to obtain new product embodiments.
[0139] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0140] Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps including the above method embodiments; and the foregoing storage medium includes: various media such as removable storage devices, ROMs, magnetic disks, or optical discs that can store program codes.
[0141] Alternatively, if the above integrated units of this application are implemented in the form of software function modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solutions of the embodiments of this application essentially or the part that contributes to the related art can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of the various embodiments of this application. And the foregoing storage medium includes: various media such as removable storage devices, ROMs, magnetic disks, or optical discs that can store program codes.
[0142] It should be noted that the drawings in the embodiments of this application are only for illustrating the schematic positions of various components on the terminal device, and do not represent the actual positions in the terminal device. The actual positions of each component or each area can be changed or offset according to the actual situation (for example, the structure of the terminal device). Moreover, the proportions of different parts in the terminal device in the figure do not represent the actual proportions.
[0143] The above is only the implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed in this application can easily think of changes or substitutions, which should all be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
Claims
1. A method for managing processes within a container, characterized in that, the method includes: invoking a first management process to obtain a management request for managing processes to be managed in a container set, where the processes to be managed correspond to the working state of the container set; invoking a second management process to receive the management request sent by the first management process; where the second management process belongs to the container set and the first management process does not belong to the container set; invoking the second management process to respond to the management request and manage the processes to be managed; wherein, the invoking the second management process to respond to the management request and manage the processes to be managed includes: invoking the second management process to determine the management operation requested by the management request; if the management operation is a switching operation, invoking the second management process to obtain the working state; if the working state is a business processing state, invoking the second management process to determine that among the processes in the container set that meet the state switching conditions in the standby state corresponding to the business processing state are the processes to be managed, and controlling the processes to be managed to perform a state switch; controlling the working state of the container set to switch from the business processing state to the standby state.
2. The method according to claim 1, characterized in that, the state switching conditions include: not started in the standby state and need to be started; the controlling the processes to be managed to perform a state switch includes: starting the processes to be managed.
3. The method according to claim 1, characterized in that, the state switching conditions include: prohibited from starting in the standby state and already started in the business processing state; the controlling the processes to be managed to perform a state switch includes: shutting down the processes to be managed.
4. The method according to any one of claims 1 to 3, characterized in that, before the invoking the first management process to obtain a management request for managing processes to be managed in a container set, the method further includes: if the second management process detects that the running state of at least one of the processes to be managed in the container set is a shutdown state, invoking the second management process to notify the first management process to perform a process management operation.
5. The method according to claim 1, characterized in that, the invoking the second management process to respond to the management request and manage the processes to be managed includes: invoking the second management process to determine the management operation requested by the management request; if the management operation is a sharding operation for the business processed by the processes to be managed, invoking the second management process to generate business sharding information for each process that needs to balance the processed business based on the load of each process in the container set; invoking the second management process to allocate the business sharding information of each process to the corresponding process.
6. The method according to claim 1, characterized in that, the management request carries a process identifier of the process to be managed, and the invoking the second management process to respond to the management request and manage the process to be managed includes: Invoke the second management process to determine the management operation requested by the management request; If the management operation is a query operation, invoke the second management process to find the query result associated with the process to be managed based on the process identifier through the query interface.
7. A management platform for processes within a container, the management platform for processes within a container comprises: An obtaining module, configured to invoke a first management process to obtain a management request for managing a process to be managed in a container set; wherein, the process to be managed corresponds to the working state of the container set; A processing module, configured to invoke a second management process to receive the management request sent by the first management process; wherein, the second management process belongs to the container set, and the first management process does not belong to the container set; The processing module is further configured to invoke the second management process to respond to the management request and manage the process to be managed; wherein, invoking the second management process to respond to the management request and manage the process to be managed includes: invoking the second management process to determine the management operation requested by the management request; if the management operation is a switching operation, invoking the second management process to obtain the working state; if the working state is a business processing state, invoking the second management process to determine that the process in the container set that meets the state switching condition in the corresponding standby state is the process to be managed, and controlling the process to be managed to perform a state switch; controlling the working state of the container set to switch from the business processing state to the standby state.
8. A management platform for processes within a container, the management platform for processes within a container comprises: A memory, configured to store executable instructions; A processor, configured to execute the executable instructions stored in the memory to implement the management method for processes within a container according to any one of claims 1 to 6.
9. A computer-readable storage medium, the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the management method for processes within a container according to any one of claims 1 to 6.
Citation Information
Patent Citations
Monitoring system and method for employing multi-process applications in container cluster
CN106776212A