Database application updating method and device, storage medium and electronic equipment

By comparing the target state set image and the running image of the database container, the update strategy is determined to avoid service interruptions caused by rolling updates and improve the update efficiency and service effects of database applications.

CN118567693APending Publication Date: 2024-08-30XIAN TONGXING HENGYAO INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410704521.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

In the existing technology, software application updates usually adopt a rolling update method, which results in interruption of database application services and low update efficiency, and it is impossible to trigger different update strategies for different update contents.

Method used

By obtaining the target image information, the state set image information in the database state set is updated, and based on the comparison results between the target state set image and the running image of the database container, it is decided to rebuild or restart the container deployment unit to avoid indiscriminate reconstruction operations.

Benefits of technology

It implements a shorter and less noticeable container restart processing method under different update content conditions, improving the update efficiency and service effect of database applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567693A
    Figure CN118567693A
Patent Text Reader

Abstract

The invention provides a database application updating method and device, electronic equipment and a storage medium. Wherein the database application is deployed in a service cluster, and a container deployment unit in the service cluster comprises a database container and a side vehicle container; the method comprises the steps of obtaining target mirror image information used for updating a database application, and updating state set mirror image information in a database state set by using the target mirror image information to obtain target state set mirror image information; the target state set mirror image information comprises a target state set mirror image of the database container; determining operation mirror image information of a container deployment unit corresponding to the database state set; the operation mirror image information comprises an operation mirror image of the database container; and according to a comparison result of the target state set mirror image of the database container and the operation mirror image of the database container, performing reconstruction processing or container restarting processing on a container deployment unit corresponding to the database state set. According to the method, different updating strategies can be triggered for different updating contents.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] With the development of computer technology and containerization technology, more and more software applications are deployed on service clusters. For example, database applications can be deployed on service clusters. When a new version of a software application is developed, a corresponding container image can be generated based on the new version, and the container image can be used to update the software application deployed on the service cluster.

[0003] In the related art, the container image in the state set of the software application is usually modified directly. Once the container image in the state set changes, no matter what is updated, the state set will be triggered to automatically start rolling updates. In the rolling update, container deployment units using the old version of the container image will be deleted one by one, and container deployment units using the new version will be created. In the related art, only rolling updates are used as an update method, which often affects the normal service of software applications and has low update efficiency.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0005] The purpose of the present disclosure is to provide a method, device, electronic device and storage medium for updating a database application, which can trigger different update strategies for different update contents.

[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

[0007] According to one aspect of the present disclosure, a method for updating a database application is provided, wherein the database application is deployed in a service cluster, and the container deployment unit in the service cluster includes a database container and a sidecar container; the method for updating the database application includes: obtaining target image information for updating the database application, and using the target image information to update the state set image information in the database state set to obtain the target state set image information; the target state set image information includes the target state set image of the database container; determining the running image information of the container deployment unit corresponding to the database state set; the running image information includes the running image of the database container; and performing reconstruction processing on the container deployment unit corresponding to the database state set or performing container restart processing according to the comparison result of the target state set image of the database container and the running image of the database container.

[0008] In one embodiment of the present disclosure, the target state set image information also includes the target state set image of the sidecar container; wherein, according to the comparison result of the target state set image of the database container and the running image of the database container, the container deployment unit corresponding to the database state set is rebuilt or the container is restarted, including: when the target state set image of the database container and the running image of the database container are different, the container deployment unit corresponding to the database state set is rebuilt; wherein the reconstruction process includes: deleting the container deployment unit, and rebuilding the container deployment unit using the target state set image information; when the target state set image of the database container and the running image of the database container are the same, the container deployment unit corresponding to the database state set is restarted; wherein the container restart process includes: restarting the sidecar container in the container deployment unit using the target state set image information of the sidecar container.

[0009] In one embodiment of the present disclosure, the container deployment unit in the service cluster includes a master container deployment unit and at least one slave container deployment unit; when the target state set image of the database container is different from the running image of the database container, the container deployment unit corresponding to the database state set is rebuilt, including: if the container deployment unit corresponding to the database state set is a slave container deployment unit, the container deployment unit corresponding to the database state set is rebuilt; if the container deployment unit corresponding to the database state set is the master container deployment unit and there is a slave container deployment unit that meets the switching condition, the master-slave switching process is performed on the master container deployment unit and the slave container deployment unit that meets the switching condition; if the container deployment unit corresponding to the database state set is the master container deployment unit and there is no slave container deployment unit that meets the switching condition, the processing of the master container deployment unit is stopped.

[0010] In one embodiment of the present disclosure, the slave library container deployment unit satisfies the switching conditions, including: the running status of the database application instance corresponding to the slave library container deployment unit is normal; and the current running image information of the slave library container deployment unit is consistent with the target state set image information of the database state set corresponding to it.

[0011] In one embodiment of the present disclosure, before rebuilding the container deployment unit or restarting the container, the method for updating the database application further includes: determining that the running status of the database application instance corresponding to the container deployment unit is normal.

[0012] In one embodiment of the present disclosure, target image information for updating a database application is obtained, and state set image information in a database state set is updated using the target image information to obtain the target state set image information, including: obtaining the target image information for updating the database application through an interface; updating resource image information in a custom resource of the database application using the target image information; determining a state set associated with the custom resource of the database application as a database state set; and updating the state set image information in the database state set using the updated resource image information in the custom resource of the database application.

[0013] In one embodiment of the present disclosure, before updating the state set mirroring information in the database state set, the method for updating the database application further includes: disabling the rolling update strategy of the database state set.

[0014] According to another aspect of the present disclosure, there is provided an updating device for a database application, wherein the database application is deployed in a service cluster, and the container deployment unit in the service cluster includes a database container and a sidecar container; the updating device for the database application includes: an image obtaining module, used to obtain target image information for updating the database application, and use the target image information to update the state set image information in the database state set to obtain the target state set image information; the target state set image information includes the target state set image of the database container; a running image determining module, used to determine the running image information of the container deployment unit corresponding to the database state set; the running image information includes the running image of the database container; an updating module, used to rebuild the container deployment unit corresponding to the database state set or restart the container according to the comparison result of the target state set image of the database container and the running image of the database container.

[0015] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned method for updating a database application is implemented.

[0016] According to another aspect of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the above-mentioned database application update method by executing the executable instructions.

[0017] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the above-mentioned method for updating a database application is implemented.

[0018] The update method of the database application provided by the embodiment of the present disclosure can use the obtained target image information to update the state set image information in the database state set, determine the target state set image of the database container in the state set image information, and then determine whether the running image of the database container in the Pod corresponding to the database state set is consistent with the target state set image of the database container, obtain a comparison result, and then determine whether to perform a complete reconstruction process on the Pod or a container restart process on the container in the Pod based on the comparison result. It can be seen that this scheme can trigger different update strategies for different update contents, so that when the update content meets certain conditions, a container restart process that is less time-consuming and less noticeable can be used to implement the update of the database application, thereby improving the update efficiency and the service effect of the database application as a whole.

[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0021] Figure 1 A schematic diagram showing an exemplary system architecture to which the database application update method according to the embodiment of the present disclosure can be applied;

[0022] Figure 2 A flowchart showing a method for updating a database application according to an embodiment of the present disclosure is shown;

[0023] Figure 3 A flowchart of updating state set mirror information in a database state set in a method for updating a database application according to an embodiment of the present disclosure is shown;

[0024] Figure 4 A flowchart showing a method for updating a database application according to another embodiment of the present disclosure is shown;

[0025] Figure 5 A flowchart showing reconstruction of a container deployment unit in a database application update method according to an embodiment of the present disclosure is shown;

[0026] Figure 6 A block diagram showing an updating device for a database application according to an embodiment of the present disclosure; and

[0027] Figure 7A structural block diagram of a computer device for updating a database application in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0028] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0029] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0030] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present disclosure, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0031] Figure 1 A schematic diagram showing an exemplary system architecture to which a database application update method according to an embodiment of the present disclosure can be applied.

[0032] like Figure 1 As shown, the system architecture may include a server 101, a network 102, and a client 103. The network 102 is used to provide a medium for a communication link between the client 103 and the server 101. The network 102 may include various connection types, such as wired, wireless communication links, or optical fiber cables.

[0033] In an exemplary embodiment, the client 103 for data transmission with the server 101 may include, but is not limited to, electronic devices of types such as smart phones, desktop computers, tablet computers, laptop computers, smart speakers, digital assistants, AR (Augmented Reality) devices, VR (Virtual Reality) devices, and smart wearable devices. Optionally, the operating system running on the electronic device may include, but is not limited to, Android system, IOS system, Linux system, Windows system, and the like.

[0034] Server 101 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. In some practical applications, server 101 can also be a server of a network platform, which can be, for example, a trading platform, a live broadcast platform, a social platform, or a music platform, etc., which is not limited in the embodiments of the present disclosure. Among them, the server can be a single server or a cluster formed by multiple servers, and the present disclosure does not limit the specific architecture of the server.

[0035] In an exemplary embodiment, the user can transmit target image information for updating the database application to the interface provided by the service cluster through the client 103, so that the server 101 uses the target image information obtained from the interface to update the database application deployed in the service cluster.

[0036] In an exemplary embodiment, the process of the server 101 for implementing the update method of the database application may be: the server 101 obtains the target image information for updating the database application, and uses the target image information to update the state set image information in the database state set to obtain the target state set image information; the target state set image information includes the target state set image of the database container; the server 101 determines the running image information of the container deployment unit corresponding to the database state set; the running image information includes the running image of the database container; the server 101 rebuilds the container deployment unit corresponding to the database state set or restarts the container according to the comparison result of the target state set image of the database container and the running image of the database container.

[0037] In addition, it should be noted that Figure 1 The illustrated example is merely an application environment of the database application update method provided by the present disclosure. Figure 1The numbers of servers 101, networks 102 and clients 103 are merely illustrative, and any number of clients, networks and servers may be provided according to actual needs.

[0038] In order to enable ordinary persons in the art to better understand the technical solution of the present disclosure, each step of the method for updating a database application in an exemplary embodiment of the present disclosure will be described in more detail below with reference to the accompanying drawings and embodiments.

[0039] Figure 2 The flowchart of the method for updating a database application according to an embodiment of the present disclosure is shown. The database application is deployed in a service cluster, and the container deployment unit in the service cluster includes a database container and a sidecar container. The method provided by the embodiment of the present disclosure can be performed as follows: Figure 1 The server 101 or the client 103 shown is executed, but the present disclosure is not limited to this.

[0040] In the following examples, the server 101 is used as the execution subject for illustration.

[0041] like Figure 2 As shown, the database application update method provided by the embodiment of the present disclosure may include the following steps.

[0042] Step S201, obtaining target image information for updating a database application, and using the target image information to update state set image information in a database state set to obtain target state set image information; the target state set image information includes a target state set image of a database container.

[0043] The database application may be, for example, MySQL (a relational database management system), and the target image information may be a new version of an image developed for the database application. The new version of the image may involve updates to one or more functions, such as updates to the database read and write function, the backup function in the database application, the scheduled task function, etc.

[0044] The database state set can be a state set that creates a container deployment unit (Pod) of a database application in the state set (statefulset) currently existing in the service cluster management system (such as k8s). Among them, the database application of the service cluster is a master-slave architecture, and the database application deployed in the service cluster can correspond to multiple database state sets. One database state set in multiple database state sets can create a master library Pod, and the remaining one or more database state sets create slave library Pods. In this step, the state set image information in the database state set is updated using the target image information, which can refer to updating all database state sets so that the state set image information in all database state sets is synchronized to be consistent with the target image information. The target state set image information obtained after the update can be regarded as the container image used by the container in the expected Pod. The target state set image of the database container is the container image used by the database container in the expected Pod. The database container is a container that carries the core service functions / main service functions of the database.

[0045] Step S203, determining the running image information of the container deployment unit corresponding to the database state set; the running image information includes the running image of the database container.

[0046] In this step, each database state set corresponds to a container deployment unit (Pod) created by it. The container deployment unit corresponding to the database state set can be a master library Pod or a slave library Pod. Each Pod has a running image information, which includes the container image currently used by each container in the Pod. The running image of the database container is the container image currently used by each container in the Pod.

[0047] Step S205 , based on the comparison result between the target state set image of the database container and the running image of the database container, the container deployment unit corresponding to the database state set is rebuilt or the container is restarted to update the database application.

[0048] Among them, there may be consistent or inconsistent comparison results between the target state set image of the database container and the running image of the database container, which affects the processing method of the Pod. The reconstruction processing in the processing method involves deleting the Pod, which takes a long time and may affect the service effect of the database application for users; the container restart processing in the processing method does not need to delete the entire Pod, but only restarts individual containers, which takes a short time and does not affect the service effect of the database application for users. It can be seen that in the update method of the database application provided by the present disclosure, the database application can be updated according to the situation to avoid indiscriminate reconstruction of the Pod every time the update is updated, which may affect the service effect of the database application.

[0049] Through the update method of the database application provided by the present disclosure, the state set image information in the database state set can be updated using the obtained target image information, the target state set image of the database container in the state set image information can be determined, and then it is determined whether the running image of the database container in the Pod corresponding to the database state set is consistent with the target state set image of the database container, and a comparison result is obtained. Then, according to the comparison result, it is determined whether to perform a complete reconstruction process on the Pod or a container restart process on the container in the Pod. It can be seen that this scheme can trigger different update strategies for different update contents, so that when the update content meets certain conditions, a container restart process that is less time-consuming and less noticeable can be used to implement the update of the database application, thereby improving the update efficiency and the service effect of the database application as a whole.

[0050] Figure 3 A flowchart of updating state set mirror information in a database state set in a method for updating a database application according to an embodiment of the present disclosure is shown. Figure 3 As shown, in some embodiments, obtaining target image information for updating a database application, using the target image information to update the state set image information in the database state set, and obtaining the target state set image information may include the following steps.

[0051] Step S301, obtaining target image information for updating a database application through an interface.

[0052] The interface may be an exposed upgrade interface set by a developer, and a corresponding image of a corresponding container may be passed to the upgrade interface.

[0053] Step S303: Use the target image information to update the resource image information in the custom resource of the database application.

[0054] After the upgrade interface is passed the new version of the image information, it can automatically trigger the update of the custom resources of the database application. The custom resources of the database application can be MySQL CR (MySQL Custom Resource). CR (Custom Resource) means "custom resource", which allows users to define their own resource types in Kubernetes. In this solution, the image information corresponding to each container can be defined in CR. After step S303 is executed, it means that in CR, there is a situation where the image version of the container is inconsistent with the image version of the container actually running.

[0055] Step S305: determine the state set associated with the custom resource of the database application as the database state set.

[0056] The state set associated with the custom resource of the database application can be considered as a state set that belongs to the database application in terms of relationship. Such a state set needs to be updated in response to the update of the custom resource (MySQL CR) of the database application.

[0057] Step S307: Use the updated resource mirror information in the custom resource of the database application to update the state set mirror information in the database state set.

[0058] After the custom resources of the database application are updated, they can be discovered and managed by the database service controller (such as MySQLController) based on a monitoring mechanism (such as the k8s watch mechanism). The database service controller can then update the database state set based on the modification of the custom resources (MySQL CR) of the database application, and specifically update the state set mirror information in the database state set.

[0059] In addition, after the database state set is modified, it means that the database state set has also changed. This change will be discovered and managed by the state set controller of the database application (such as MySQL StatefulSet Controller), so the state set controller of the database application can trigger the execution of subsequent operations, such as step S203, step S205, etc.

[0060] In some embodiments, based on the comparison result between the target state set image of the database container and the running image of the database container, the container deployment unit corresponding to the database state set is rebuilt or the container is restarted, which may include the following two cases.

[0061] The first case: when the target state set image of the database container is different from the running image of the database container, the container deployment unit corresponding to the database state set is rebuilt; wherein the reconstruction process includes: deleting the container deployment unit, and rebuilding the container deployment unit using the target state set image information;

[0062] The target state set image of the database container is different from the running image of the database container, which means that the image version of the database container has been updated. Since the database container is the container that carries the core service functions / main service functions of the database, if the image version of the database container is updated, the entire Pod needs to be recreated to meet the functional upgrade of the core service functions / main service functions of the database. At this time, the container deployment unit can be deleted and rebuilt using the target state set image information.

[0063] The target state set image information may also include the target state set image of the sidecar container, which is a container for providing auxiliary services or supporting functions. In some practical applications, the sidecar container may include updated and unupdated situations. Through this solution, since the Pod reconstruction operation is performed, the method of "rebuilding the container deployment unit using the target state set image information" can deal with both updated and unupdated sidecar containers.

[0064] The second situation: when the target state set image of the database container and the running image of the database container are the same, the container deployment unit corresponding to the database state set is restarted; wherein the container restart process includes: restarting the sidecar container in the container deployment unit using the target state set image information of the sidecar container in the target state set image information.

[0065] If the target state set image of the database container is the same as the running image of the database container, and since the target state set image information is known to have changed, it can be determined that the auxiliary functions / support functions of the database application have been updated. In this case, there is no need to rebuild the entire Pod. Instead, only the sidecar container in the Pod can be restarted to meet the update and upgrade of the database application.

[0066] In some embodiments, before updating the state set mirroring information in the database state set, the method for updating the database application further includes: disabling a rolling update strategy of the database state set.

[0067] Usually, the update of the database state set will trigger the rolling update strategy (rollingupdate) by default, which will cause the PODs in the service cluster to automatically update in a way that "deletes the old MySQL POD and creates a new MySQL POD". This method will delete and rebuild the Pods indiscriminately, which may easily cause the MySQL service to be unavailable during this period. Disabling the rolling update strategy before updating the state set mirror information in the database state set can help avoid unnecessary automatic updates during the update process.

[0068] Furthermore, the update method of the database application may further include: adjusting the update strategy of the database state set to OnDelete (a strategy of deletion triggering update).

[0069] OnDelete is an existing update strategy of statefulset. OnDelete means no automatic upgrade. A new Pod will be generated only when the Pod is deleted. Using OnDelete means that k8s does not need to automatically trigger rolling upgrades, thus avoiding the impact on database services. By adjusting the update strategy of the database statefulset to OnDelete, you can use the processing strategy that comes with k8s without developing additional processing methods, thereby saving development resources.

[0070] Furthermore, in some practical applications, after deleting the Pod, the reconstruction of the Pod in the service set can be automatically triggered based on the OnDelete policy, which may specifically include the following reconstruction process.

[0071] The initialization container temporarily starts the MySQL service and uses the new MySQL version (that is, uses the target state set image information). The initialization container executes the upgrade command (such as mysql_upgrade --default-character-set=utf8-uroot-pxxx) to upgrade the system table. After the upgrade of the system table is completed, the initialization container can exit. Finally, another MySQL container (that is, the database container) and Sidecar container (that is, the sidecar container) are started separately.

[0072] Figure 4 FIG. 2 is a flowchart showing a method for updating a database application according to another embodiment of the present disclosure. Figure 4 As shown, the database application update method provided by the embodiment of the present disclosure may include the following steps.

[0073] Step S401, obtaining target image information for updating a database application through an interface.

[0074] Step S403: Use the target image information to update the resource image information in the custom resource of the database application.

[0075] Step S405 , determining the state set associated with the custom resource of the database application as the database state set, and using the updated resource mirror information in the custom resource of the database application to update the state set mirror information in the database state set to obtain the target state set mirror information.

[0076] Step S407, obtaining the running image information of the container deployment unit corresponding to the database state set, and determining the target state set image of the database container included in the target state set image information, and determining the running image of the database container included in the running image information.

[0077] Step S409, determine whether the target state set image of the database container is consistent with the running image of the database container. If not, execute step S411; if yes, execute step S413.

[0078] Step S411, rebuilding the container deployment unit corresponding to the database state set; wherein the rebuilding process includes: deleting the container deployment unit, and rebuilding the container deployment unit using the target state set mirror information.

[0079] Step S413, obtain the target state set image of the sidecar container contained in the target state set image information; perform container restart processing on the container deployment unit corresponding to the database state set; wherein the container restart processing includes: using the target state set image information of the sidecar container to restart the sidecar container in the container deployment unit.

[0080] Figure 4 For other contents of the embodiment, reference can be made to the other embodiments mentioned above.

[0081] In some embodiments, before performing reconstruction processing on the container deployment unit or performing container restart processing, the database application update method further includes: determining that the running status of the database application instance corresponding to the container deployment unit is normal.

[0082] Among them, the database state set (statefulset) can be used to determine whether the running status of the database application instance corresponding to the container deployment unit is normal. The database state set can have a container running status flag. When the containers in the Pod corresponding to the database state set are running normally, the container running status flag will be ready to indicate that the resources are normal; otherwise, the container running status flag can be not ready to indicate that the resources are abnormal. If the running status of the database application instance corresponding to the container deployment unit is abnormal, such as the container running status flag is notready, the processing is suspended.

[0083] In some embodiments, the container deployment unit in the service cluster may include a master library container deployment unit and at least one slave library container deployment unit; when the target state set image of the database container and the running image of the database container are different, the container deployment unit corresponding to the database state set is rebuilt, which may include the following three situations.

[0084] Case 1: If the container deployment unit corresponding to the database state set is a slave container deployment unit, the container deployment unit corresponding to the database state set is rebuilt.

[0085] In some practical applications, the slave Pods can be rebuilt sequentially, or a parallel strategy can be set based on the hardware environment configuration conditions of the service cluster so that a maximum of a preset number of slave Pods are rebuilt simultaneously, thereby improving the efficiency of updates and upgrades while ensuring load balancing. The reconstruction of the slave Pod does not affect the service provided by the master Pod, so the database application can be guaranteed to provide services normally as a whole.

[0086] Case 2: If the container deployment unit corresponding to the database state set is a master container deployment unit, and there is a slave container deployment unit that meets the switching conditions, the master container deployment unit and the slave container deployment unit that meets the switching conditions are switched between master and slave.

[0087] In some embodiments, the slave library container deployment unit satisfies the switching conditions, including: the running status of the database application instance corresponding to the slave library container deployment unit is normal; and the current running image information of the slave library container deployment unit is consistent with the target state set image information of the database state set corresponding to it.

[0088] The slave Pod that meets the switching conditions can be regarded as a Pod that has completed the version update. After the master-slave switching process, the original slave Pod becomes the new master Pod and has completed the update; the original master Pod becomes the new slave Pod, then you only need to follow the processing method in situation one to update the new slave Pod (that is, the original master Pod). Specifically, after the master-slave switching process, you can delete the new slave Pod (that is, the original master Pod) and use the target state set mirror information to rebuild the new slave Pod.

[0089] In this case, if there is a slave container deployment unit that meets the switching conditions, it means that at least one slave Pod has been rebuilt. At this time, master-slave switching can ensure service continuity on the one hand, and on the other hand, all Pods can be rebuilt and updated simply by setting a strategy for processing slave Pods.

[0090] Case 3: If the container deployment unit corresponding to the database state set is the master container deployment unit, and there is no slave container deployment unit that meets the switching conditions, then stop processing the master container deployment unit. After that, you can process the slave container deployment unit so that after there is a slave container deployment unit that meets the switching conditions, continue processing the master container deployment unit.

[0091] By continuously tuning in the above embodiment, all Pods can be rebuilt so that the images running in all Pods are consistent with the target image information.

[0092] Figure 5FIG. 1 is a flowchart of rebuilding a container deployment unit in a database application update method according to an embodiment of the present disclosure. Figure 5 As shown, the process of rebuilding the container deployment unit may include the following steps.

[0093] Step S501, when the target state set image of the database container and the running image of the database container are different, determine the target Pod corresponding to the current database state set.

[0094] Step S503, determine whether the target Pod is a slave Pod. If yes, execute step S505; if no, execute step S507.

[0095] Step S505: Delete the target Pod, and rebuild the target Pod using the target state set mirror information of the current database state set.

[0096] Step S507, determine whether there is a candidate slave library Pod that meets the switching condition. If yes, execute step S509; if no, execute step S511.

[0097] Step S509: Perform master-slave switching processing on the target Pod and the candidate slave Pod, so that the target Pod becomes the new slave Pod.

[0098] Step S511, stop processing the target Pod.

[0099] Step S513: Delete the new slave Pod, and rebuild the new slave Pod using the target state set mirror information of the current database state set.

[0100] Figure 5 For other contents of the embodiment, reference can be made to the other embodiments mentioned above.

[0101] In addition, the database application update method provided in the embodiment of the present disclosure is intended to update the database application deployed in the service cluster. Although the description mainly focuses on the update of the database container and the sidecar container, the method can also be extended to other types of containers and services.

[0102] It should be noted that the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0103] Figure 6A block diagram of an updating device 600 for a database application according to an embodiment of the present disclosure is shown; the database application is deployed in a service cluster, and the container deployment unit in the service cluster includes a database container and a sidecar container; Figure 6 As shown, the updating device for database application includes: an image obtaining module 601, which is used to obtain target image information for updating the database application, and use the target image information to update the state set image information in the database state set to obtain the target state set image information; the target state set image information includes the target state set image of the database container; a running image determining module 602, which is used to determine the running image information of the container deployment unit corresponding to the database state set; the running image information includes the running image of the database container; an updating module 603, which is used to rebuild the container deployment unit corresponding to the database state set or restart the container according to the comparison result of the target state set image of the database container and the running image of the database container.

[0104] Through the update device of the database application provided by the present disclosure, the state set image information in the database state set can be updated using the obtained target image information, the target state set image of the database container in the state set image information can be determined, and then it is determined whether the running image of the database container in the Pod corresponding to the database state set is consistent with the target state set image of the database container, and a comparison result is obtained, and then it is determined whether to perform a complete reconstruction process on the Pod or a container restart process on the container in the Pod based on the comparison result. It can be seen that this scheme can trigger different update strategies for different update contents, so that when the update content meets certain conditions, a container restart process that is less time-consuming and less noticeable can be used to implement the update of the database application, thereby improving the update efficiency and the service effect of the database application as a whole.

[0105] In some embodiments, the target state set image information also includes the target state set image of the sidecar container; wherein, the update module 603 rebuilds or restarts the container deployment unit corresponding to the database state set according to the comparison result of the target state set image of the database container and the running image of the database container, including: when the target state set image of the database container and the running image of the database container are different, rebuilding the container deployment unit corresponding to the database state set; wherein the reconstruction processing includes: deleting the container deployment unit, and rebuilding the container deployment unit using the target state set image information; when the target state set image of the database container and the running image of the database container are the same, restarting the container deployment unit corresponding to the database state set; wherein the container restart processing includes: restarting the sidecar container in the container deployment unit using the target state set image information of the sidecar container.

[0106] In some embodiments, the container deployment units in the service cluster include a master container deployment unit and at least one slave container deployment unit; when the target state set image of the database container is different from the running image of the database container, the update module 603 performs reconstruction processing on the container deployment unit corresponding to the database state set, including: if the container deployment unit corresponding to the database state set is a slave container deployment unit, then the container deployment unit corresponding to the database state set is reconstructed; if the container deployment unit corresponding to the database state set is a master container deployment unit, and there is a slave container deployment unit that meets the switching condition, then the master container deployment unit and the slave container deployment unit that meets the switching condition are master-slave switching processing; if the container deployment unit corresponding to the database state set is a master container deployment unit, and there is no slave container deployment unit that meets the switching condition, then the processing of the master container deployment unit is stopped.

[0107] In some embodiments, the slave library container deployment unit satisfies the switching conditions, including: the running status of the database application instance corresponding to the slave library container deployment unit is normal; and the current running image information of the slave library container deployment unit is consistent with the target state set image information of the database state set corresponding to it.

[0108] In some embodiments, before the update module 603 performs a reconstruction process on the container deployment unit or a container restart process, the update module 603 is further used to: determine whether the running status of the database application instance corresponding to the container deployment unit is normal.

[0109] In some embodiments, the image acquisition module 601 obtains target image information for updating a database application, uses the target image information to update the state set image information in the database state set, and obtains the target state set image information, including: obtaining the target image information for updating the database application through an interface; using the target image information to update the resource image information in the custom resources of the database application; determining the state set associated with the custom resources of the database application as the database state set; and using the updated resource image information in the custom resources of the database application to update the state set image information in the database state set.

[0110] In some embodiments, the updating device for database application further includes an update policy control module 604. Before the update module 603 updates the state set mirror information in the database state set, the update policy control module 604 is used to disable the rolling update policy of the database state set.

[0111] Figure 6 For other contents of the embodiment, reference can be made to the other embodiments mentioned above.

[0112] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".

[0113] Figure 7 The structural block diagram of a computer device for updating a database application in an embodiment of the present disclosure is shown. It should be noted that the electronic device shown in the figure is only an example and should not bring any limitation to the function and scope of use of the embodiment of the present invention.

[0114] Refer to the following Figure 7 An electronic device 700 according to this embodiment of the present invention will be described. Figure 7 The electronic device 700 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0115] like Figure 7 As shown, the electronic device 700 is in the form of a general computing device. The components of the electronic device 700 may include but are not limited to: at least one processing unit 710, at least one storage unit 720, and a bus 730 connecting different system components (including the storage unit 720 and the processing unit 710).

[0116] The storage unit stores program codes, which can be executed by the processing unit 710, so that the processing unit 710 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 710 can perform the following steps: Figure 2 The method shown in .

[0117] The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 7201 and / or a cache storage unit 7202 , and may further include a read-only storage unit (ROM) 7203 .

[0118] The storage unit 720 may also include a program / utility 7204 having a set (at least one) of program modules 7205, such program modules 7205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0119] Bus 730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0120] The electronic device 700 may also communicate with one or more external devices 800 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 700, and / or communicate with any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 750. Furthermore, the electronic device 700 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 760. As shown, the network adapter 760 communicates with other modules of the electronic device 700 via a bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0121] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.

[0122] The program product for implementing the above method according to the embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.

[0123] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0124] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0125] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0126] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0127] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0128] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.

[0129] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0130] According to one aspect of the present disclosure, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in various optional implementations of the above-mentioned embodiments.

[0131] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.

Claims

1. A method for updating a database application, characterized in that: The database application is deployed in a service cluster, and the container deployment unit in the service cluster includes a database container and a sidecar container; the method includes: Obtaining target image information for updating a database application, and using the target image information to update state set image information in a database state set to obtain target state set image information; the target state set image information includes a target state set image of a database container; Determine the running image information of the container deployment unit corresponding to the database state set; the running image information includes the running image of the database container; According to the comparison result between the target state set image of the database container and the running image of the database container, a reconstruction process is performed on the container deployment unit corresponding to the database state set or a container restart process is performed.

2. The method according to claim 1, characterized in that The target state set image information also includes the target state set image of the sidecar container; According to the comparison result between the target state set image of the database container and the running image of the database container, the container deployment unit corresponding to the database state set is rebuilt or the container is restarted, including: When the target state set image of the database container is different from the running image of the database container, a container deployment unit corresponding to the database state set is rebuilt; wherein the rebuilding process includes: deleting the container deployment unit and rebuilding the container deployment unit using the target state set image information; When the target state set image of the database container is the same as the running image of the database container, a container restart process is performed on the container deployment unit corresponding to the database state set; wherein the container restart process includes: restarting the sidecar container in the container deployment unit using the target state set image information of the sidecar container.

3. The method according to claim 2, characterized in that The container deployment unit in the service cluster includes a master library container deployment unit and at least one slave library container deployment unit; When the target state set image of the database container is different from the running image of the database container, the container deployment unit corresponding to the database state set is rebuilt, including: If the container deployment unit corresponding to the database state set is a slave container deployment unit, then the container deployment unit corresponding to the database state set is rebuilt; If the container deployment unit corresponding to the database state set is a master container deployment unit, and there is a slave container deployment unit that meets the switching condition, then perform master-slave switching processing on the master container deployment unit and the slave container deployment unit that meets the switching condition; If the container deployment unit corresponding to the database state set is a master container deployment unit and there is no slave container deployment unit that meets the switching condition, the processing of the master container deployment unit is stopped.

4. The method according to claim 3, characterized in that The deployment unit from the library container meets the switching conditions, including: The running status of the database application instance corresponding to the slave container deployment unit is normal; and The current running image information of the slave container deployment unit is consistent with the target state set image information of the corresponding database state set.

5. The method according to claim 1, characterized in that Before rebuilding the container deployment unit or restarting the container, the method further includes: It is determined that the running status of the database application instance corresponding to the container deployment unit is normal.

6. The method according to claim 1, characterized in that Obtaining target image information for updating a database application, and using the target image information to update the state set image information in the database state set to obtain the target state set image information, including: Obtain target image information for updating database application through an interface; Using the target image information to update the resource image information in the custom resource of the database application; Determine a state set associated with the custom resource of the database application as a database state set; The state set mirror information in the database state set is updated using the updated resource mirror information in the custom resource of the database application.

7. The method according to claim 1, characterized in that Before updating the state set mirror information in the database state set, the method further includes: Disable the rolling update strategy for the database state set.

8. A database application updating device, characterized in that: The database application is deployed in a service cluster, and the container deployment unit in the service cluster includes a database container and a sidecar container; the device includes: An image acquisition module is used to obtain target image information for updating a database application, and use the target image information to update the state set image information in the database state set to obtain the target state set image information; the target state set image information includes the target state set image of the database container; A running image determination module, used to determine the running image information of the container deployment unit corresponding to the database state set; the running image information includes the running image of the database container; An update module is used to rebuild or restart the container deployment unit corresponding to the database state set according to a comparison result between the target state set image of the database container and the running image of the database container.

9. A computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method for updating a database application according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the database application update method as described in any one of claims 1 to 7.