CN113760409A - Service instance management method, device, equipment and storage medium - Google Patents

Service instance management method, device, equipment and storage medium Download PDF

Info

Publication number
CN113760409A
CN113760409A CN202111055797.1A CN202111055797A CN113760409A CN 113760409 A CN113760409 A CN 113760409A CN 202111055797 A CN202111055797 A CN 202111055797A CN 113760409 A CN113760409 A CN 113760409A
Authority
CN
China
Prior art keywords
instruction
service instance
instance
information
platform
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111055797.1A
Other languages
Chinese (zh)
Inventor
古才良
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Baiguoyuan Information Technology Co Ltd
Original Assignee
Guangzhou Baiguoyuan Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Baiguoyuan Information Technology Co Ltd filed Critical Guangzhou Baiguoyuan Information Technology Co Ltd
Priority to CN202111055797.1A priority Critical patent/CN113760409A/en
Publication of CN113760409A publication Critical patent/CN113760409A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms

Abstract

The invention relates to a service instance management method, a device, equipment and a storage medium, wherein the method comprises the following steps: receiving an instruction aiming at a service instance, wherein the instruction aiming at the service instance comprises an issuing platform instruction or an automatic pull instruction; the issuing platform instruction comprises meta information, wherein the meta information comprises information used for representing the expected state of a corresponding service instance after the issuing platform instruction is executed; before executing the instruction for the service instance, judging whether the instruction for the service instance is an automatic pull-up instruction, if so, judging whether the expected state of the service instance is stopped, and if so, not allowing the automatic pull-up instruction to be executed; if the instruction for the service instance is an issue platform instruction, or if the expected state is not stop, then the instruction for the service instance is executed. The service instance management method of the invention can realize the consistency of the service process state.

Description

Service instance management method, device, equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for managing a service instance.
Background
The statements herein merely provide background information related to the present disclosure and may not necessarily constitute prior art.
The publishing platform, also called a service publishing platform system, is used for managing the life cycle of a service instance, and has the main functions of: storage management, distribution deployment, and instruction execution, among others. Taking the package issuing system as an example, the issuing end will issue and deploy the service package group to the specified receiving end machine as required, and then execute the packages as required to perform life cycle operations such as deployment, unloading, start-stop, and the like.
With the long-term service of the machine, the machine may have various unpredictable faults, which may cause service processes originally running on the machine to stop due to reasons such as restart, power failure, memory, network, and the like. Therefore, the packet issuing system bears the responsibility of automatically pulling up the monitoring service process, namely, is responsible for checking whether the process normally operates, and if the process is found to abnormally operate, the starting instruction needs to be executed again to recover the operation of the service process. Specifically, if the service process itself is not in a running state, such as a process stopped by a user operation, the packet issuing system should not restart the process. The issuing system is to ensure the actual instance state and the service process state expected by the user to be consistent.
Disclosure of Invention
The invention aims to provide a novel service instance management method, a novel service instance management device and a novel service instance management storage medium, which are used for realizing the consistency of service process states.
The purpose of the invention is realized by adopting the following technical scheme. The service instance management method provided by the invention comprises the following steps: receiving an instruction for a service instance, wherein the instruction for the service instance comprises a platform issuing instruction or an automatic pull instruction; the issuing platform instruction comprises meta information, wherein the meta information comprises information used for representing an expected state of a corresponding service instance after the issuing platform instruction is executed; before executing the instruction for the service instance, judging whether the instruction for the service instance is an automatic pull-up instruction, if so, judging whether the expected state of the service instance is a stop, and if the expected state is a stop, not allowing the automatic pull-up instruction to be executed; and if the instruction for the service instance is an issue platform instruction or if the expected state is not stop, executing the instruction for the service instance.
The purpose of the invention is realized by adopting the following technical scheme. A service instance management method proposed according to the present disclosure includes: and sending a publishing platform instruction, wherein the publishing platform instruction includes meta information, and the meta information includes information used for representing an expected state of a corresponding service instance after the publishing platform instruction is executed, so that a receiving end of the publishing platform instruction executes the publishing platform instruction according to the service instance management method of the foregoing example.
The purpose of the invention is realized by adopting the following technical scheme. According to this disclosure, a service instance management apparatus is proposed, which includes: the system comprises a receiving module, a sending module and a processing module, wherein the receiving module is used for receiving an instruction aiming at a service instance, and the instruction aiming at the service instance comprises an issuing platform instruction or an automatic pull-up instruction; the issuing platform instruction comprises meta information, wherein the meta information comprises information used for representing an expected state of a corresponding service instance after the issuing platform instruction is executed; the judging module is used for judging whether the instruction for the service instance is an automatic pull-up instruction, judging whether the expected state of the service instance is stopped if the instruction is the automatic pull-up instruction, and not allowing the automatic pull-up instruction to be executed if the expected state is stopped; and the execution module is used for executing the instruction aiming at the service instance if the instruction aiming at the service instance is an issue platform instruction or if the expected state is not stop.
The purpose of the invention is realized by adopting the following technical scheme. According to this disclosure, a service instance management apparatus is proposed, which includes: a sending module, configured to send a platform issuing instruction, where the platform issuing instruction includes meta information, and the meta information includes information used to represent an expected state of a corresponding service instance after the platform issuing instruction is executed, so that a receiving end of the platform issuing instruction executes the platform issuing instruction according to the service instance management method.
The purpose of the invention is realized by adopting the following technical scheme. According to the present disclosure, a service instance management device is proposed, which includes: a memory for storing non-transitory computer readable instructions; and a processor for executing the computer readable instructions, so that the processor realizes any one of the aforementioned service instance management methods when executing the processor.
The purpose of the invention is realized by adopting the following technical scheme. A computer-readable storage medium according to the present disclosure is provided for storing non-transitory computer-readable instructions which, when executed by a computer, cause the computer to perform any one of the aforementioned service instance management methods.
Compared with the prior art, the invention has obvious advantages and beneficial effects. By the technical scheme, the service instance management method, the device, the equipment and the storage medium provided by the invention at least have the following advantages and beneficial effects: the invention realizes the consistency of the instance state of the publishing platform by utilizing the meta-information mechanism, particularly simultaneously utilizing the meta-information mechanism and the instance context information mechanism.
The foregoing description is only an overview of the technical solutions of the present invention, and in order to make the technical means of the present invention more clearly understood, the present invention may be implemented in accordance with the content of the description, and in order to make the above and other objects, features, and advantages of the present invention more clearly understandable, the following preferred embodiments are described in detail with reference to the accompanying drawings.
Drawings
FIG. 1 is a flow diagram of service instance management for a prior art publication platform;
FIG. 2 is a flow diagram illustrating a method for service instance management, in accordance with an embodiment of the present invention;
FIG. 3 is a flow chart illustrating a service instance management method according to another embodiment of the invention;
FIG. 4 is a flowchart illustrating a service instance management method according to yet another embodiment of the invention;
FIG. 5 is a flowchart illustrating a service instance management method according to another embodiment of the invention;
fig. 6 is a schematic diagram of a service instance management apparatus according to an embodiment of the present invention.
Detailed Description
To further illustrate the technical means and effects of the present invention adopted to achieve the predetermined objects, the following detailed description will be given of specific embodiments, structures, features and effects of a service instance management method, device, apparatus and storage medium according to the present invention, with reference to the accompanying drawings and preferred embodiments.
It is noted that, in this document, relational terms such as "first," "second," and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. In addition, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The publication system referred to herein is also referred to as a service publication platform system for managing the lifecycle of service instances. The primary functions include, but are not limited to: storage management, distribution deployment, and instruction execution. Optionally, the invention relates to the distribution of physical machines.
The co _ agent referred to herein is: a websocket service is responsible for receiving and executing instructions and returning instruction execution results.
Crontab as referred to herein is: on Linux machines are commands for executing programs periodically.
Examples of services mentioned herein are: and (5) service processing.
Example states mentioned herein are: the state of the service process on the machine, such as: running state and stopping state.
The process auto-pull monitoring referred to herein is: and checking whether the instance state is stopped, if the instance state is detected to be stopped, executing a corresponding starting program, and recovering the program running state.
The distribution system comprises a container cloud-based distribution system and a Linux-based distribution system.
A container cloud based publication system:
with the development of technology, the container cloud has become a main type of release system, and has perfect editing and management functions. Taking kubernets as an example, each service node starts a kubel service running on the node, which can read the container list to ensure that the specified container service is started and run. Generally, the health state of the container is checked in a probe mode, or the state of the corresponding container is acquired in a container docker API mode, if the container is detected to be abnormal, the kubel kills the container, the container information is reported to the controller, and the controller restarts a policy to perform corresponding processing, such as recreating a new container.
Linux-based distribution system:
FIG. 1 shows a schematic illustration of an existing package publishing system instance coherence mechanism. The consistency guarantee of the existing example state of packet distribution based on Linux is that a process monitoring list is executed at regular time through a crontab on a receiving end machine, but the list has a certain cache, when a user stops a certain service process (such as stopping operation, unloading operation and the like) through a packet distribution system platform, the service process needs to be removed from the monitoring list, and the example state on the receiving end machine is expected to be stopped and cannot be started again for running. However, due to some reasons (network problem, no response of the machine, etc.), the monitoring list cannot be updated in time, and it cannot be ensured that the latest monitoring list is obtained in real time, so that the crontab executes the old monitoring list, and still checks the service process, and when detecting that the service is stopped, executes a start instruction to resume the process running, thereby starting an unexpected service process, causing a false pull-up condition, and causing a problem of inconsistent instance states (the user expects to be stopped, but the service process on the machine is already started).
In addition, because the crontab timing task process and the instruction execution process of the packet issuing platform are two different processes, interactive communication and mutual exclusion between the processes also bring certain problems. For example, the packet issuing platform just issues an instruction to execute, and a crontab task process is started at exactly the same time, so that a plurality of processes operate the same instance at the same time, for example, if the packet issuing platform issues a process stopping instruction, but the crontab starts the process, an inconsistent problem may also occur at this time.
Aiming at the existing problems, the problem of false pull caused by monitoring list caching needs to be solved, the problem of mutual exclusion of crontab and a packet issuing platform instruction execution process is solved, and packet issuing can ensure that the actual instance state and the expected state are consistent.
FIG. 2 is a schematic flow chart diagram illustrating one embodiment of a service instance management method of the present invention. In some embodiments of the present invention, referring to fig. 2, an exemplary service instance management method of the present invention mainly includes the following steps:
step S11, an instruction for a service instance is received. Wherein the instruction for the service instance comprises an issue platform instruction or an auto-pull instruction.
Wherein the issue platform instruction is an instruction received from an issue platform. Optionally, the platform instruction is issued with an instruction related to a life cycle of the service instance.
Wherein the auto-pull instruction is for automatically pulling up the service process. Note that the auto-pull instruction may be erroneous, and that executing the mis-pull instruction will pull up the initiation of the unexpected service instance.
The issue platform command includes meta information (metadata). The meta-information is used to record the configuration of the publishing platform to the service instance, including but not limited to: information representing an expected state of a corresponding service instance after execution of the issue platform instruction.
Step S12 is to determine whether the instruction for the service instance is an auto-pull instruction before executing the instruction for the service instance, determine whether the expected state of the service instance is a stop if the instruction is an auto-pull instruction, and disallow the execution of the auto-pull instruction if the expected state is a stop.
In step S13, if the instruction for the service instance is an issue platform instruction or if the expected status is not stop, the instruction for the service instance is executed.
By using the service instance management method of the invention and by using the meta-information mechanism, the service process can be prevented from being pulled up by mistake, and the instance state consistency of the publishing platform is further realized.
In some embodiments of the present invention, the issue platform issues a transaction consisting of multiple instructions. In particular, a transaction includes one or more instructions to be executed for one or more service instances. The transactions issued by the publishing platform include, but are not limited to, deployment, upgrade, rollback, uninstallation, configuration change, start, restart, stop, and the like. The similarity of the operation transactions that the issuing platform can issue can be pre-configured. And some of the meta-information contained in the instruction corresponds to the transaction to which the instruction belongs. For example, the following operation transaction information (transaction) may identify the status of the execution sequence in a plurality of sequentially executed instructions included in a transaction, for example: identifying which instruction is the last instruction executed (end and non-end); or both the first and last executed instruction (begin, end, and others) are identified so that this information can be exploited to disallow execution of a self-pulling instruction during instruction execution between begin and end.
In some embodiments of the invention, the meta information (metadata) includes identification information and operation type information (op). The identification information, also referred to as a unique identifier, is used to identify the target service instance to which the instruction is directed. For example, the identification information may specifically include a service package name field (pack) and a service version field (ver). The operation type information (op) represents the expected state of the target service instance after executing instructions for the service instance. Further, the meta information may further include operation transaction information (transaction). The operation transaction information (transaction) indicates whether the target service instance has completed the target transaction after executing the specific processing of the instruction for the service instance. In addition, the auto-pull command includes, but is not limited to: and identity identification information.
As an alternative embodiment, the meta-information data structure may be defined as
Figure BDA0003254580420000061
FIG. 3 is a schematic flow chart diagram of another embodiment of a service instance management method of the present invention. In some embodiments of the present invention, referring to fig. 3, before step S12 in the previous embodiment, the method for managing a service instance of the present invention further includes: step S21, parsing the instruction for the service instance, and obtaining or creating instance context information (instance _ context) corresponding to the parsed target service instance. For example, the corresponding instance context information is obtained or created according to the identity information of the parsed target service instance.
The aforementioned instance context information is used to record the expected running state and the context execution state of the service instance, and includes but is not limited to: the instance expected status field (instance _ status). The instance expected state field may be used to represent the expected state of the instance after the operation executes the instruction. Further, the instance context information may also include a context execution status field (executing) that may be used to identify whether the instance context is being executed. Optionally, the instance context information may further include a pipe field (channel) for identifying deposit information of the instruction.
Note that the foregoing acquisition or creation means: if the context information corresponding to the target service instance does not exist or the operation is executed on the service instance for the first time, the corresponding instance context information is created; if the corresponding instance context information already exists or the operation is not performed on the service instance for the first time, the corresponding instance context is obtained.
As an alternative embodiment, the context data structure may be defined as
Figure BDA0003254580420000062
In some embodiments of the present invention, referring to fig. 3, the step S12 specifically includes: step S22, determining whether the instruction for the service instance is an auto-pull instruction, if so, determining the expected state of the target service instance according to an instance expected state field (instance _ status) in the instance context information, and if the instance expected state field (instance _ status) indicates that the expected running state of the target service instance is a stop state, not allowing the auto-pull instruction to be executed and ending the execution of the instruction, that is, not monitoring the process of pulling the expected stop. The step S13 specifically includes: step S23, if the instruction for the service instance is an issue platform instruction or if the instance expected status field (instance _ status) indicates that the expected status of the target service instance is not a stop status but is running, updating the instance context information; in step S24, after the instance context information is updated, a specific process for the instruction of the service instance is executed.
Wherein, the updating the instance context information in the step S23 specifically includes: if the instruction for the service instance is an issue platform instruction, an instance expected status field (instance _ status) in the instance context information of the target service instance is updated according to the operation type information (op) in the meta information (metadata). Specifically, the instance expected state field (instance _ status) of the updated instance context information is in an executing state if the operation type information (op) in the meta information is in a starting state, and is in a stopping state if the operation type information (op) is in a stopping state. In the subsequent step S12, if the instruction is an auto-pull instruction, the value of the instance expected status field (instance _ status) in the instance context information is determined, so as to prevent the problem of inconsistent instance status caused by untimely cache update of the monitoring list and mistaken pull of the service process.
It should be noted that if the instruction for the service instance is not an issue platform instruction but an auto-pull instruction, the aforementioned updating and modifying the instance expected state field according to the operation type information in the meta-information may not be performed.
By using the service instance management method provided by the invention, the service life cycle is managed and controlled by using the issuing platform, and after the service is deployed to the receiving terminal equipment, the actual state of the service instance can be ensured to be consistent with the expected state by using the meta information of the instruction and the corresponding instance context information, so that the closed loop of the flow state is realized. The problem that the service instance which is expected to stop by the user is pulled up and started by mistake is solved, the service instance which is expected to run by the user can be automatically pulled up and started when the monitoring and the recognition are stopped, and finally the consistency of the instance states is realized.
FIG. 4 is a schematic flow chart diagram illustrating a service instance management method according to yet another embodiment of the present invention. In some embodiments of the present invention, referring to fig. 4, an exemplary service instance management method of the present invention mainly includes the following steps:
step S31, an instruction for a service instance is received. Wherein the instruction for the service instance comprises an issue platform instruction or an auto-pull instruction. Wherein, the issuing platform instruction comprises meta-information. The meta information includes: identification information and operation type information. The automatic pull-up command also includes identification information.
Step S32, parsing the instruction for the service instance, and obtaining or creating instance context information corresponding to the parsed target service instance. Wherein, the instance context information is used to record the expected running state and the context execution state of the service instance, including but not limited to: instance expected run state field (instance _ status) and context execution state field (executing). The context execution state field is used to mark whether context information is being used.
Step S33, checking whether the context is already in execution by determining according to the context execution status field (executing) in the instance context information, and if the context information is in the execution (true) state, not allowing the execution of the instruction for the service instance and ending the execution of the instruction.
Step S34, determining whether the instruction for the service instance is an auto-pull instruction, if so, determining an expected state of the target service instance according to an instance expected running state field (instance _ status) in the instance context information, and if the expected running state of the target service instance is in a stop state, not allowing the auto-pull instruction to be executed and ending the subsequent execution of the instruction.
In step S35, if the instruction for the service instance is an issue platform instruction, or if the expected state of the target service instance is not a stop state, the instance context information is updated.
Wherein, updating the instance context information specifically includes:
(1) an instance expected state field (instance _ status) in the instance context information of the target service instance is updated according to the operation type information (op) in the meta-information to indicate the expected instance state of the operation executing this instruction. Specifically, the instance expected state field (instance _ status) of the updated instance context information is in an executing state if the operation type information (op) in the meta information is in a starting state, and is in a stopping state if the operation type information (op) is in a stopping state. In the subsequent step S34, if the value is an auto-pull instruction (auto-pull instruction), the value of the instance expected status field (instance _ status) in the instance context information is determined, so as to prevent the problem of inconsistent instance status caused by untimely cache update of the monitoring list and mis-pull of the service process.
(2) The context execution state field (executing) in the instance context information of the target service instance is set to an executing state for marking the instance context as an executing state. Optionally, if the context execution state field (executing) is set to be in an executing state, it indicates that the corresponding service is being executed by one instruction at this time, and the service does not allow other instructions to be executed. Optionally, if the context execution state field (executing) is set to be in an executing state, it indicates that the transaction corresponding to the instruction is started at this time, so that the current instance context only serves the instruction related to the current transaction until the transaction is ended. When step S33 is performed subsequently, the operation of the instruction for the service instance is controlled by determining the value of the context execution state field (executing), and if the context execution state field (executing) is in the executing state, the instruction is terminated, so that the automatic pull-up and packet issue instruction processes are mutually exclusive, and the problem of cross execution is avoided.
In step S36, after the above-described update of the instance context information is performed, a specific process for the instruction of the service instance is executed. For example, if the instruction is an auto-pull instruction, the target service instance is pulled; and if the instruction is the issue platform instruction, executing the specific operation of the issue platform instruction.
In step S37, after the aforementioned instruction for executing the service instance is executed, the context execution state field (executing) in the instance context information of the target service instance is set to a not-executed (false) state.
It should be noted that the foregoing step S33 is only required to be executed before the process of updating the instance context information in step S35. For example, in one optional example, this step S33 may be performed before the step of determining whether the instruction for the service instance is an auto-pull instruction of step S34; alternatively, in another alternative example, this step S33 is performed after the step of determining whether the instruction for the service instance is an auto-pull instruction at step S34 and before the step of updating the instance context information at step S35.
Note that both platform and auto-pull instructions may be issued and may be reached simultaneously. By setting the context execution state field (executing), when the instruction of each source starts (the start of an instruction transaction), the context execution state field executing is updated to be in execution (true), and the context execution state field executing is updated to be not in execution (false) until the instruction of the transaction end is received, so that the service instance management method can avoid unexpected operation caused by the simultaneous execution of the instructions of the two sources. For example, when a user issues a transaction or an instruction through the issue platform, execution of the self-pull instruction can be avoided.
In some embodiments of the invention, the receiving of the instruction for the service instance in the aforementioned step S11 or S13 comprises: and receiving a target transaction issued by the issuing platform, wherein the target transaction comprises one or more issuing platform instructions aiming at one or more service instances. The meta information also includes operation transaction information (transaction). The operation transaction information (transaction) indicates: after the current specific processing of the instruction for the service instance is executed, whether the service instance corresponding to the instruction (i.e., the aforementioned target service instance) has completed the target transaction, that is, whether all instructions for the service instance corresponding to the current instruction in the instructions included in the transaction to which the current instruction belongs have ended. Moreover, the service instance management method of the present invention further includes: after the step of executing the instruction for the service instance, judging according to operation transaction information (transaction) in the meta information, and judging whether the processing of the target service instance by the target transaction issued by the platform is finished, that is, judging whether all instructions for the target service instance in the instruction included in the target transaction issued by the platform are finished, if the target transaction finishes the processing of the target service instance after executing the current issuing platform instruction, releasing the corresponding instance context information. Optionally, if the target transaction has completed processing on the target service instance after executing the current issue platform instruction, the corresponding instance context information is released, and the corresponding context execution state field executing is marked as a not-executed (false) state, which indicates that the instance context may continue to serve other instructions.
In some embodiments of the invention, the instance context information also includes a pipe field (channel). And the service instance management method of the present invention further comprises: and determining a target pipeline according to the pipeline field, and executing an instruction aiming at the service instance by using a coroutine (coroutine) corresponding to the target pipeline, thereby realizing the parallel processing of a plurality of target service instances by using a plurality of pipelines.
In some embodiments of the invention, the instance context information further comprises a timestamp field (timestamp). The aforementioned step of updating the instance context information further comprises: the timestamp field is updated.
In some embodiments of the present invention, the generation of the auto-pull instruction may be performed at preset first time intervals using a time task (timed task). Note that, the aforementioned first time interval is not particularly limited; alternatively, the auto-pull instruction may be generated once per minute. As a specific embodiment, the receiving of the automatic pull instruction in the instruction for the service instance in step S11 or step S31 specifically includes: periodically, for example, taking a second time interval as a period, actively obtaining a process monitoring list (also called a monitoring instance list) from an instruction of an issuing platform; periodically, for example, in a period of the first time interval, an automatic pull-up command is generated based on the process monitoring list. It should be noted that, the second time interval is not particularly limited, and the duration of the second time interval may be consistent with or inconsistent with the duration of the first time interval; optionally, if the process monitoring list is successfully acquired, the process monitoring list is acquired next time at ten-minute intervals, and if the process monitoring list is not successfully acquired, the process monitoring list is acquired next time at one-minute intervals. Note that the process monitoring list may not be up-to-date, and thus the auto-pull instruction generated may be erroneous.
The life cycle of the distribution server, the server at the receiving end, the personal PC, the mobile terminal, and other devices may experience a plurality of states, such as being on shelf, repaired, reinstalled, shut down, in operation, in test, or scrapped. On the business level, the device capable of running the process needs to be in an operating/testing state, that is, only the process on the machine in the operating/testing state needs to be concerned. In some embodiments of the present invention, the service instance management method of the present invention further comprises: periodically, for example, with a third time interval as a period, obtaining the machine state information of the receiving end, for example, the machine state information can be obtained according to CMDB (configuration management database) information; before executing the instructions, e.g., before performing the aforementioned step S11, or before performing the aforementioned step S12, or before performing the aforementioned step of obtaining or creating instance context information corresponding to the parsed target service instance, the machine state information is checked, and if the machine is not in operation/under test, no instructions are executed. Note that the aforementioned third time interval is not particularly limited; optionally, if the machine state information is successfully acquired, the next acquisition of the machine state information is performed at ten-minute intervals, and if the machine state information is not successfully acquired, the next acquisition of the machine state information is performed at one-minute intervals.
In some embodiments of the present invention, the service instance management method of the present invention further comprises: the instance context information is recycled periodically, for example, in a period of a fourth time interval. It should be noted that the fourth time interval is not particularly limited, and for example, the corresponding context information may be periodically recovered from the instance list every day. With the iteration of the service version, the number of instance contexts on one machine is increased, and the historical instance contexts are recycled through the timing task, so that resources can be effectively released.
The embodiment of the invention also provides a service instance management method which is mainly suitable for the publishing platform end, and the method mainly comprises the following steps: and sending an instruction of the issuing platform. The issue platform instruction includes meta information, where the meta information includes information used to indicate an expected state of a corresponding service instance after the issue platform instruction is executed, so that a receiving end of the issue platform instruction executes the issue platform instruction according to various service instance management methods (for example, the methods in fig. 2, fig. 3, or fig. 4) in the foregoing embodiments.
As an alternative example, the meta-information of the issue platform instructions includes: the service instance identification information comprises identification information and operation type information, wherein the identification information is used for identifying a target service instance aimed by the instruction, and the operation type information represents an expected state of the target service instance after the instruction aimed at the service instance is executed.
As an optional example, the foregoing sending an issue platform instruction specifically includes: issuing a target transaction, the target transaction including one or more issue platform instructions for one or more service instances. And the meta information of the issue platform instruction further includes operation transaction information indicating whether the target service instance has completed the target transaction after executing the current issue platform instruction.
FIG. 5 is a schematic flow chart diagram illustrating a service instance management method according to yet another embodiment of the present invention.
In some embodiments of the present invention, for example, in the case of a Linux-based package issuing system, the transaction instruction and the auto-pull instruction of the package issuing platform are both received and executed in a unified manner by the co _ agent service. The transaction of the package publishing platform is generally related operation of a life cycle of a service instance issued by a user from a web page, and includes but is not limited to deployment, upgrading, rollback, unloading, configuration change, starting, restarting, stopping and other transactions; and the transaction of the package issuing platform comprises one or more instructions for one or more service instances, which are called transaction instructions of the package issuing platform. The auto-pull command is a timed monitoring task, managed by the co _ agent. Specifically, the method comprises the following steps:
1. each instruction issued by the package issuing platform carries meta-information (metadata), and the co _ agent analyzes the meta-information after receiving the instruction.
2. After the co _ agent receives the instruction, the meta information carried in the instruction is firstly analyzed, a corresponding instance context (instance _ context) is created or obtained according to the unique instance identifier in the meta information, and the instruction is added to the channel pipeline.
And generating an automatic pull-up task according to the list. Specifically, the time task (timed task) may be used to generate an auto-pull command at preset time intervals (for example, the first time interval). The auto-pull instruction needs to carry a unique instance identifier, which may be the actual service package name (pack) and the actual service version (ver).
3. The channel pipe of each instance context corresponds to a coroutine (coroutine), and instructions in the channel are executed in series. Firstly, checking and judging are carried out, and the instruction is executed after the checking is passed.
3.1, check if the context is already in execution (executing): if it is already in execution, then go back directly.
3.2, judging the initiator of the instruction: if the instruction is an automatic pull-up instruction, further judging the expected state of the instance, if the expected state is stop, the pull-up starting instruction does not allow execution, namely the process of pulling up the expected stop is not required to be monitored;
3.3, updating instance context information:
the previous step checks that the instance context is marked as being executed (updating execution is true), and at this time, the instruction transaction is started, so that the current instance context only serves the instructions related to the current transaction until the transaction is ended; and the value is judged when the step 3.1 is subsequently carried out, namely, the mutual exclusion of the automatic pull-up and packet issuing instruction processes is realized, and the problem of cross execution is avoided.
Based on the meta information of the packet issue instruction mentioned in step 1, the instance _ status of the instance context is updated (if the op is start, the instance _ status is running, and if the op is stop, the instance _ status is stop), which indicates the expected instance status when the operation executes the instruction. The subsequent second step of automatically pulling up the instruction can judge the value, namely, the problem that the service process is pulled up by mistake to cause inconsistent instance states because the cache of the monitoring list is not updated timely is solved.
3.4, executing the instruction; and judging whether the current instruction transaction is ended (the transaction is ended according to the end of the meta information transaction), if so, releasing the instance context, marking execution as false, and indicating that the instance context can continue to serve other instructions.
In some embodiments of the present invention, by removing the crontab mechanism, the crontab process and the packet issuing platform transaction instruction execution process are structured into the same co _ agent process, and the problem caused by mutual exclusion of different processes can be solved based on the same process. In addition, the invention maintains the context information of each instance on the co _ agent, and each process corresponds to one instance context, so that the problem that the process is pulled up by mistake can be solved, and the state consistency is finally realized.
The service instance management method provided by the invention can solve the following problems:
1. the problem of multi-instance parallelism can be solved: by creating context corresponding to the instances, the parallel operation of different instances is converted into serialization processing, and each instance has corresponding context, so that the contexts are not crossed.
2. The problem of cross execution of the automatic pull and packet issue instruction operations of the same instance can be solved: by submitting related instructions of the same instance to a channel, serializing in a queue form, and executing each instance context to identify whether the instance context is in use, cross-embedding execution of multiple task instructions is avoided.
3. The problems of automatic pulling of unexpected instances and inconsistent instance states can be solved: the instance context holds the expected state (instance _ status) of the instance, the state is checked before the auto-pull execution, and the start operation is not executed if the instance is already in the stop state. The most obvious solution problems are: and the process is stopped at the previous step of package release, and the error pull-up process is automatically pulled up at the next step.
4. The problem that the history instance has more contexts due to more version iterations can be solved: and the instance context is checked and recovered at regular time, so that the history instance context is prevented from being left, and the machine resource is prevented from being wasted.
The embodiment of the invention also provides a service instance management device, which mainly comprises: the device comprises a receiving module, a judging module and an executing module.
Wherein the receiving module is configured to: an instruction for a service instance is received. Wherein the instruction for the service instance comprises an issue platform instruction or an auto-pull instruction. The issuing platform instruction comprises meta information, and the meta information comprises information used for representing the expected state of the corresponding service instance after the issuing platform instruction is executed.
The judging module is used for: and judging whether the instruction for the service instance is an automatic pull-up instruction, if so, judging whether the expected state of the service instance is stop, and if so, not allowing the automatic pull-up instruction to be executed.
The execution module is to: if the instruction for the service instance is an issue platform instruction, or if the expected state is not stop, the specific processing of the instruction for the service instance is performed.
In addition, the various service instance management devices shown in the embodiments of the present invention include modules and units for executing the methods described in the foregoing embodiments, and for detailed description and technical effects, reference may be made to corresponding descriptions in the foregoing embodiments, which are not described herein again.
The embodiment of the invention also provides a service instance management device, which is suitable for a publishing terminal and mainly comprises: and the sending module is used for sending the issuing platform instruction, wherein the issuing platform instruction comprises meta information, and the meta information comprises information used for representing the expected state of the corresponding service instance after the issuing platform instruction is executed, so that a receiving end of the issuing platform instruction executes the issuing platform instruction according to various embodiments of the service instance management method.
FIG. 6 is a schematic block diagram illustrating a service instance management apparatus according to one embodiment of the present invention. As shown in fig. 6, a service instance management apparatus 100 according to an embodiment of the present disclosure includes a memory 101 and a processor 102.
The memory 101 is used to store non-transitory computer readable instructions. In particular, memory 101 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, Random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, Read Only Memory (ROM), hard disk, flash memory, etc.
The processor 102 may be a Central Processing Unit (CPU) or other form of processing unit having data processing capabilities and/or instruction execution capabilities, and may control other components in the service instance management device 100 to perform desired functions. In an embodiment of the present disclosure, the processor 102 is configured to execute the computer readable instructions stored in the memory 101, so that the service instance management apparatus 100 performs all or part of the foregoing steps of the service instance management method according to the embodiments of the present disclosure.
For the detailed description and the technical effects of the present embodiment, reference may be made to the corresponding descriptions in the foregoing embodiments, which are not repeated herein.
Embodiments of the present invention further provide a computer storage medium, where computer instructions are stored, and when the computer instructions are run on a device, the device executes the above related method steps to implement the service instance management method in the above embodiments.
Embodiments of the present invention also provide a computer program product, which when running on a computer, causes the computer to execute the above related steps to implement the service instance management method in the above embodiments.
In addition, the embodiment of the present invention further provides an apparatus, which may specifically be a chip, a component or a module, and the apparatus may include a processor and a memory connected to each other; the memory is used for storing computer execution instructions, and when the device runs, the processor can execute the computer execution instructions stored in the memory, so that the chip can execute the service instance management method in the above method embodiments.
The apparatus, the computer storage medium, the computer program product, or the chip provided by the present invention are all configured to execute the corresponding methods provided above, and therefore, the beneficial effects achieved by the apparatus, the computer storage medium, the computer program product, or the chip may refer to the beneficial effects in the corresponding methods provided above, and are not described herein again.
Although the present invention has been described with reference to a preferred embodiment, it should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A method for service instance management, the method comprising the steps of:
receiving an instruction for a service instance, wherein the instruction for the service instance comprises a platform issuing instruction or an automatic pull instruction; the issuing platform instruction comprises meta information, wherein the meta information comprises information used for representing an expected state of a corresponding service instance after the issuing platform instruction is executed;
before executing the instruction for the service instance, judging whether the instruction for the service instance is an automatic pull-up instruction, if so, judging whether the expected state of the service instance is a stop, and if the expected state is a stop, not allowing the automatic pull-up instruction to be executed;
and if the instruction for the service instance is an issue platform instruction or if the expected state is not stop, executing the instruction for the service instance.
2. The service instance management method of claim 1,
the meta-information comprises identity identification information and operation type information, wherein the identity identification information is used for identifying a target service instance aimed by an instruction, and the operation type information represents the expected state of the target service instance after the instruction aimed at the service instance is executed; the automatic pull-up instruction comprises the identity identification information;
before the determining whether the instruction for the service instance is an auto-pull instruction, the method further includes: analyzing the instruction aiming at the service instance, and acquiring or creating instance context information corresponding to the analyzed target service instance, wherein the instance context information comprises an instance expected state field;
the determining whether the expected state of the service instance is stopped, and if the expected state is stopped, not allowing the automatic pull-up instruction to be executed includes: judging according to the instance expected state field in the instance context information, if the instance expected state field indicates that the expected state of the target service instance is a stop state, not allowing the automatic pull-up instruction to be executed and finishing the execution of the instruction;
if the instruction for the service instance is an issue platform instruction or if the expected state is not stop, executing the instruction for the service instance specifically includes: updating the instance context information if the instruction for the service instance is an issue platform instruction or if the instance expected state field indicates that the expected state of the target service instance is not a stop state; executing the instruction for the service instance after updating the instance context information;
wherein the updating the instance context information specifically includes: if the instruction for the service instance is an issue platform instruction, updating the instance expected state field in the instance context information of the target service instance according to the operation type information in the meta-information.
3. The service instance management method of claim 2, wherein:
the instance context information further includes a context execution state field;
prior to the updating the instance context information, the method further comprises: judging according to the context execution state field in the instance context information, if the context information is in an execution state, not allowing to execute the instruction aiming at the service instance and ending the execution of the instruction;
the updating the instance context information further comprises: setting the context execution state field in the instance context information of the target service instance to an in-execution state;
after the executing the instructions for the service instance, the method further comprises: setting the context execution state field in the instance context information of the target service instance to an unexecuted state.
4. The service instance management method according to claim 2 or 3,
the receiving instructions for a service instance comprises: receiving a target transaction issued by a publishing platform, wherein the target transaction comprises one or more publishing platform instructions aiming at one or more service instances;
the meta information further includes operation transaction information indicating whether the target service instance has completed the target transaction after executing the current issue platform instruction;
after the executing the instructions for the service instance, the method further comprises: and judging according to the operation transaction information in the meta information, and releasing the instance context information if the target transaction completes the processing of the target service instance after the current issuing platform instruction is executed.
5. The service instance management method of claim 2,
the instance context information further includes a pipe field;
the method further comprises the following steps: and determining a target pipeline according to the pipeline field, and executing the instruction aiming at the service instance by utilizing a coroutine corresponding to the target pipeline.
6. A method for service instance management, the method comprising: the method comprises the following steps:
sending a platform issuing instruction, wherein the platform issuing instruction includes meta information, and the meta information includes information used for representing an expected state of a corresponding service instance after the platform issuing instruction is executed, so that a receiving end of the platform issuing instruction executes the platform issuing instruction according to the service instance management method according to any one of claims 1 to 5.
7. An apparatus for service instance management, the apparatus comprising:
the system comprises a receiving module, a sending module and a processing module, wherein the receiving module is used for receiving an instruction aiming at a service instance, and the instruction aiming at the service instance comprises an issuing platform instruction or an automatic pull-up instruction; the issuing platform instruction comprises meta information, wherein the meta information comprises information used for representing an expected state of a corresponding service instance after the issuing platform instruction is executed;
the judging module is used for judging whether the instruction for the service instance is an automatic pull-up instruction, judging whether the expected state of the service instance is stopped if the instruction is the automatic pull-up instruction, and not allowing the automatic pull-up instruction to be executed if the expected state is stopped; and the number of the first and second groups,
and the execution module is used for executing the instruction aiming at the service instance if the instruction aiming at the service instance is an issue platform instruction or if the expected state is not stop.
8. An apparatus for service instance management, the apparatus comprising:
a sending module, configured to send a platform issuing instruction, where the platform issuing instruction includes meta information, and the meta information includes information used to represent an expected state of a corresponding service instance after the platform issuing instruction is executed, so that a receiving end of the platform issuing instruction executes the platform issuing instruction according to the service instance management method according to any one of claims 1 to 5.
9. A service instance management apparatus, comprising:
a memory for storing non-transitory computer readable instructions; and
a processor for executing the computer readable instructions such that the computer readable instructions, when executed by the processor, implement the service instance management method of any of claims 1 to 6.
10. A computer storage medium comprising computer instructions which, when run on a device, cause the device to perform the service instance management method of any one of claims 1 to 6.
CN202111055797.1A 2021-09-09 2021-09-09 Service instance management method, device, equipment and storage medium Pending CN113760409A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111055797.1A CN113760409A (en) 2021-09-09 2021-09-09 Service instance management method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111055797.1A CN113760409A (en) 2021-09-09 2021-09-09 Service instance management method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113760409A true CN113760409A (en) 2021-12-07

Family

ID=78794275

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111055797.1A Pending CN113760409A (en) 2021-09-09 2021-09-09 Service instance management method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113760409A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101552739A (en) * 2008-04-03 2009-10-07 北京邮电大学 Method and system for managing life cycle of network service process example
CN108595316A (en) * 2018-04-20 2018-09-28 星环信息科技(上海)有限公司 Life cycle management method, manager, equipment and the medium of Distributed Application
CN109361525A (en) * 2018-10-25 2019-02-19 珠海派诺科技股份有限公司 Restart method, apparatus, controlling terminal and medium that distributed deployment services more
CN109660380A (en) * 2018-09-28 2019-04-19 深圳壹账通智能科技有限公司 Monitoring method, platform, system and the readable storage medium storing program for executing of operation condition of server
CN111324423A (en) * 2020-03-03 2020-06-23 腾讯科技(深圳)有限公司 Method and device for monitoring processes in container, storage medium and computer equipment
CN111737060A (en) * 2020-08-07 2020-10-02 北京金山云网络技术有限公司 Method and device for processing component exception and electronic equipment
CN113032054A (en) * 2021-04-21 2021-06-25 杭州华橙软件技术有限公司 Service execution method, device, storage medium and electronic device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101552739A (en) * 2008-04-03 2009-10-07 北京邮电大学 Method and system for managing life cycle of network service process example
CN108595316A (en) * 2018-04-20 2018-09-28 星环信息科技(上海)有限公司 Life cycle management method, manager, equipment and the medium of Distributed Application
CN109660380A (en) * 2018-09-28 2019-04-19 深圳壹账通智能科技有限公司 Monitoring method, platform, system and the readable storage medium storing program for executing of operation condition of server
CN109361525A (en) * 2018-10-25 2019-02-19 珠海派诺科技股份有限公司 Restart method, apparatus, controlling terminal and medium that distributed deployment services more
CN111324423A (en) * 2020-03-03 2020-06-23 腾讯科技(深圳)有限公司 Method and device for monitoring processes in container, storage medium and computer equipment
CN111737060A (en) * 2020-08-07 2020-10-02 北京金山云网络技术有限公司 Method and device for processing component exception and electronic equipment
CN113032054A (en) * 2021-04-21 2021-06-25 杭州华橙软件技术有限公司 Service execution method, device, storage medium and electronic device

Similar Documents

Publication Publication Date Title
US8732693B2 (en) Managing continuous software deployment
CN106708740B (en) Script testing method and device
US9483383B2 (en) Injecting faults at select execution points of distributed applications
EP2972821B1 (en) Application compatibility checking in a distributed computing environment
CN107660289B (en) Automatic network control
CN107533504A (en) Anomaly analysis for software distribution
US20170322826A1 (en) Setting support program, setting support method, and setting support device
EP2008400A1 (en) Method, system and computer program for the centralized system management on endpoints of a distributed data processing system
CN104423981A (en) BMC (Baseboard Management Controller) firmware automatic update system and method
CN109144701A (en) A kind of task flow management method, device, equipment and system
CN111258591B (en) Program deployment task execution method, device, computer equipment and storage medium
US10733084B2 (en) Early test breakage detection using presubmit runs
CN109360029B (en) Self-management method of remote terminal advertising machine
CN109240716B (en) Big data platform version management and rapid iterative deployment method and system
CN111258850B (en) Method and device for updating software information based on Linux system
WO2022227454A1 (en) Automated testing system and method for continuous integration, and electronic device and storage medium
CN111078659A (en) Model updating method, model updating device, computer readable storage medium and computer equipment
CN112099825B (en) Method, device, equipment and storage medium for upgrading component
US9983988B1 (en) Resuming testing after a destructive event
CN111651352A (en) Warehouse code merging method and device
CN115454420A (en) Artificial intelligence algorithm model deployment system, method, equipment and storage medium
CN109445800B (en) Version automatic deployment method and system based on distributed system
CN110727575B (en) Information processing method, system, device and storage medium
CN113805925A (en) Online upgrading method, device, equipment and medium for distributed cluster management software
CN113721948A (en) Database upgrading method, system and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination