CN110647318A - Method, device, equipment and medium for creating instance of stateful application - Google Patents

Method, device, equipment and medium for creating instance of stateful application Download PDF

Info

Publication number
CN110647318A
CN110647318A CN201910937225.2A CN201910937225A CN110647318A CN 110647318 A CN110647318 A CN 110647318A CN 201910937225 A CN201910937225 A CN 201910937225A CN 110647318 A CN110647318 A CN 110647318A
Authority
CN
China
Prior art keywords
template
application instance
application
creating
copy number
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.)
Granted
Application number
CN201910937225.2A
Other languages
Chinese (zh)
Other versions
CN110647318B (en
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.)
Transwarp Technology Shanghai Co Ltd
Original Assignee
Xinghuan Information Technology (shanghai) 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 Xinghuan Information Technology (shanghai) Co Ltd filed Critical Xinghuan Information Technology (shanghai) Co Ltd
Priority to CN201910937225.2A priority Critical patent/CN110647318B/en
Publication of CN110647318A publication Critical patent/CN110647318A/en
Application granted granted Critical
Publication of CN110647318B publication Critical patent/CN110647318B/en
Priority to PCT/CN2020/118690 priority patent/WO2021058020A1/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • 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/445Program loading or initiating
    • G06F9/44536Selecting among different versions

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention discloses a method, a device, equipment and a medium for creating a stateful application instance. The method comprises the following steps: acquiring an application instance creation request submitted by a user; extracting a template mapping list from the application instance creating request, wherein the template mapping list comprises entries of corresponding relations between template names and template definitions, and the number of the template names is at least two; and respectively creating corresponding application instances under different template names by traversing each entry. When the embodiment of the invention is used for creating the instance of the stateful application, the template mapping list can be extracted from the application instance creating request submitted by the user, and the application instances with different configurations corresponding to different template names are created according to the template mapping list, so that the application instances with different configurations can run on different machines in the cluster, and the experience effect of the user is improved.

Description

Method, device, equipment and medium for creating instance of stateful application
Technical Field
The embodiment of the invention relates to the technical field of database application, in particular to a method, a device, equipment and a medium for creating a stateful application instance.
Background
The Kubernetes is an open-source platform, is used for managing containerized applications on a plurality of hosts in a cloud platform, and can realize the functions of automatic deployment, automatic capacity expansion, maintenance and the like of a container cluster. The pod is an application example in a Kubernetes cluster, is the smallest unit which can be created and deployed in Kubernetes, and contains one or more containers and resources shared by the containers such as storage and networks.
In a kubernets cluster, particularly, control pod resources are generally divided into stateful application controllers and stateless application controllers, for a stateless controller built in the kubernets cluster, for example, a repliationcontroller, a Replica Set, a Deployment, a daemon Set, and the like can already meet requirements of a production environment, for a stateful controller, only a satufuelset is currently used, and a topology state and a storage state are generally adopted to realize creation of an application instance.
In the process of implementing the invention, the inventor finds that the prior art has the following defects: when a stateful application controller in the prior art creates stateful application instances, a fixed template is usually used to create all application instances, so that configurations of all application instances are completely the same, and in actual application, due to heterogeneous differences among clustered machines, a running result of the same application instance created by using the same template on different machines may not be ideal, thereby reducing an experience effect of a user.
Disclosure of Invention
The invention provides a method, a device, equipment and a medium for creating an instance of a stateful application, so as to create application instances of different configurations corresponding to different templates and improve the experience effect of a user.
In a first aspect, an embodiment of the present invention provides an instance creating method for a stateful application, including:
acquiring an application instance creation request submitted by a user;
extracting a template mapping list from the application instance creating request, wherein the template mapping list comprises entries of corresponding relations between template names and template definitions, and the number of the template names is at least two;
and respectively creating corresponding application instances under different template names by traversing each entry.
In a second aspect, an embodiment of the present invention further provides an instance creating apparatus for a stateful application, including:
the application instance creation request acquisition module is used for acquiring an application instance creation request submitted by a user;
the template mapping list extraction module is used for extracting a template mapping list from the application instance creation request, wherein the template mapping list comprises entries of corresponding relation between template names and template definitions, and the number of the template names is at least two;
and the application instance creating module is used for respectively creating the corresponding application instances under different template names by traversing each entry.
In a third aspect, an embodiment of the present invention further provides a computer device, including a processor and a memory, where the memory is used to store instructions, and when the instructions are executed, the processor is caused to perform the following operations:
acquiring an application instance creation request submitted by a user;
extracting a template mapping list from the application instance creating request, wherein the template mapping list comprises entries of corresponding relations between template names and template definitions, and the number of the template names is at least two;
and respectively creating corresponding application instances under different template names by traversing each entry.
In a fourth aspect, an embodiment of the present invention further provides a storage medium, where the storage medium is configured to store instructions for performing:
acquiring an application instance creation request submitted by a user;
extracting a template mapping list from the application instance creating request, wherein the template mapping list comprises entries of corresponding relations between template names and template definitions, and the number of the template names is at least two;
and respectively creating corresponding application instances under different template names by traversing each entry.
According to the technical scheme of the embodiment of the invention, the template mapping list is extracted from the application instance creating request submitted by the user, and the application instances with different configurations corresponding to different template names are created according to the template mapping list, so that the application instances with different configurations can run on different machines in the cluster, and the user experience effect is improved.
Drawings
FIG. 1 is a flowchart of an example creating method for a stateful application according to an embodiment of the present invention;
fig. 2 is a flowchart of an example creating method for a stateful application according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an example creating apparatus for a stateful application according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a computer device according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
The term "application instance creation request" used herein is indication information for creating an application instance submitted by a user, and parameter information such as a template mapping list and a sequence number mapping list may be included in the application instance creation request.
The term "template mapping list" used herein includes entries of corresponding relationships between template names and template definitions, and the number of the template names in the template mapping list is at least two, and configuration information of application instances to be created under each template is set in the template definitions, so that application instances with different configurations corresponding to different template names can be created according to the template mapping list.
The term "sequence number mapping list" is used herein, and the sequence number mapping list stores an assignable sequence number queue corresponding to each template name, that is, a sequence number that can be used by an application instance created under each template name, and for a certain template, when the number of application instances actually running in a cluster is smaller than an expected number defined in a template definition, obtains a sequence number from the assignable sequence number queue corresponding to the template name as a number of the created application instance; and when the number of the application instances actually running in the cluster is larger than the expected number defined in the template definition, deleting the application instance with the largest number actually running, recycling the number corresponding to the reference instance, and storing the number in a sequence number queue capable of being distributed again, so that the number corresponding to the application instance can be reused when capacity expansion is performed next time, the corresponding relation between the application instance and the previous data is maintained according to the unique number reused, and the topological state and the storage state of the previous stateful application are recovered, thereby facilitating normal access to the previously stored data.
The term "actual number of copies" as used herein is the number of application instances in the cluster that are normally running on the machine.
The term "preset number of copies" as used herein means the number of application instances expected to run normally currently contained in the template definition in the template mapping list in an application instance creation request submitted by a user.
For ease of understanding, the main inventive concepts of the embodiments of the present invention are briefly described.
In the prior art, when creating a stateful application instance, a stateful application controller generally uses a fixed template to create all application instances, so that configurations of all application instances are completely the same, and in actual application, due to heterogeneous differences among cluster machines, a running result of the same application instance created by using the same template on different machines may not be ideal, for example, when an application instance is executed on a non-matching machine, a condition that the application instance cannot run may be caused, thereby reducing an experience effect of a user.
The invention provides a template mapping list obtained from an application instance creating request submitted by a user and application instances with different parameter configurations created according to the template mapping list, so that the created application instances with different parameter configurations can run on different machines, and the experience effect of the user is improved.
Based on the thought, the inventor creatively provides that an application instance creation request submitted by a user is obtained; extracting a template mapping list from the application instance creating request, wherein the template mapping list comprises entries of corresponding relations between template names and template definitions, and the number of the template names is at least two; and respectively creating corresponding application instances under different template names by traversing each entry. The method has the advantages that the template mapping list is extracted from the application instance creating request submitted by the user, and the application instances with different configurations corresponding to different template names are created according to the template mapping list, so that the application instances with different configurations can run on different machines in the cluster, and the experience effect of the user is improved.
Example one
Fig. 1 is a flowchart of an example creating method for a stateful application according to an embodiment of the present invention. The embodiment of the present invention may be applied to the case of creating an instance of a stateful application, and the method may be executed by an instance creating apparatus for a stateful application provided in the embodiment of the present invention, where the apparatus may be implemented in a software and/or hardware manner, and may generally be integrated in a computer device.
As shown in fig. 1, the method of the embodiment of the present invention specifically includes:
step 101, acquiring an application instance creation request submitted by a user.
After acquiring an application instance creation request submitted by a user, the method further comprises the following steps: and detecting the application instance creating request, if the format of the application instance creating request is determined to meet the preset requirement according to the detection result, executing the step 102, and otherwise, returning a format error reporting request.
Step 102, extracting a template mapping list from the application instance creation request.
Optionally, the template mapping list includes entries of corresponding relationships between template names and template definitions, and the number of the template names is at least two. The template definition includes: a preset number of copies of the application instance and configuration parameters of the application instance.
The configuration parameters of the application instance include an application instance management policy, that is, the policy is used to indicate that the multiple application instances adopt a sequential creation mode or a parallel creation mode, and resources, such as CPUs or memories, applied by the created application instances. Of course, this embodiment is only an example, and does not limit the specific content of the configuration parameters of the application example.
For example, the template mapping list extracted from the application instance creation request is specifically shown in table 1 below:
TABLE 1
Item(s) Name of template Template definition
1 Form A Number of copies preset3. CPU ratio of 40% and internal memory of 30GB
2 Form B The preset number of copies is 2, the CPU ratio is 30 percent, and the memory is 65GB
3 Form C The preset number of copies is 4, the CPU ratio is 50%, and the memory is 40GB
Optionally, the application instance creation request further includes a sequence number mapping list, where the sequence number mapping list includes a correspondence between the template name and the assignable sequence number queue.
Step 103, respectively creating corresponding application instances under different template names by traversing each entry.
Optionally, the corresponding application instance under each template name is created in the following manner: acquiring the number of preset copies contained in the template definition in the current traversed entry; acquiring the actual number of copies of the application instance running in the current cluster; and creating an application instance corresponding to the template name in the currently traversed entry according to the comparison result of the preset copy number and the actual copy number.
It should be noted that, in this embodiment, when each entry is traversed, a specific traversal order is not required, for example, for the template mapping list in table 1, the traversal order of the template a, the template B, the template C, and the traversal order of the template a of the template B, the template C may also be adopted, so that the traversal order in the template mapping list is not limited in this embodiment, as long as all entries in the template mapping list can be mapped, and any traversal order is within the protection scope of this application.
Optionally, creating an application instance corresponding to the template name in the currently traversed entry according to the comparison result between the preset number of copies and the actual number of copies includes: if the actual copy number is smaller than the preset copy number, creating the application instance corresponding to the template name in the currently traversed entry in an expansion mode; and if the actual number of copies is larger than the preset number of copies, creating the corresponding application instance under the template name in the currently traversed entry by adopting a capacity reduction mode.
Optionally, creating the application instance corresponding to the template name in the currently traversed entry in a capacity expansion manner includes: checking whether the actual copy number is equal to the preset copy number, if so, returning indication information with a normal result, and otherwise, acquiring a distributable sequence number queue from the sequence number mapping list according to the template name; judging whether the assignable sequence number queue is empty or not, if so, obtaining a minimum sequence number which is not used by other template names from the whole situation, and taking the minimum sequence number as the number of the created application example, otherwise, taking the first sequence number in the assignable sequence number queue as the number of the created application example; creating the application instances with the determined numbers according to the configuration parameters of the application instances in the currently traversed entries; and updating the actual copy number of the application instance running in the current cluster under the condition that the creation is determined to be successful.
Optionally, creating an application instance corresponding to the template name in the currently traversed entry in a reduced-capacity manner includes: checking whether the actual copy number is equal to the preset copy number, if so, returning indication information with a normal result, and otherwise, deleting an application instance with the largest number created according to the template name from the actual copy number; the serial number is recycled to a distributable serial number queue corresponding to the template name; and under the condition that the number recovery is determined to be successful, updating the actual copy number of the application instance running in the current cluster.
The embodiment of the invention provides a method for creating an instance of a stateful application, which extracts a template mapping list from an application instance creating request submitted by a user, and creates application instances with different configurations under different template names according to the template mapping list, so that the application instances with different configurations can run on different machines in a cluster, and the experience effect of the user is improved.
Example two
Fig. 2 is a flowchart of an example creating method for a stateful application according to a second embodiment of the present invention. In this embodiment of the present invention, the creating of the application instance corresponding to the different template names by traversing each entry includes: and aiming at the application instance corresponding to each template name, the following method is adopted for creation: acquiring the number of preset copies contained in the template definition in the current traversed entry; acquiring the actual number of copies of the application instance running in the current cluster; and creating an application instance corresponding to the template name in the currently traversed entry according to the comparison result of the preset copy number and the actual copy number.
As shown in fig. 2, the method of the embodiment of the present invention specifically includes:
step 201, acquiring an application instance creation request submitted by a user.
In step 202, a template mapping list is extracted from the application instance creation request.
Step 203, acquiring the number of preset copies included in the template definition in the currently traversed entry.
It should be noted that, in this embodiment, when traversing to a specified entry in the template mapping list, the corresponding template definition under the entry is obtained, and the preset copy number is obtained from the template definition.
In a specific implementation, for the template mapping list in table 1, when it is determined that the current traversal is entry 1, the template definition under entry 1 is obtained, and the preset copy number is obtained from the template definition to be 3. Thus representing that the number of copies of the application instance currently under template a that the user desires to create is 3.
Step 204, collecting the actual copy number of the application instance running in the current cluster.
Specifically, in the present embodiment, since the number of application instances running on each machine in the cluster can be monitored in real time, the actual number of copies of the application instances running in the current cluster can be obtained by collecting monitoring data.
And step 205, creating an application instance corresponding to the template name in the currently traversed entry according to the comparison result of the preset copy number and the actual copy number.
If the actual copy number is determined to be smaller than the preset copy number, creating the application instance corresponding to the template name in the currently traversed entry in an expansion mode; and if the actual number of copies is larger than the preset number of copies, creating the corresponding application instance under the template name in the currently traversed entry by adopting a capacity reduction mode.
Optionally, creating the application instance corresponding to the template name in the currently traversed entry in a capacity expansion manner includes: checking whether the actual copy number is equal to the preset copy number, if so, returning indication information with a normal result, and otherwise, acquiring a distributable sequence number queue from the sequence number mapping list according to the template name; judging whether the assignable sequence number queue is empty, if so, obtaining a minimum sequence number which is not used by other template names from the whole situation, and taking the minimum sequence number as the number of the created application example, otherwise, taking the first sequence number in the assignable sequence number queue as the number of the created application example; creating the application instances with the determined numbers according to the configuration parameters of the application instances in the currently traversed entries; and updating the actual copy number of the application instance running in the current cluster under the condition that the creation is determined to be successful.
It should be noted that, in the sequence number mapping list in this embodiment, an assignable sequence number queue corresponding to each template name is stored, that is, a sequence number that can be used by an application instance created under each template name, and for a certain template, when the number of application instances actually running in a cluster is less than an expected number included in a template definition, a sequence number is obtained from the assignable sequence number queue corresponding to the template name as a number of the created application instance; and when the number of the application instances actually running in the cluster is larger than the expected number contained in the template definition, deleting the application instance with the largest actually running number, recycling the number corresponding to the application instance, and storing the number in the assignable sequence number queue corresponding to the template name again, so that the number corresponding to the application instance can be reused in next capacity expansion, the corresponding relation between the application instance and the previous data is maintained according to the reused unique number, and the topological state and the storage state of the previous stateful application are restored, thereby facilitating normal access to the previously stored data.
For example, the sequence number mapping list stored in the application instance creation request is specifically shown in table 2 below:
TABLE 2
Name of template Assignable sequence number queue
Form A 1 2
Form B 3 4
Form C 5 6
In a specific implementation, when traversing to entry 1 in the template mapping list 1, at this time, the application instance corresponding to the template a needs to be created, and the preset number of copies corresponding to the template a obtained from the template definition is 3, while the actual number of copies of the application instance running in the current cluster obtained by monitoring is 2, and since the actual number of copies is smaller than the preset number of copies, it indicates that the application instance corresponding to the template a in the current entry 1 needs to be created in a capacity expansion manner. Specifically, whether a sequence number queue which can be distributed by the template A is empty is judged, if not, the first sequence number 1 in the sequence number queue [ 12 ] which can be distributed is taken as the number of the created application example, and then the application example with the number of 1 is created according to the configuration parameters 'CPU occupation ratio 40% and memory 30 GB' of the application example in the currently traversed entry 1; and if the assignable sequence number queue is empty, acquiring a minimum sequence number which is not used by other template names from the whole situation, for the embodiment, since 3, 4, 5 and 6 are respectively contained in the assignable sequence number queues of the template a and the template B, at this time, judging the sequence number 7, if the sequence number 7 is determined not to be used by other templates, using the sequence number 7 as the number of the created application instance, and then creating the application instance with the number 7 according to the configuration parameters "CPU occupation ratio 40% and memory 30 GB" of the application instance in the currently traversed entry 1. And updating the actual copy number of the application instance running in the current cluster under the condition that the creation is determined to be successful.
Optionally, creating an application instance corresponding to the template name in the currently traversed entry in a reduced-capacity manner includes: checking whether the actual copy number is equal to the preset copy number, if so, returning indication information with a normal result, and otherwise, deleting an application instance with the largest number created according to the template name from the actual copy number; the serial number is recycled to a distributable serial number queue corresponding to the template name; and under the condition that the number recovery is determined to be successful, updating the actual copy number of the application instance running in the current cluster.
In another specific implementation, when traversing to entry 1 in the template mapping list, at this time, the application instance corresponding to the template a needs to be created, and the preset number of copies corresponding to the template a obtained from the template definition is 3, while the actual number of copies of the application instance running in the current cluster obtained through the monitoring data is 4, and since the actual number of copies is greater than the preset number of copies, it indicates that the application instance corresponding to the template a in the current entry 1 needs to be created in a reduced-capacity manner. Specifically, the method is that the numbers of the currently and actually running application instances are determined to be 1, 2, 7 and 9 respectively, and the numbers of all the application instances created according to the template a are 1, 2, 7 and 9 respectively, at this time, the application instance with the largest number created according to the template a in the actually running application instances, that is, the application instance with the number of 9, is deleted, and the number 9 is recycled to the assignable sequence number queue corresponding to the template a, and in the case that the recycling of the number 9 is determined to be successful, the actual copy number 4 of the application instances running in the current cluster is updated, and since one running application instance is deleted, the actual copy number is updated to be 3. By recycling the number 9, the number 9 corresponding to the application instance can be reused when capacity expansion is needed next time, the corresponding relation between the application instance and the previous data is maintained according to the reused unique number 9, and the topological state and the storage state of the previous stateful application are restored, so that the data stored before can be accessed normally.
The embodiment of the invention provides a method for creating an instance of a stateful application, which is used for creating an application instance corresponding to each template name in the following way: acquiring the number of preset copies contained in the template definition in the current traversed entry; acquiring the actual number of copies of the application instance running in the current cluster; and creating the application example corresponding to the template name in the currently traversed entry according to the comparison result of the preset copy number and the actual copy number, so that the created application example is more accurate.
EXAMPLE III
Fig. 3 is an example creating apparatus for a stateful application according to a third embodiment of the present invention. The apparatus may be implemented in software and/or hardware and may generally be integrated in a computer device. As shown in fig. 3, the apparatus includes: an application instance creation request acquisition module 301, a template mapping list extraction module 302, and an application instance creation module 303.
The application instance creation request obtaining module 301 is configured to obtain an application instance creation request submitted by a user; a template mapping list extracting module 302, configured to extract a template mapping list from the application instance creation request, where the template mapping list includes entries of corresponding relationships between template names and template definitions, and the number of the template names is at least two; an application instance creating module 303, configured to create, by traversing each entry, a corresponding application instance under a different template name.
The embodiment of the invention provides a stateful application instance creating device, which extracts a template mapping list from an application instance creating request submitted by a user, and creates application instances with different configurations under different template names according to the template mapping list, so that the application instances with different configurations can run on different machines in a cluster, and the experience effect of the user is improved.
On the basis of the above embodiments, the instance creating apparatus for a stateful application further includes: and the detection module is used for detecting the format of the application instance creation request and determining that the format of the application instance creation request meets the preset requirement according to the detection result.
On the basis of the above embodiments, the template definition includes: a preset number of copies of the application instance and configuration parameters of the application instance.
On the basis of the above embodiments, the application instance creation request further includes a sequence number mapping list, where the sequence number mapping list includes a correspondence between template names and assignable sequence number queues.
On the basis of the above embodiments, the application instance creating module 303 may include: a preset copy number obtaining unit, configured to obtain a preset copy number included in a template definition in a currently traversed entry; the actual copy number acquisition unit is used for acquiring the actual copy number of the application instance running in the current cluster; and the application instance creating unit is used for creating the application instance corresponding to the template name in the currently traversed entry according to the comparison result of the preset copy number and the actual copy number.
On the basis of the foregoing embodiments, the application instance creating unit may include: the first creating subunit is configured to create, in an expansion manner, an application instance corresponding to the template name in the currently traversed entry if it is determined that the actual number of copies is smaller than the preset number of copies; and the second creating subunit is used for creating the application instance corresponding to the template name in the currently traversed entry in a capacity reduction mode if the actual number of copies is determined to be greater than the preset number of copies.
On the basis of the above embodiments, the first creating subunit includes: the first checking subunit is used for checking whether the actual copy number is equal to the preset copy number, if so, returning indication information with a normal result, and otherwise, acquiring a distributable sequence number queue from the sequence number mapping list according to the template name; the first judging subunit is used for judging whether the assignable sequence number queue is empty, if so, acquiring a minimum sequence number which is not used by other template names from the whole situation, and taking the minimum sequence number as the number of the created application example, otherwise, taking the first sequence number in the assignable sequence number queue as the number of the created application example; the second creating subunit is used for creating the application instances with the determined numbers according to the configuration parameters of the application instances in the currently traversed entry; and the first updating subunit is used for updating the actual copy number of the application instance running in the current cluster under the condition that the creation is determined to be successful.
On the basis of the foregoing embodiments, the second creating subunit includes: the second checking subunit is used for checking whether the actual copy number is equal to the preset copy number, if so, returning indication information with a normal result, and otherwise, deleting an application instance with the largest number created according to the template name from the actual copy number; the number recycling subunit is used for recycling the number to the assignable sequence number queue corresponding to the template name; and the second updating subunit is used for updating the actual copy number of the application instance running in the current cluster under the condition that the serial number recovery is determined to be successful.
The example creating device of the stateful application can execute the example creating method of the stateful application provided by any embodiment of the invention, and has the corresponding functional modules and the beneficial effects of the example creating method of the stateful application.
Example four
Fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present invention. FIG. 4 illustrates a block diagram of an exemplary computer device 412 suitable for use in implementing embodiments of the present invention. The computer device 412 shown in FIG. 4 is only one example and should not impose any limitations on the functionality or scope of use of embodiments of the present invention.
As shown in fig. 4, the computer device 412 is in the form of a general purpose computing device. Components of computer device 412 may include, but are not limited to: one or more processors 412, a memory 428, and a bus 418 that couples the various system components (including the memory 428 and the processor 416).
Bus 418 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Computer device 412 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by computer device 412 and includes both volatile and nonvolatile media, removable and non-removable media.
The memory 428 is used to store instructions. Memory 428 can include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)430 and/or cache memory 432. The computer device 412 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 434 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, commonly referred to as a "hard drive"). Although not shown in FIG. 4, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 418 by one or more data media interfaces. Memory 428 can include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 440 having a set (at least one) of program modules 442 may be stored, for instance, in memory 428, such program modules 442 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. The program modules 442 generally perform the functions and/or methodologies of the described embodiments of the invention.
The computer device 412 may also communicate with one or more external devices 414 (e.g., keyboard, pointing device, display 424, etc.), with one or more devices that enable a user to interact with the computer device 412, and/or with any devices (e.g., network card, modem, etc.) that enable the computer device 412 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 422. Also, computer device 412 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet) through network adapter 420. As shown, network adapter 420 communicates with the other modules of computer device 412 over bus 418. It should be appreciated that although not shown in FIG. 4, other hardware and/or software modules may be used in conjunction with the computer device 412, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processor 416 performs various functional applications and data processing by executing instructions stored in the memory 428, such as performing the following:
acquiring an application instance creation request submitted by a user;
extracting a template mapping list from the application instance creating request, wherein the template mapping list comprises entries of corresponding relations between template names and template definitions, and the number of the template names is at least two;
and respectively creating corresponding application instances under different template names by traversing each entry.
On the basis of the above embodiments, the processor 416 is configured to determine that the format of the application instance creation request meets the preset requirement by: and detecting the format of the application instance creation request, and determining that the format of the application instance creation request meets the preset requirement according to the detection result.
On the basis of the above embodiments, the processor 416 is configured to create the corresponding application instance under each template name in the following manner: acquiring the number of preset copies contained in the template definition in the current traversed entry; acquiring the actual number of copies of the application instance running in the current cluster; and creating an application instance corresponding to the template name in the currently traversed entry according to the comparison result of the preset copy number and the actual copy number.
On the basis of the above embodiments, the processor 416 is configured to create the application instance corresponding to the template name in the currently traversed entry by: if the actual copy number is smaller than the preset copy number, creating the application instance corresponding to the template name in the currently traversed entry in an expansion mode; and if the actual number of copies is larger than the preset number of copies, creating the corresponding application instance under the template name in the currently traversed entry by adopting a capacity reduction mode.
On the basis of the foregoing embodiments, the processor 416 is configured to create the application instance corresponding to the template name in the currently traversed entry in the following capacity expansion manner, including: checking whether the actual copy number is equal to a preset copy number, if so, returning indication information with a normal result, and otherwise, acquiring a distributable sequence number queue from a sequence number mapping list according to the template name; judging whether the assignable sequence number queue is empty, if so, obtaining a minimum sequence number which is not used by other template names from the whole situation, and taking the minimum sequence number as the number of the created application example, otherwise, taking the first sequence number in the assignable sequence number queue as the number of the created application example; creating the application instances with the determined numbers according to the configuration parameters of the application instances in the currently traversed entries; and updating the actual copy number of the application instance running in the current cluster under the condition that the creation is determined to be successful.
On the basis of the foregoing embodiments, the processor 416 is configured to create the application instance corresponding to the template name in the currently traversed entry in a reduced-volume manner, and includes: checking whether the actual copy number is equal to the preset copy number, if so, returning indication information with a normal result, and otherwise, deleting an application instance with the largest number created according to the template name from the actual copy number; the serial number is recycled to a distributable serial number queue corresponding to the template name; and under the condition that the number recovery is determined to be successful, updating the actual copy number of the application instance running in the current cluster.
EXAMPLE five
Fifth embodiment of the present invention provides a storage medium, where the storage medium is configured to store an instruction, and the instruction is configured to execute an instance creation method of a stateful application provided in any embodiment of the present invention.
Namely: acquiring an application instance creation request submitted by a user;
extracting a template mapping list from the application instance creating request, wherein the template mapping list comprises entries of corresponding relations between template names and template definitions, and the number of the template names is at least two;
and respectively creating corresponding application instances under different template names by traversing each entry.
Any combination of one or more computer-readable media may be employed. The computer readable medium may be a computer readable signal or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, or the like, as well as conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (18)

1. A method for instance creation of a stateful application, comprising:
acquiring an application instance creation request submitted by a user;
extracting a template mapping list from the application instance creating request, wherein the template mapping list comprises entries of corresponding relation between template names and template definitions, and the number of the template names is at least two;
and respectively creating corresponding application instances under different template names by traversing each entry.
2. The method of claim 1, wherein prior to extracting the template mapping list from the application instance creation request, further comprising:
and detecting the format of the application instance creation request, and determining that the format of the application instance creation request meets the preset requirement according to the detection result.
3. The method of claim 1, wherein the template definition comprises: a preset number of copies of the application instance and configuration parameters of the application instance.
4. The method according to claim 3, wherein the application instance creation request further comprises a sequence number mapping list, wherein the sequence number mapping list comprises a correspondence between template names and assignable sequence number queues.
5. The method of claim 4, wherein the creating the corresponding application instance under a different template name by traversing each of the entries comprises:
and aiming at the application instance corresponding to each template name, the following method is adopted for creation:
acquiring the number of preset copies contained in the template definition in the current traversed entry;
acquiring the actual number of copies of the application instance running in the current cluster;
and creating an application instance corresponding to the template name in the currently traversed entry according to the comparison result of the preset copy number and the actual copy number.
6. The method according to claim 5, wherein the creating of the application instance corresponding to the template name in the currently traversed entry according to the comparison result between the preset copy number and the actual copy number comprises:
if the actual copy number is determined to be smaller than the preset copy number, creating the corresponding application instance under the template name in the currently traversed entry in an expansion mode;
and if the actual copy number is determined to be larger than the preset copy number, creating the corresponding application instance under the template name in the currently traversed entry in a capacity reduction mode.
7. The method of claim 6, wherein creating the application instance corresponding to the template name in the currently traversed entry in a capacity expansion manner includes:
checking whether the actual copy number is equal to the preset copy number, if so, returning indication information with a normal result, and otherwise, acquiring a distributable sequence number queue from the sequence number mapping list according to the template name;
judging whether the assignable sequence number queue is empty or not, if so, obtaining a minimum sequence number which is not used by other template names from the whole situation, and taking the minimum sequence number as the number of the created application example, otherwise, taking the first sequence number in the assignable sequence number queue as the number of the created application example;
creating the application instances with the determined numbers according to the configuration parameters of the application instances in the currently traversed entries;
and updating the actual copy number of the application instance running in the current cluster under the condition that the creation is determined to be successful.
8. The method according to claim 6, wherein the creating the application instance corresponding to the template name in the currently traversed entry by using a reduced-capacity method includes:
checking whether the actual copy number is equal to the preset copy number, if so, returning indication information with a normal result, and otherwise, deleting an application instance with the maximum number created according to the template name from the actual copy number;
recovering the serial numbers to a distributable serial number queue corresponding to the template names;
and under the condition that the number recovery is determined to be successful, updating the actual copy number of the application instance running in the current cluster.
9. An instance creation apparatus for a stateful application, comprising:
the application instance creation request acquisition module is used for acquiring an application instance creation request submitted by a user;
a template mapping list extraction module, configured to extract a template mapping list from the application instance creation request, where the template mapping list includes entries of corresponding relationships between template names and template definitions, and the number of the template names is at least two;
and the application instance creating module is used for respectively creating the corresponding application instances under different template names by traversing each entry.
10. A computer device comprising a processor and a memory, the memory to store instructions that, when executed, cause the processor to:
acquiring an application instance creation request submitted by a user;
extracting a template mapping list from the application instance creating request, wherein the template mapping list comprises entries of corresponding relation between template names and template definitions, and the number of the template names is at least two;
and respectively creating corresponding application instances under different template names by traversing each entry.
11. The computer device of claim 10, wherein the processor is configured to determine that the format of the application instance creation request meets a preset requirement by:
and detecting the format of the application instance creation request, and determining that the format of the application instance creation request meets the preset requirement according to the detection result.
12. The computer device of claim 10, wherein the template definition comprises: a preset number of copies of the application instance and configuration parameters of the application instance.
13. The computer device according to claim 12, wherein the application instance creation request further includes a sequence number mapping list, and the sequence number mapping list includes a correspondence between template names and assignable sequence number queues.
14. The computer device of claim 13, wherein the processor is configured to create corresponding application instances under different template names by:
and aiming at the application instance corresponding to each template name, the following method is adopted for creation:
acquiring the number of preset copies contained in the template definition in the current traversed entry;
acquiring the actual number of copies of the application instance running in the current cluster;
and creating an application instance corresponding to the template name in the currently traversed entry according to the comparison result of the preset copy number and the actual copy number.
15. The computer device of claim 14, wherein the processor is configured to create the corresponding application instance under the template name in the currently traversed entry by:
if the actual copy number is determined to be smaller than the preset copy number, creating the corresponding application instance under the template name in the currently traversed entry in an expansion mode;
and if the actual copy number is determined to be larger than the preset copy number, creating the corresponding application instance under the template name in the currently traversed entry in a capacity reduction mode.
16. The computer device of claim 15, wherein the processor is configured to create the corresponding application instance under the template name in the currently traversed entry by:
checking whether the actual copy number is equal to the preset copy number, if so, returning indication information with a normal result, and otherwise, acquiring a distributable sequence number queue from the sequence number mapping list according to the template name;
judging whether the assignable sequence number queue is empty or not, if so, obtaining a minimum sequence number which is not used by other template names from the whole situation, and taking the minimum sequence number as the number of the created application example, otherwise, taking the first sequence number in the assignable sequence number queue as the number of the created application example;
creating the application instances with the determined numbers according to the configuration parameters of the application instances in the currently traversed entries;
and updating the actual copy number of the application instance running in the current cluster under the condition that the creation is determined to be successful.
17. The computer device of claim 15, wherein the processor is configured to create the corresponding application instance under the template name in the currently traversed entry by:
checking whether the actual copy number is equal to the preset copy number, if so, returning indication information with a normal result, and otherwise, deleting an application instance with the maximum number created according to the template name from the actual copy number;
recovering the serial numbers to a distributable serial number queue corresponding to the template names;
and under the condition that the number recovery is determined to be successful, updating the actual copy number of the application instance running in the current cluster.
18. A storage medium for storing instructions for performing instance creation of a stateful application according to any of the claims 1-8.
CN201910937225.2A 2019-09-29 2019-09-29 Method, device, equipment and medium for creating instance of stateful application Active CN110647318B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910937225.2A CN110647318B (en) 2019-09-29 2019-09-29 Method, device, equipment and medium for creating instance of stateful application
PCT/CN2020/118690 WO2021058020A1 (en) 2019-09-29 2020-09-29 Instance creation method and apparatus for stateful application, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910937225.2A CN110647318B (en) 2019-09-29 2019-09-29 Method, device, equipment and medium for creating instance of stateful application

Publications (2)

Publication Number Publication Date
CN110647318A true CN110647318A (en) 2020-01-03
CN110647318B CN110647318B (en) 2020-08-04

Family

ID=69012031

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910937225.2A Active CN110647318B (en) 2019-09-29 2019-09-29 Method, device, equipment and medium for creating instance of stateful application

Country Status (2)

Country Link
CN (1) CN110647318B (en)
WO (1) WO2021058020A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021058020A1 (en) * 2019-09-29 2021-04-01 星环信息科技(上海)股份有限公司 Instance creation method and apparatus for stateful application, device and medium
CN112925852A (en) * 2021-03-03 2021-06-08 浪潮云信息技术股份公司 Distributed database designated node capacity reduction method
CN113312083A (en) * 2020-07-14 2021-08-27 阿里巴巴集团控股有限公司 Application generation method, device and equipment
CN116361309A (en) * 2023-05-31 2023-06-30 北京集度科技有限公司 Data query system and method for updating cache data

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104317642A (en) * 2014-09-28 2015-01-28 华为技术有限公司 Method and device for configuring software in cloud calculation environment
US20160366233A1 (en) * 2015-06-10 2016-12-15 Platform9, Inc. Private Cloud as a service
CN108595316A (en) * 2018-04-20 2018-09-28 星环信息科技(上海)有限公司 Life cycle management method, manager, equipment and the medium of Distributed Application
CN109218356A (en) * 2017-06-30 2019-01-15 伊姆西Ip控股有限责任公司 The method and apparatus of stateful application in management server
US20190065323A1 (en) * 2017-08-25 2019-02-28 Vmware, Inc. Containerized application snapshots
CN109634621A (en) * 2018-11-30 2019-04-16 武汉烽火信息集成技术有限公司 Openstack Platform deployment method, storage medium, electronic equipment and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110647318B (en) * 2019-09-29 2020-08-04 星环信息科技(上海)有限公司 Method, device, equipment and medium for creating instance of stateful application

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104317642A (en) * 2014-09-28 2015-01-28 华为技术有限公司 Method and device for configuring software in cloud calculation environment
US20160366233A1 (en) * 2015-06-10 2016-12-15 Platform9, Inc. Private Cloud as a service
CN109218356A (en) * 2017-06-30 2019-01-15 伊姆西Ip控股有限责任公司 The method and apparatus of stateful application in management server
US20190065323A1 (en) * 2017-08-25 2019-02-28 Vmware, Inc. Containerized application snapshots
CN108595316A (en) * 2018-04-20 2018-09-28 星环信息科技(上海)有限公司 Life cycle management method, manager, equipment and the medium of Distributed Application
CN109634621A (en) * 2018-11-30 2019-04-16 武汉烽火信息集成技术有限公司 Openstack Platform deployment method, storage medium, electronic equipment and system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
KUBERNETESCHINA: "征服 K8S 的有状态性:管理有状态应用的实践", 《知乎》 *
MICHAEL YAKOBI: "Managing Stateful Applications in Kubernetes", 《NETAPP》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021058020A1 (en) * 2019-09-29 2021-04-01 星环信息科技(上海)股份有限公司 Instance creation method and apparatus for stateful application, device and medium
CN113312083A (en) * 2020-07-14 2021-08-27 阿里巴巴集团控股有限公司 Application generation method, device and equipment
CN113312083B (en) * 2020-07-14 2024-01-23 阿里巴巴集团控股有限公司 Application generation method, device and equipment
CN112925852A (en) * 2021-03-03 2021-06-08 浪潮云信息技术股份公司 Distributed database designated node capacity reduction method
CN112925852B (en) * 2021-03-03 2022-04-12 浪潮云信息技术股份公司 Distributed database designated node capacity reduction method
CN116361309A (en) * 2023-05-31 2023-06-30 北京集度科技有限公司 Data query system and method for updating cache data
CN116361309B (en) * 2023-05-31 2023-09-05 北京集度科技有限公司 Data query system and method for updating cache data

Also Published As

Publication number Publication date
CN110647318B (en) 2020-08-04
WO2021058020A1 (en) 2021-04-01

Similar Documents

Publication Publication Date Title
CN110647318B (en) Method, device, equipment and medium for creating instance of stateful application
CN111709527A (en) Operation and maintenance knowledge map library establishing method, device, equipment and storage medium
US9354964B2 (en) Tag based selection of test scripts for failure analysis
CN111061740B (en) Data synchronization method, device and storage medium
EP4049130B1 (en) Updating a metadata structure for a firmware update
AU2021244852B2 (en) Offloading statistics collection
US20220179711A1 (en) Method For Platform-Based Scheduling Of Job Flow
CN112052082B (en) Task attribute optimization method, device, server and storage medium
CN111818145B (en) File transmission method, device, system, equipment and storage medium
CN110633046A (en) Storage method and device of distributed system, storage equipment and storage medium
CN112579307A (en) Physical lock resource allocation detection method and device and electronic equipment
CN115631273A (en) Big data duplicate removal method, device, equipment and medium
CN109388651B (en) Data processing method and device
CN104573083A (en) Automatic map cache service updating method
CN112948396A (en) Data storage method and device, electronic equipment and storage medium
CN111737082A (en) Container and monitoring method, device, equipment and medium for container application
CN112328272A (en) Algorithm upgrading method, device, equipment and storage medium
US20230236922A1 (en) Failure Prediction Using Informational Logs and Golden Signals
CN112395141B (en) Data page management method and device, electronic equipment and storage medium
CN114036218A (en) Data model switching method and device, server and storage medium
CN112667614A (en) Data processing method and device and computer equipment
CN112364268A (en) Resource acquisition method and device, electronic equipment and storage medium
CN111159237A (en) System data distribution method and device, storage medium and electronic equipment
CN111400282A (en) Data processing strategy adjusting method, device, equipment and storage medium
US11379147B2 (en) Method, device, and computer program product for managing storage system

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
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: 200233 11-12 / F, building B, 88 Hongcao Road, Xuhui District, Shanghai

Patentee after: Star link information technology (Shanghai) Co.,Ltd.

Address before: 200233 11-12 / F, building B, 88 Hongcao Road, Xuhui District, Shanghai

Patentee before: TRANSWARP TECHNOLOGY (SHANGHAI) Co.,Ltd.