Business service establishment method and apparatus, computer device, and storage medium
By obtaining service requirements information and preset instance templates, building business service instances, components and container groups, the problem of low efficiency in business service establishment in traditional technology is solved, and rapid and general business service deployment is achieved, and cloud-native containerization is supported.
Patent Information
- Application Number
- PCT/CN2023/130004
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-06-15
- Filing Date
- 2023-11-06
- Publication Date
- 2024-12-19
AI Technical Summary
In traditional technology, the deployment and establishment of business services on servers requires deployment from scratch, and cannot be generalized, resulting in low efficiency in establishing business services.
By obtaining service requirements information and preset instance templates, creating service instances, components and container groups, and building service models, we can achieve fast and general business service establishment.
It improves the efficiency and universality of business service establishment, simplifies the deployment process of business services, and supports cloud-native containerization implementation.
Smart Images

Figure CN2023130004_19122024_PF_FP_ABST
Abstract
Description
Business service establishment method, device, computer equipment and storage medium
[0001] Related applications
[0002] This application claims priority to Chinese patent application number 2023107133874, filed on June 15, 2023, entitled “Business service establishment method, device, computer equipment and storage medium,” the entire text of which is hereby incorporated by reference. Technical Field
[0003] The present application relates to computer technology, and in particular to a method, apparatus, computer equipment, storage medium, and computer program product for establishing a business service. Background Art
[0004] With the development of computer technology, various business services have emerged. A business service is a software service that implements a certain business, such as database services, middleware services, etc.
[0005] In traditional technologies, deploying and establishing any business service on a server usually requires developers to deploy it from scratch, which makes it impossible to establish a universal business service and leads to low efficiency in establishing business services.
[0006] Summary of the Invention
[0007] Embodiments of the present application provide a business service establishment method, apparatus, computer equipment, computer-readable storage medium, and computer program product.
[0008] This application provides a method for establishing a business service. The method includes:
[0009] Obtaining service demand information for a target business service, and obtaining an instance template preset for the target business service as a target instance template;
[0010] Creating a service instance corresponding to the target business service based on the service requirement information and the target instance template;
[0011] Creating a service component based on component declaration information included in the service instance to obtain each service component corresponding to the target business service; the component declaration information is used to instruct the creation of service components that match each component type specified by the target instance template;
[0012] Creating a container group set corresponding to the service component based on the container group declaration information included in the service component, and obtaining a container group set corresponding to each of the service components; the container group declaration information included in the service component is obtained from the service instance;
[0013] Based on the service instance, the various service components, and the container group sets corresponding to the various service components, a service model corresponding to the target business service is obtained; the service model is used to provide the target business service to the demander corresponding to the service demand information.
[0014] This application also provides a business service establishment device. The device includes:
[0015] A data acquisition module is used to acquire service demand information for a target business service and acquire an instance template preset for the target business service as a target instance template;
[0016] An instance creation module, configured to create a service instance corresponding to the target business service based on the service requirement information and the target instance template;
[0017] A component creation module, configured to create a service component based on component declaration information included in the service instance, and obtain each service component corresponding to the target business service; the component declaration information is used to instruct the creation of service components that match each component type specified in the target instance template;
[0018] a container creation module, configured to create a container group set corresponding to the service component based on the container group declaration information contained in the service component, and obtain a container group set corresponding to each of the service components; the container group declaration information contained in the service component is obtained from the service instance;
[0019] The model determination module is used to obtain the service model corresponding to the target business service based on the service instance, the various service components, and the container group set corresponding to each service component; the service model is used to provide the target business service to the demander corresponding to the service demand information.
[0020] A computer device includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the above-mentioned business service establishment method when executing the computer-readable instructions.
[0021] A computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the above-mentioned business service establishment method.
[0022] A computer program product includes computer-readable instructions, which, when executed by a processor, implement the steps of the business service establishment method.
[0023] The details of one or more embodiments of the present application are set forth in the accompanying drawings and the description below. Other features, objects, and advantages of the present application will become apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the conventional technology, the following briefly introduces the drawings required for use in the embodiments or the conventional technology descriptions. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the disclosed drawings without any creative work.
[0025] FIG1 is an application environment diagram of a business service establishment method according to an embodiment;
[0026] FIG2 is a flow chart of a method for establishing a business service in one embodiment;
[0027] FIG3 is a schematic diagram of a service model in one embodiment;
[0028] FIG4 is a schematic diagram of a process for generating a configuration file corresponding to a container group in one embodiment;
[0029] FIG5 is a schematic diagram of a container group configuration component generating a configuration file corresponding to a container group in one embodiment;
[0030] FIG6 is a schematic diagram of initializing the storage specifications of a container group in one embodiment;
[0031] FIG7 is a schematic diagram of monitoring the running status of a service component through a probe in one embodiment;
[0032] FIG8 is a schematic diagram of horizontal expansion of a container group in one embodiment;
[0033] FIG9 is a schematic diagram of vertical upgrading of a container group in one embodiment;
[0034] FIG10 is a schematic diagram of generating a data snapshot for a container group in one embodiment;
[0035] FIG11 is a schematic diagram of a recovery service instance in one embodiment;
[0036] FIG12 is a structural block diagram of a business service establishment device in one embodiment;
[0037] FIG13 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0039] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0040] The business service establishment method provided in the embodiment of the present application involves cloud technology.
[0041] Cloud storage is a new concept that has been extended and developed from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as storage system) refers to a storage system that uses cluster applications, grid technology, and distributed storage file systems to bring together a large number of different types of storage devices (storage devices are also called storage nodes) in the network through application software or application interfaces to work together and provide external data storage and business access functions.
[0042] A database, in short, can be thought of as a digital filing cabinet—a place where electronic files are stored, allowing users to add, query, update, and delete data. A database is a collection of data stored in a specific way, shared by multiple users, with minimal redundancy, and independent of applications.
[0043] A database management system (DBMS) is a computer software system designed for managing databases, typically providing basic functions such as storage, retrieval, security, and backup. DBMSs can be categorized by the database model they support, such as relational or XML (Extensible Markup Language); by the type of computer they support, such as server clusters or mobile phones; by the query language used, such as SQL (Structured Query Language) or XQuery; by performance priorities, such as maximum scale or maximum speed; or by other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, supporting multiple query languages simultaneously.
[0044] The business service establishment method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other servers. The terminal 102 can be, but is not limited to, various desktop computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services. The terminal and the server can be directly or indirectly connected through wired or wireless communication, and this application does not limit this.
[0045] The business service establishment method provided in the embodiments of the present application can be executed independently by the terminal 102 or the server 104, or can be executed collaboratively by the terminal 102 and the server 104. For example, the server can obtain service requirement information for the target business service from the terminal. The server obtains a preset instance template for the target business service as the target instance template, and creates a service instance corresponding to the target business service based on the service requirement information and the target instance template. The server creates a service component based on the component declaration information contained in the service instance, obtaining each service component corresponding to the target business service. The component declaration information is used to instruct the creation of service components that match each component type specified in the target instance template. The server creates a container group set corresponding to the service component based on the container group declaration information contained in the service component, obtaining each container group set corresponding to each service component. The container group declaration information contained in the service component is obtained from the service instance. Based on the service instance, each service component, and each container group set corresponding to each service component, a service model corresponding to the target business service is obtained. The service model is used to provide the target business service to the demander corresponding to the service requirement information. The server can return access to the service model to the terminal so that the terminal can use the target business service.
[0046] In this way, instance templates corresponding to various business services are pre-set to facilitate the rapid establishment of corresponding business services. For a target business service, the personalized service requirement information of the target business service is combined with the instance template corresponding to the target business service to obtain a corresponding service instance. Based on the component declaration information contained in the service instance, each service component corresponding to the target business service is created. Based on the container group declaration information contained in the service component, a container group set corresponding to the service component is created. A service model for providing the target business service is constructed by combining the service instance corresponding to the target business service, each service component, and each container group set corresponding to each service component. Business services are abstracted into a three-layer structure, consisting of service instances, service components, and the container group sets corresponding to the service components. Service instances manage the creation of information related to service components and container group sets, while each component manages the creation of information related to its own container group set. This enables the orderly establishment of business services. Various business services can be abstracted into this three-layer structure, which is highly versatile, ensuring the versatility of business service establishment and improving the efficiency of business service establishment. Based on this three-layer structure, business services are containerized and implemented in a cloud-native manner.
[0047] In one embodiment, as shown in FIG2 , a method for establishing a business service is provided, which is illustrated by applying the method to a processing server. This embodiment illustrates the method by applying the method to a processing server. It is understood that the method can also be applied to a computer device, which can be a terminal or a server, or to a system including a terminal and a server, and implemented through the interaction between the terminal and the server. Referring to FIG2 , the method for establishing a business service includes the following steps:
[0048] Step S202: obtaining service requirement information for the target business service, and obtaining a preset instance template for the target business service as a target instance template.
[0049] The processing server is a server that processes business service establishment requests and establishes and deploys business services on related devices. For example, the processing server can deploy the business service on a cloud server.
[0050] A target business service refers to a business service that is currently waiting to be deployed or established. For example, a terminal can provide users with access points to various business services. Users can select the desired business service on the terminal and use the selected service as the target business service. The subsequent processing server will establish and deploy the target business service on the node cluster for the user and return the access point of the successfully established target business service to the terminal so that the user can use the target business service.
[0051] When users select a desired business service, they can also specify their service requirements. These requirements can include requirements for the service's deployment location or scale. Service requirements refer to the personalized needs of the target business service's users. For example, for a database service, service requirements might include requirements for the database's deployment region, availability zone, hard drive, backup, and node.
[0052] Instantiate an object to obtain the corresponding instance. Instantiate a business service to obtain the corresponding service instance. Various business services have their own characteristics, and corresponding instance templates can be pre-set for various business services. The instance template is a specification template pre-set for the characteristics of the business service. The instance template is used to declare the common metadata required to establish the business service. For example, the instance template includes the component type required by the business service, common component configuration parameters, and common container group configuration parameters. It can be understood that the component types contained in a business service are fixed. For example, for the ClickHouse database service, ClickHouse consists of two components, namely zookeeper and clickhouse. Zookeeper is used for metadata management of ClickHouse, and clickhouse is used for data storage and calculation of ClickHouse. For example, the ClickHouse database service is deployed on a cluster containing multiple nodes. Zookeeper is responsible for scheduling and communication between nodes in the node cluster, and clickhouse is responsible for data storage and data calculation on nodes in the node cluster.
[0053] Specifically, the user determines the required target business service and service requirement information for the target business service on the terminal. The terminal sends the service requirement information for the target business service to the processing server, and then the processing server obtains the preset instance template for the target business service as the target instance template, and deploys the target business service based on the service requirement information and the target instance template.
[0054] The client can perform a business service establishment operation on the client. In response, the client generates a business service establishment request. The business service establishment request carries the service type information and service requirement information corresponding to the target business service. The client then sends the business service establishment request to the processing server. After receiving the business service establishment request, the processing server parses the business service establishment request to obtain the service type information and service requirement information. Based on the service type information, the processing server retrieves a preset instance template for the target business service as the target instance template. The server then deploys the target business service based on the service requirement information and the target instance template.
[0055] Step S204: Create a service instance corresponding to the target business service based on the service requirement information and the target instance template.
[0056] Specifically, after determining the service requirement information and target instance template for the target business service, the service requirement information and the target instance template are combined to create a personalized service instance corresponding to the target business service. The service instance corresponding to the target business service is used to indicate various metadata required to establish the target business service.
[0057] In one embodiment, the service instance corresponding to the business service is Cluster, which is a business cluster instance. Cluster represents a cluster instance created for the business service and is implemented by K8s CRD. The instance template corresponding to the business service is ClusterPreset, which is a business cluster instance template. The business cluster instance template represents a specification template pre-configured in advance for Cluster. For example, a ClusterPreset corresponding to a business service includes the image (mirror), cpu / memory, parameter configuration and other information of the component corresponding to the business service. ClusterPreset is implemented by K8s CRD. K8s (Kubernetes) is a container orchestration system widely used in the cloud native field. It has the characteristics of high scalability, high availability, fault self-healing, open source ecology, etc. As a base, it can support large-scale production-level cluster deployment. CRD (Custom Resource Definition) is a resource type customized by K8s users in K8s. There is no need to modify the K8s source code to create a customized API server. This function greatly improves the scalability of K8s. User-defined CRD can implement corresponding functional features through the corresponding designed CRD controller.
[0058] In one embodiment, the target instance template is a yaml file implemented based on K8s CRD and used for custom resource types. The yaml file has been filled in with the general information required for the target business service. The service requirement information for the target business service is personalized requirement information. The service requirement information is filled into the yaml file, and a service instance corresponding to the target business service is created based on the filled yaml file.
[0059] Step S206: Create service components based on component declaration information included in the service instance to obtain various service components corresponding to the target business service; the component declaration information is used to instruct the creation of service components that match various component types specified by the target instance template.
[0060] Business services are generally composed of one or more components, with different components responsible for different functions within the business service. For example, for the ClickHouse database service, ClickHouse consists of two components: Zookeeper and ClickHouse. Zookeeper is used for metadata management of the ClickHouse database, while ClickHouse is used for data storage and computation within the ClickHouse database. Zookeeper and ClickHouse work together to implement the ClickHouse database service.
[0061] Component declaration information is used to declare and indicate the metadata required to create the components of a business service. The service instance corresponding to the target business service includes the component declaration information corresponding to the target business service. This component declaration information includes information such as the component type required by the target business service, component configuration parameters, and startup dependencies between components.
[0062] It can be understood that the component types required by the target business service are determined based on the service characteristics of the target business service, and the component types required by the target business service are specified in the instance template corresponding to the target business service. For example, for the ClickHouse database service, ClickHouse consists of two components, namely zookeeper and clickhouse. The instance template corresponding to the ClickHouse database service specifies that two components are required, namely zookeeper and clickhouse. The startup dependency relationship between the components required by the target business service is also determined based on the service characteristics of the target business service. The instance template corresponding to the target business service specifies the startup dependency relationship between the components required by the target business service. For example, for the ClickHouse database service, ClickHouse consists of two components, namely zookeeper and clickhouse. The zookeeper component needs to be started successfully before the clickhouse component that depends on zookeeper can be started. The instance template corresponding to the ClickHouse database service specifies the startup dependency relationship between the zookeeper component and the clickhouse component. The component configuration parameters of the components required by the target business service include general configuration parameters and adjustable configuration parameters. The general configuration parameters are specified in the instance template corresponding to the target business service. The adjustable configuration parameters can be adjusted according to user needs or use default parameters. The default parameters of the adjustable configuration parameters can be specified in the instance template corresponding to the target business service.
[0063] Specifically, the processing server creates a service component based on the component declaration information contained in the service instance. The component declaration information includes component configuration parameters of various components required for the target business service. Based on the component configuration parameters, the corresponding component can be created to obtain the various service components corresponding to the target business service.
[0064] Step S208 : creating a container group set corresponding to the service component based on the container group declaration information contained in the service component, and obtaining a container group set corresponding to each service component; the container group declaration information contained in the service component is obtained from the service instance.
[0065] The functionality of a component can be implemented by one or more container groups. A container group consists of a group of related containers and is also called a pod. A container is an isolated unit that packages the resources required to run an application. A container includes the application code, its libraries and dependencies, any configuration files, and other system tools it relies on. Containers enable cross-platform application portability, process isolation, and efficient development and deployment. The container groups required by a component constitute the corresponding container group set.
[0066] The container group declaration information is used to declare and indicate the metadata required to create the container group set required for the component. The container group declaration information corresponding to the target business service includes information such as the number of pods required for the components of the target business service, pod configuration parameters, etc. For example, the container group declaration information includes information such as the number of pods required for the components, the image required for each pod, the cpu / memory required for each pod, and the disk specifications required for each pod. The service instance corresponding to the target business service includes the container group declaration information corresponding to the target business service. The service component corresponding to the target business service can obtain the container group declaration information from the service instance corresponding to the target business service, that is, inherit the container group declaration information from the service instance corresponding to the target business service.
[0067] It can be understood that the container group configuration parameters of the container group set required by the service component corresponding to the target business service include general configuration parameters and adjustable configuration parameters. The general configuration parameters are specified in the instance template corresponding to the target business service. The adjustable configuration parameters can be adjusted according to user needs, or the default parameters can be used. The default parameters of the adjustable configuration parameters can be specified in the instance template corresponding to the target business service.
[0068] Specifically, the processing server creates a container group set corresponding to the service component based on the container group declaration information contained in the service component. The container group declaration information includes the container group configuration parameters of each container group in the container group set required by the service component of the target business service. Based on the container group configuration parameters, the corresponding container group can be created. The container groups corresponding to the same service component form a container group set, and finally the container group set corresponding to each service component is obtained.
[0069] Step S210 , based on the service instance, each service component, and the container group set corresponding to each service component, obtain a service model corresponding to the target business service; the service model is used to provide the target business service to the demander corresponding to the service demand information.
[0070] Specifically, the processing server sequentially creates the service instance, service components, and container group sets corresponding to the target business service. It then combines the service components and container group sets corresponding to the target business service into a service model corresponding to the target business service. The target business service is then provided to the requester corresponding to the service demand information through the service model corresponding to the target business service. In the service model corresponding to the target business service, service instances are used for global management, with service instances and service components forming a parent-child relationship. Service components are used to manage container group sets, with service components and corresponding container group sets forming a parent-child relationship. Container group sets are used for data processing specific to the target business service.
[0071] For example, if a user requests the ClickHouse database service, they can submit service requirements for the ClickHouse database service. This service requirement information can include the number of pod shards, the number of pod replicas, and the required disk specifications for the pods. The number of pod shards determines how many pods the database data needs to be distributed across, the number of pod replicas determines how many pods are needed as backup pods to back up the database data, and the required disk specifications determine the capacity of the pods to store business data. The processing server receives a business service establishment request for the ClickHouse database service, which carries the service requirement information. The processing server obtains the ClusterPreset corresponding to the ClickHouse database service, combines the service requirement information and the ClusterPreset, and creates a cluster corresponding to the ClickHouse database service. The cluster corresponding to the ClickHouse database service is denoted as cluster1. The Kubernetes-based Cluster Manager (instance controller) creates a ZooKeeper component based on the ZooKeeper-related configuration parameters in cluster1. The ZooKeeper component is denoted as set1. Set1 inherits the pod-related configuration parameters required by the ZooKeeper component from cluster1. Through the Cluster manager (instance controller) designed based on K8s, the clickhouse component is created based on the clickhouse-related configuration parameters in cluster1, and the clickhouse component is recorded as set2. Set2 inherits the relevant configuration parameters of the pod required by the clickhouse component from cluster1. Through the set controller (component controller) designed based on K8s, the pod set required by the zookeeper component is created based on the pod-related configuration parameters in the zookeeper component. Through the set controller (component controller) designed based on K8s, the pod set required by the clickhouse component is created based on the pod-related configuration parameters in the clickhouse component. Referring to Figure 3, the service model of the ClickHouse database service required by the user includes a three-layer structure, namely cluster1 representing the ClickHouse database instance, set1 and set2 representing the ClickHouse database components, and the various pods required by the ClickHouse database components.The processing server can return the service access entrance corresponding to the established ClickHouse database service to the user, and the user can use the ClickHouse database service based on the service access entrance.
[0072] After receiving a service request, the service client deployed for the target business service can send the service request through the target business service's access portal to the corresponding service model. The service model then distributes the service request to a specific container group, which then performs the corresponding business processing. The service model can distribute service requests based on a load balancing policy. A load balancing policy determines the load of each container group in the set of container groups corresponding to the service component processing the service request based on the resource utilization of each container group, and distributes service requests based on this load.
[0073] In the above-mentioned business service establishment method, instance templates corresponding to various business services are pre-set to facilitate the rapid establishment of corresponding business services. For a target business service, the personalized service requirement information of the target business service and the instance template corresponding to the target business service are combined to obtain a service instance corresponding to the target business service. Based on the component declaration information contained in the service instance, each service component corresponding to the target business service is created. Based on the container group declaration information contained in the service component, a container group set corresponding to the service component is created. A service model for providing the target business service is constructed by combining the service instance corresponding to the target business service, each service component, and each container group set corresponding to each service component. Business services are abstracted into a three-tiered model, comprising service instances, service components, and the container group sets corresponding to the service components. Service instances manage the creation of relevant information about service components and container group sets, while each component manages the creation of relevant information about its own container group set. This enables the orderly establishment of business services. Various business services can be abstracted into a three-tiered model, which is highly versatile, ensuring the versatility of business service establishment and improving the efficiency of business service establishment. Based on this three-tiered model, business services are containerized and implemented using a cloud-native approach.
[0074] In one embodiment, creating a service instance corresponding to a target business service based on service requirement information and a target instance template includes:
[0075] Fill the service requirement information into the target instance template to obtain the service instance corresponding to the target business service; the target instance template includes a component declaration area and a container group declaration area; the component declaration area is used to indicate component declaration information, and the container group declaration area is used to indicate container group declaration information.
[0076] The target instance template includes a component declaration area and a container group declaration area. The component declaration area is used to indicate component declaration information. That is, the content contained in the component declaration area constitutes the component declaration information. The container group declaration area is used to indicate container group declaration information. That is, the content contained in the container group declaration area constitutes the container group declaration information.
[0077] Specifically, after obtaining service requirement information for the target business service, the processing server populates the service requirement information into a target instance template and, based on the populated target instance template, obtains a service instance corresponding to the target business service. The target instance template can be a key-value format template file. The service requirement information includes at least one requirement item. When populating the target instance template, the target instance template is searched for keys that match each requirement item, and the specific information of the requirement item is used as the value corresponding to the matching key.
[0078] In the above embodiment, the service requirement information for the target business service is filled into the target instance template for the target business service, so that a service instance corresponding to the target business service can be quickly created.
[0079] In one embodiment, a service component is created based on the component declaration information contained in the service instance to obtain each service component corresponding to the target business service, including:
[0080] Based on the component declaration information contained in the service instance, determine the component types required for the target business service and the component configuration information corresponding to each component type; based on each component configuration information, create service components that match the corresponding component type to obtain the service components corresponding to the target business service.
[0081] Specifically, the component declaration information includes the various component types required by the target business service. The component types are used to determine the component types required by the target business service. The component declaration information also includes component configuration information corresponding to each component type required by the target business service. The component configuration information is used to determine the configuration parameters of the components required by the target business service. The component configuration information includes various field information required to create components of the corresponding component types. Based on the component declaration information contained in the service instance, the processing server determines the various component types required by the target business service and the component configuration information corresponding to each component type. Based on each component configuration information, the server creates service components that match the corresponding component types, thereby obtaining the service components corresponding to the target business service.
[0082] In the above embodiment, the component declaration information declares each component type required by the target business service and the component configuration information corresponding to each component type. Based on the component declaration information, each service component corresponding to the target business service can be quickly created.
[0083] In one embodiment, a container group set corresponding to a service component is created based on the container group declaration information contained in the service component, and a container group set corresponding to each service component is obtained, including:
[0084] For any service component in each service component, based on the container group declaration information contained in the service component, determine the number of container groups required by the service component, and create each container group to be configured that matches the number of container groups; based on the container group declaration information contained in the service component, determine the container group configuration information corresponding to each container group to be configured; based on the container group configuration information, initialize the corresponding container group to be configured to obtain a configured container group; based on each configured container group, obtain the container group set corresponding to the service component.
[0085] Specifically, the container group declaration information includes the number of container groups required by the service component. The number of container groups is used to determine the number of pods required by the service component. The processing server can create each container group to be configured to match the number of container groups. The container group declaration information includes the container group configuration information for the container group required by the service component. The container group configuration information is used to determine the configuration parameters of the pod. Each pod has its own corresponding container group configuration information. Based on the container group configuration information, the processing server can initialize the corresponding container group to be configured, obtaining a configured container group. Ultimately, each configured container group constitutes the container group set corresponding to the service component.
[0086] In one embodiment, initializing the container group to be configured includes initializing the namespace (NS) of the container group to be configured. K8s uses namespaces to place a group of related resources in the same namespace to achieve resource isolation and permission restrictions. The pods corresponding to a business service are placed in the same namespace, and the pods corresponding to different business services are placed in different namespaces to achieve business service isolation. For example, the pods corresponding to user A's MySQL database service are placed in namespace a, and the pods corresponding to user B's MySQL database service are placed in namespace b.
[0087] In one embodiment, initializing the container group to be configured includes initializing the storage specifications of the container group to be configured. The storage specifications of the pod are used to determine the storage capacity and storage directory of the data in the pod. The storage specifications of the pod can be configured according to user needs.
[0088] In one embodiment, initializing the container group to be configured includes initializing a network of the container group to be configured. The pod network is used for communication between different pods.
[0089] In one embodiment, initializing the container group to be configured includes initializing the configuration file of the container group to be configured. The pod configuration file is used to run the pod process. The pod configuration file can be set using the ConfigMap provided by K8s or other custom components.
[0090] In the above embodiment, the container group declaration information declares the number of container groups and container group configuration information required by the service component. Based on the container group declaration information, a container group set corresponding to each service component can be quickly created.
[0091] In one embodiment, as shown in FIG4 , initializing the corresponding container group to be configured based on the container group configuration information to obtain a configured container group includes:
[0092] In step S402, for any container group to be configured, the container group configuration component is used to obtain the container group runtime identification information corresponding to the container group to be configured. The personalized requirement information and the container group runtime identification information in the container group configuration information corresponding to the container group to be configured are rendered to obtain the container group personalized configuration information corresponding to the container group to be configured.
[0093] Step S404: Obtain the container group configuration file template corresponding to the target business service through the container group configuration component, render the container group personalized configuration information and the container group configuration file template, and obtain the target configuration file corresponding to the container group to be configured.
[0094] Step S406: The target configuration file is sent to the container to be configured through the container group configuration component, and a configured container group initialized based on the configuration file is obtained.
[0095] The container group configuration component is a pre-configured component used to configure the final configuration file required by the container group. The personalized requirements in the container group configuration are determined based on the service requirements submitted by the user. For example, this information may include the number of pods to be created and the storage specifications for each pod. The container group runtime identification information refers to the information used to identify the container group during operation. For example, this information may include at least one of the following: the pod name, domain name, IP address, and status.
[0096] As you can understand, container group configuration information refers to pre-runtime parameters for the container group and exists before a pod is created. Container group runtime identification information refers to runtime parameters for the container group and exists only after a pod is created. For example, before creating a pod, only the required information, such as the number of pods to be created and the pod image, is known. After the pod is created, the pod's name, domain name, IP address, and status are generated.
[0097] Each business service has a corresponding container group configuration file template. This template is a pod-specific template provided by the business developer of the business service. For example, database services include MySQL, MariaDB, PostgreSQL, SQL Server, ClickHouse, MongoDB, Redis, and other database services. For example, the MySQL database service belongs to the MySQL database. MySQL database engineers will write the configuration file template for the pod required by the MySQL database. In other words, the database provider will write the configuration file template for the pod required by the MySQL database.
[0098] A container group configuration file template includes existing basic configuration parameters and customized configuration parameters to be added. Basic configuration parameters are common to all pods of the same type, while customized configuration parameters are unique to each pod. A complete configuration file is created by adding the customized configuration parameters to the template.
[0099] Specifically, the processing server may generate target configuration files corresponding to the container groups to be configured through the container group configuration component, and send the target configuration files to the corresponding container groups to be configured, thereby obtaining configured container groups initialized based on the configuration files.
[0100] When generating the target configuration file, the container group configuration component first obtains the container group runtime identification information corresponding to the container group to be configured. The personalized requirement information in the container group configuration information for the container group to be configured is then combined with the container group runtime identification information to obtain the container group personalized configuration information for the container group to be configured. The container group configuration component then obtains the container group configuration file template corresponding to the target business service. The container group personalized configuration information and the container group configuration file template are then combined to render the container group personalized configuration information into the container group configuration file template, ultimately generating the target configuration file corresponding to the container group to be configured.
[0101] In the above embodiment, the container group configuration component renders the personalized requirement information and container group runtime identification information in the container group configuration information to obtain the container group personalized configuration information. This personalized configuration information is then rendered with the container group configuration file template to obtain the complete target configuration file. The container group configuration component can quickly generate the personalized configuration file required by the container group, thereby helping to ensure that the container group operates normally as required.
[0102] In one embodiment, obtaining a container group configuration file template corresponding to a target business service through a container group configuration component includes:
[0103] The container group configuration component obtains a template index of a container group configuration file template for the target business service from the container group declaration information. Based on the template index, the container group configuration file template is retrieved from a preset storage area. The container group configuration file template is submitted to the preset storage area for storage using a template unification tool. The template unification tool is used to unify the formats of container group configuration file templates provided by multiple business developers corresponding to the business type of the target business service.
[0104] Business services have corresponding business types. For example, various database services correspond to the business type "database," and various middleware services correspond to the business type "middleware." Business developers are the companies or vendors that develop the services. For example, databases include MySQL, MariaDB, PostgreSQL, SQL Server, ClickHouse, MongoDB, and Redis. The developer of the MySQL database provides the pod configuration file template required by the MySQL database, and the developer of the ClickHouse database provides the pod configuration file template required by the ClickHouse database.
[0105] The Template Unification Tool is a pre-configured tool used to unify the format of configuration file templates. It converts container group configuration files provided by multiple service developers for the same service type into a unified format for subsequent processing by the container group configuration component.
[0106] Upload the container group configuration file templates provided by multiple business developers corresponding to the same business type to the template unification tool. Use the template unification tool to convert each container group configuration file template into a unified format. The template unification tool submits each container group configuration file template in the unified format to the preset storage area for storage.
[0107] Storing a container group configuration file template in a preset storage area means storing the container group configuration file template in a pre-set storage area. The pre-set storage area can be set as needed. After storing the container group configuration file template, a template index corresponding to the container group configuration file template is obtained. The template index allows for quick search of the corresponding container group configuration file template.
[0108] After obtaining the template index corresponding to the container group configuration file template by storing the container group configuration file template, the template index of the container group configuration file template can be written into the instance template corresponding to the corresponding business service in advance, so that subsequent template indexes can be passed between the service instances and service components corresponding to the corresponding business service.
[0109] Specifically, you can pre-obtain container group configuration file templates provided by multiple business developers corresponding to the business type of the target business service. Use a template unification tool to unify the format of each container group configuration file template. Then, submit the unified container group configuration file templates to a pre-set storage area for storage. For any business service, obtain the template index corresponding to its container group configuration file template and write the template index into the corresponding instance template.
[0110] For the target business service, when obtaining the corresponding container group configuration file template through the container group configuration component, the container group configuration component can specifically obtain the template index of the container group configuration file template for the target business service from the container group declaration information, and obtain the container group configuration file template from the preset storage area based on the template index.
[0111] In the above embodiment, the container group configuration file templates provided by multiple business developers corresponding to the business type of the target business service are pre-formatted using a template unification tool. This allows the subsequent container group configuration component to be written logically based on a single format. Pre-writing the template index of the container group configuration file template for the target business service into the container group declaration information facilitates the container group configuration component to quickly retrieve the container group configuration file template and generate the required configuration file for the container group.
[0112] In one embodiment, the configuration of each component pod required by a business service may be different, requiring a configuration to be maintained for each pod. A pod often needs to be aware of its own shard ID, allocated CPU, allocated Memory, and other information such as the IP addresses and domain names of other pods in the cluster. This information is typically recorded in the pod's configuration file and made available to processes within the pod. The present method generates the pod's configuration file using the ConfigCenter component (the container group configuration component).
[0113] Referring to Figure 5, ClusterParams represents the personalized parameter configuration of the business service demander (i.e., the user of the business service). Typically, upper-layer services obtain ClusterParams based on the demander's configuration and then pass it to the instance controller, the Cluster Manager, through the Cluster. The instance controller, the Cluster Manager, passes ClusterParams to the ConfigCenter component by accessing its internal API.
[0114] ConfigTemplates represent configuration file templates for pods and support Go Template rendering by default. For example, different database ConfigTemplates are written by engineers working on different databases. ConfigTemplates are submitted to Object Storage using the ConfigCli tool (the template unification tool). The ConfigCenter component can retrieve ConfigTemplates from Object Storage using StorageProvider, an external storage interface for accessing Object Storage.
[0115] ValueRender (the first rendering module) represents rendering the incoming ClusterParams parameter with the pod runtime information, that is, merging the ClusterParams and the container group runtime identification information to obtain the required variable value Value.
[0116] ConfigRender (the second rendering module) is the central module of the ConfigCenter component. It can be thought of as a stateless string template rendering function. It renders the variable value obtained in the previous step with ConfigTemplates, merging the variable value with ConfigTemplates to generate the target configuration file, ConfigArtifacts. ConfigArtifacts is a configuration file generated by the ConfigCenter component and can be directly distributed to the corresponding Pod for process use. The ConfigCenter component distributes ConfigArtifacts to pods through the HTTP server, which serves as an external interface.
[0117] In one embodiment, based on the container group configuration information, initializing the corresponding container group to be configured to obtain a configured container group includes:
[0118] Create a target persistent volume declaration that matches the storage specifications in the container group configuration information; generate the target persistent volume content based on the target persistent volume template contained in the target persistent volume declaration, and associate the target persistent volume content with the hard disk that matches the storage specifications in the container group configuration information; bind the target persistent volume content and the target persistent volume declaration, and write the target persistent volume declaration to the container group to be configured to obtain a configured container group initialized on the storage specifications; the data in the configured container group initialized on the storage specifications is used to write to the hard disk.
[0119] The container group configuration information includes storage specifications, which are used to indicate the storage capacity of the pod for storing business data.
[0120] A volume is a channel for pods to transfer data between themselves and external storage devices. A volume is used to bind and mount a directory on a hard drive to a directory within a pod, allowing the pod's data to be stored on the hard drive. A persistent volume is a directory on a hard drive that is persistent, meaning its contents survive pod deletion. This means that even after a pod is restarted or recreated on another node, it can still access these contents by mounting the volume. "Persistence" means that any files written to a pod's directory are stored on the hard drive, making the directory persistent. Hard drives support various types of disks, including local hard drives and cloud hard drives. Cloud hard drives are dynamically swappable. If a pod's directory is bind-mounted to a directory on a cloud hard drive, the pod can be restored to another node. However, local hard drives can only be restored to the original node. Only after data migration can the pod be restored to another node.
[0121] A persistent volume template (StorageClass, SC) is a pre-set storage type template. Different hard disks are divided into specific storage types according to specifications, performance, etc., and can be selected according to needs to flexibly control costs. The persistent volume content (PersistentVolume, PV) represents the storage abstraction of the underlying hard disk and is associated with a real hard disk. The persistent volume claim (PersistentVolumeClaim, PVC) represents the underlying storage object abstracted for pod use, declaring the required storage capacity (such as 100G), Node exclusive or shared, file system or block device, etc. It can be understood that SC is a PV creation template used to implement dynamic creation of PV. PV defines a directory for persistent storage on the hard disk. PVC describes the properties of the persistent storage that the pod wants to use, such as the size of the volume storage, read and write permissions, etc.
[0122] Specifically, the target business service can be a stateful service. A stateful service refers to a service that requires persistent storage of data, sessions, or service status, and strictly relies on the correctness and consistency of the stored data during service startup, operation, and recovery. For example, database services are stateful services, including various database services such as MySQL, MariaDB, PostgreSQL, SQL Server, ClickHouse, MongoDB, and Redis. Middleware services are also stateful services, including various message middleware services such as RabbitMQ, RocketMQ, ActiveMQ, Kafka, ZeroMQ, and MetaMq. Multiple pods under the components required by stateful services usually need to persist business data, so a PVC needs to be set for each pod to declare the required storage specifications.
[0123] When configuring PVC for a pod, the target PVC that matches the storage specifications in the container group configuration information is created by calling the relevant interfaces provided by K8s. The corresponding target PV is generated based on the target SC contained in the target PVC. The target PV is associated with the hard disk (local hard disk or cloud hard disk) that matches the storage specifications in the container group configuration information. The target PV and target PVC are bound, and the target PVC is written to the container group to be configured to obtain the configured container group initialized on the storage specifications.
[0124] Referring to Figure 6, the pod mounts the corresponding PVC to declare the required storage specifications, such as a storage capacity of 20Gi and a storage volume mode of filesystem. The PVC is bound to the corresponding PV, and the underlying CSI plug-in implements the specific PV persistent storage. PV attributes include storage capacity (20Gi), storage type (StorageClass), and deletion retention policy (Retain indicates that the corresponding PV is retained when the PVC is deleted). The PV is associated with the actual hard disk system at the bottom layer, and its attributes include region (region), availability zone (zone), capacity (20Gi), type (SSD), etc. In this way, the data written by the pod in its own directory can find the corresponding PV through the PVC, find the hard disk through the PV, and ultimately be written to the directory on the hard disk.
[0125] In the above embodiment, the storage specifications of the container group are initialized, and the business data stored on the container group can be ultimately stored on a remote hard disk through persistent volume declaration, which helps to achieve persistent data storage.
[0126] In one embodiment, the business service establishment method further includes:
[0127] Based on the service component startup dependency order provided by the component declaration information, each service component is started in order; the running status of each service component is monitored by the probe set for each service component, and after the probe set for the service component with a high startup priority monitors that each container group in the container group set managed by the service component has been successfully started, the startup of the service component with the next startup priority is triggered; after each service component is successfully started, the creation success message corresponding to the target business service is returned to the demander.
[0128] Specifically, the service components required by the target business service have a startup dependency sequence. Only by starting each service component in this order can the target business service function properly. This service component startup dependency sequence is recorded in the component declaration information provided by the service instance corresponding to the target business service. This dependency sequence is used to sequentially start each service component after creating the service components and their corresponding container groups, ensuring the operation of the target business service.
[0129] After creating a service component and its corresponding container group set, a corresponding probe is set for each service component. The probe is used to monitor the operating status of the service component, which is reflected by the operating status of each container group in the service component's corresponding container group set. After creating the service component and its corresponding container group set, each service component is started sequentially according to the service component startup dependency order. The probe detects the operating status of the service component that needs to be started first. After all the container groups under the service component that needs to be started first have successfully started and are running normally, the next service component is started. In other words, after the probe set for the service component with the highest startup priority monitors the successful startup of each container group in the container group set managed by the service component, it triggers the startup of the service component with the next highest startup priority. After each service component has successfully started, it indicates that the target business service is operating normally. At this point, a creation success message corresponding to the target business service can be returned to the target business service's demander.
[0130] Taking the ClickHouse database service as an example, refer to Figure 7. The service model of the ClickHouse database service includes cluster1, which represents the ClickHouse database instance; set1 and set2, which represent the ClickHouse database components; and pods, which represent the database processes. The ClickHouse database service consists of two components: Zookeeper and ClickHouse. The Zookeeper component must be started successfully before the ClickHouse component, which depends on Zookeeper, can start. The K8s readinessProbe probe is used to detect the component that starts first. When all pods under set1 are detected as Running, the next component is started in sequence.
[0131] It is understandable that if there is no front-end dependency between some components, probes do not need to be configured, and the pods between these components can be started in parallel.
[0132] In the above embodiment, based on the service component startup dependency order provided by the component declaration information, each service component is started in order with the help of probes set for each service component, which can ensure that each service component is started in an orderly manner and thus ensure that the target business service can run successfully.
[0133] In one embodiment, the business service establishment method further includes:
[0134] Obtain a container group adjustment request for a target business service; the container group adjustment request carries container group adjustment parameters; update the container group declaration information contained in the service instance based on the container group adjustment parameters; based on the updated container group declaration information, update the corresponding service component and the corresponding container group set.
[0135] Container group adjustment requests are used to adjust pods, specifically by upgrading or downgrading them or scaling them up or down. Container group adjustment parameters indicate the required pod adjustments. Scaling or downgrading a pod involves adding or reducing pods. For example, increasing the number of replicas involves increasing the number of pods. Upgrading or downgrading a pod involves increasing or reducing its storage specifications, such as vertically upgrading or downgrading the CPU, memory, or disk resources required by a pod.
[0136] Specifically, as the business volume of the target business service increases or decreases, the pods in the service model corresponding to the target business service can be flexibly adjusted accordingly. The processing server can obtain a container group adjustment request for the target business service. The container group adjustment request carries container group adjustment parameters, and updates the container group declaration information contained in the service instance based on the container group adjustment parameters. For example, if the container group adjustment request is used to expand the capacity of the pod, the number of pods in the container group declaration information is adjusted. If the container group adjustment request is used to upgrade the pod, the pod storage specifications in the container group declaration information are adjusted. If the service instance changes, the service component and the corresponding container group set are updated synchronously. For example, the component controller monitors changes in information in the service instance in real time. If it detects that the corresponding container group declaration information in the service instance has changed, the corresponding container group set is synchronously updated based on the updated container group declaration information.
[0137] For example, using a database service as an example, the Cluster Manager (instance controller), implemented based on Kubernetes's CRDs, controls the underlying Kubernetes StatefulSet to implement dynamic database scaling (i.e., adding or subtracting replicas, also called horizontal scaling) and vertical database upgrades and upgrades (adjusting pod specifications such as CPU, memory, and disk). For a database's dynamic scaling, refer to Figure 8: two pods under set1 are added. For a database's vertical upgrade, refer to Figure 9: the storage specification of the pod under set1 is increased from 4C8G to 8C16G. Correspondingly, dynamic scaling of the database involves a reduction in the number of replicas, while vertical downgrading of the database involves a reduction in storage specifications.
[0138] Furthermore, in order not to affect the normal use of upper-layer businesses, when performing dynamic scaling or vertical upgrade and downgrade operations, the relevant pod network traffic will be removed in advance. After the underlying scaling or upgrade pod detects that Running is operating normally, the business traffic will be connected to achieve smooth operation and maintenance without affecting the business. Taking the database service as an example, when the database service is running, if it is necessary to query the data stored in the database, it can determine the target pod from the various pods used for data storage and calculation based on the load balancing strategy, and query the required data from the target pod. If it is necessary to vertically upgrade or downgrade pod1 for data storage and calculation, when determining the target pod, determine the target pod from the various pods used for data storage and calculation other than pod1. After pod1 completes vertical upgrade and downgrade, pod1 can be considered when determining the target pod.
[0139] In the above embodiment, the container group set corresponding to the service component supports dynamic expansion and contraction and vertical upgrading and downgrading, and has strong flexibility.
[0140] In one embodiment, the business service establishment method further includes:
[0141] When the destruction of the service instance is triggered, the service instance is backed up to obtain a backup instance; the container groups in the container group set corresponding to each service component are respectively used as the first container group; based on the persistent volume declaration corresponding to the first container group, a persistent volume snapshot declaration corresponding to the first container group is created; based on the persistent volume content corresponding to the first container group, the persistent volume snapshot content corresponding to the first container group is created; the persistent volume snapshot declaration and the persistent volume snapshot content corresponding to the first container group are bound; based on the bound persistent volume snapshot declaration and the persistent volume snapshot content corresponding to the first container group, a data snapshot corresponding to the first container group is generated; the container group operation identification information corresponding to the first container group and the data snapshot are associated and stored; the data snapshots corresponding to each container group in the backup instance and the container group set corresponding to each service component are associated and stored.
[0142] Among them, snapshots are used to record the system status and data at a certain point in time. Persistent Volume Snapshot Declaration (VolumeSnapshot, VSS) represents the abstract resource object of persistent volume snapshots. Persistent Volume Snapshot Content (VolumeSnapshotContent, VSC) represents the abstract resource object of persistent volume snapshot content, which is associated with the real backend snapshot storage resources, such as COS / NFS, etc. COS (Cloud Object Storage) is a cloud object storage service, which is a distributed and massive access system for unstructured objects. NFS (Network File System) is a network file system, which is a distributed and massive access system. The container group running identification information is used to identify the container group, for example, it can be the name of the pod.
[0143] Specifically, when the destruction of the service instance corresponding to the target business service is triggered, a snapshot backup is automatically initiated to back up the data stored in the service instance and container group collection for subsequent recovery of the service instance. When the destruction of the service instance corresponding to the target business service is triggered, the service instance is backed up to obtain a backup instance. The backup instance includes the same metadata as the service instance and is used to restore the service model corresponding to the target business service.
[0144] When triggering the destruction of the service instance corresponding to the target business service, the business data stored in the pod is backed up so that the business data stored in the pod can be restored synchronously when the service model is restored. The container groups in the container group set corresponding to each service component are respectively used as the first container group. For any first container group, call the relevant interface provided by K8s to create the VSS corresponding to the first container group based on the PVC corresponding to the first container group, call the relevant interface provided by K8s to create the VSC corresponding to the first container group based on the PV corresponding to the first container group, bind the VSS and VSC corresponding to the first container group, and generate the data snapshot corresponding to the first container group based on the bound VSS and VSC corresponding to the first container group. Furthermore, the container group operation identification information corresponding to the first container group is associated with the data snapshot and stored, and the container group operation identification information is used to indicate which pod the data snapshot belongs to.
[0145] Finally, the backup instance and the data snapshots corresponding to each container group in the container group set corresponding to each service component are associated and stored for subsequent data recovery.
[0146] As you can understand, in addition to initiating a snapshot backup of the business data in the pod when the service instance is destroyed, you can also initiate a scheduled snapshot backup of the business data in the pod. Data snapshots can be created based on Block technology or XFS Reflink technology.
[0147] For example, to generate a data snapshot of business data in a pod, refer to Figure 10. By calling the relevant interfaces provided by Kubernetes, a VSS is created from the PVC mounted on the pod, and a VSC is created from the PV bound to the PVC mounted on the pod. The VSS and VSC are then bound together, and the VSC creates a snapshot based on the data stored in the relevant directories on the hard drive associated with the PV corresponding to the pod. Snapshot requests can be initiated at different points in time, and the generated snapshots store the data at that point in time. In other words, N number of snapshots can be generated for the same hard drive, each storing data from the relevant directories on the hard drive at a different point in time.
[0148] In the above embodiment, when the destruction of a service instance is triggered, the business data stored in the service instance and the container group set is backed up in a timely manner, which helps to quickly restore the service instance later.
[0149] In one embodiment, the business service establishment method further includes:
[0150] When triggering recovery of a service instance, a backup instance is obtained; a service component is created based on the component declaration information contained in the backup instance to obtain each recovery component; a container group set corresponding to the recovery component is created based on the container group declaration information contained in the recovery component to obtain a container group set corresponding to each recovery component; the container groups in the container group set corresponding to each recovery component are respectively used as second container groups; based on the container group operation identification information corresponding to the second container group, a corresponding data snapshot is obtained, a persistent volume snapshot declaration and persistent volume snapshot content corresponding to the second container group are generated based on the data snapshot corresponding to the second container group, a persistent volume content corresponding to the second container group is generated based on the persistent volume snapshot content corresponding to the second container group, a persistent volume declaration corresponding to the second container group is generated based on the persistent volume snapshot declaration corresponding to the second container group, the persistent volume content and persistent volume declaration corresponding to the second container group are bound, and the persistent volume declaration corresponding to the second container group is applied to the second container group.
[0151] Specifically, the process of restoring a service instance can be initiated at any time based on user needs. When the recovery of the service instance corresponding to the target business service is triggered, the pre-backed-up backup instance is obtained, the service model is restored based on the backup instance, and the pre-backed-up data snapshot is obtained. The business data stored in the pod of the service model is restored based on the data snapshot.
[0152] When restoring a service model based on a backup instance, similar to the process of creating service components and corresponding container group sets through service instances, service components are created based on the component declaration information contained in the backup instance to obtain various recovery components. Container group sets corresponding to the recovery components are created based on the container group declaration information contained in the recovery components to obtain container group sets corresponding to various recovery components. The backup instance, various recovery components, and container group sets corresponding to various recovery components constitute the service model recovered for the target business service.
[0153] When restoring business data based on a data snapshot, the container groups in the container group set corresponding to each recovery component are each used as the second container group. For any second container group, the corresponding data snapshot is obtained based on the container group operation identification information corresponding to the second container group. The relevant interfaces provided by K8s are called to generate the corresponding VSS and VSC of the second container group based on the corresponding data snapshot of the second container group. The relevant interfaces provided by K8s are called to generate the corresponding PV of the second container group based on the corresponding VSC of the second container group. The corresponding PVC of the second container group is generated based on the corresponding VSS of the second container group. The PVC and PV of the second container group are bound, and the PVC of the second container group is applied to the second container group. The second container group can then read the business data from the corresponding hard disk and store it in its own directory. It can be understood that the container group operation identification information of pods created based on the same metadata is the same. For example, if the name of the first pod is pod1 before being destroyed, then the name of the first pod will also be pod1 when it is restored.
[0154] For example, referring to Figure 11, three pods are created based on cluster1 using the corresponding set. When cluster1 is terminated, cluster1 is backed up, and snapshots corresponding to pod1, pod2, and pod3 are generated. Within the validity period of the data snapshots, the process of restoring cluster1 can be initiated at any time as needed. Cluster2 is generated based on the backup of cluster1. A set is created based on cluster2, and three pods are created from the set: pod1', pod2', and pod3'. For the business data to be stored in pod1', pod2', and pod3', the corresponding snapshots of pod1', pod2', and pod3' are obtained. Based on the snapshots, a VSS and VSC are created based on the snapshots. The VSS and VSC are bound to each other. A PVC is created with the VSS as the data source, and a PV is created with the VSC as the data source. The PVC and PV are bound to each other and mounted on the corresponding pods. Finally, pod1', pod2', and pod3' will be running, ultimately ensuring the normal operation of cluster2.
[0155] In the above embodiment, when the recovery of the service instance is triggered, the service model storing the same business data as before the destruction can be quickly restored based on the pre-backed-up backup instance and data snapshot, thereby ensuring the continued operation of the target business service.
[0156] In one embodiment, the target business service is a target database service. The service instance is used to indicate metadata required to establish the target database service. Each service component is responsible for implementing each function of the target database service. Each container group belonging to the same container group set is used to cooperate to implement the functions provided by the corresponding service component.
[0157] Specifically, with the widespread adoption and production implementation of cloud-native technologies, more and more database services need to migrate from traditional physical machine process management to cloud-native containerized management, achieving cloud-native features such as rapid iteration, efficient deployment, elastic scaling, and underlying difference shielding. The method of this application can be used for the containerized implementation of database services and is applicable to a variety of database services. Database services are typically composed of multiple components, so implementing containerized management of database services requires considering the containerization of multiple components, with different components responsible for implementing different functions of the target database service. For example, a database service includes a database coordination component and a database engine component. Database services are generally implemented through a node cluster. The database coordination component coordinates communication between the node clusters, while the database engine component stores and computes business data in the database, implementing business data management. Each container group within the same container group set cooperates to implement the functions provided by the corresponding service component. For example, for the database engine component, multiple shard pods and multiple replica pods can be set up. A shard pod is responsible for managing a portion of business data. The business data managed by each shard pod is combined to form the complete business data stored in the database. A replica pod is used to back up a portion of business data. For the same portion of business data, multiple replica pods can be set up to perform multiple backups.
[0158] In a specific embodiment, the present invention can be applied to a scenario where a cloud vendor provides database services to customers. Database services are a typical stateful service that requires persistent storage of data, sessions, or service states.
[0159] Traditional technologies typically use StatefulSet in Kubernetes to manage individual components and provide persistent storage for stateful services. These core capabilities include fixed pod names and persistent data storage, but they lack common management capabilities for multiple databases and components, such as component dependencies, differentiated configuration, dynamic scaling, dynamic upgrades and upgrades, and data backup and recovery. This application method implements a common model abstraction for database services and the aforementioned core database management capabilities.
[0160] It can be understood that database services are composed of multiple components: common database services are generally composed of one or more components, so the implementation of containerized management of database services requires consideration of the containerization of multiple components. The method of this application abstracts common database services into a general three-tier resource model, which is cluster->sets->pods from top to bottom, corresponding to database instances, database components, and database process pods, respectively. Through such a three-tier resource model, the containerization of multiple database services can be supported. When a customer purchases a database service from a cloud vendor, he or she can choose the database type and personalized demand information for the database service. After receiving the customer's request, the cloud vendor's processing server obtains the instance template corresponding to the database type required by the customer, and quickly creates the database instance required by the customer based on the customer's personalized demand information and the instance template. The database instance declares the various metadata required to implement the database service required by the user, creates the database component based on the component declaration information in the database instance, and creates the database process pod corresponding to the database component based on the pod declaration information inherited by the database component from the database instance. Taking the ClickHouse database service as an example, customers can open the business service creation page of the ClickHouse database service on the client provided by the cloud vendor. The business service creation page contains the components required for the ClickHouse database service: zookeeper and clickhouse. The demander can configure the corresponding parameters for each component to obtain service demand information. Customers can configure the number of shards, the number of pods under the shards, the pod specifications, the number of replicas corresponding to the shards, and other information for each component. Based on the service type information and service demand information of the ClickHouse database service, the client generates a business service establishment request and sends it to the cloud vendor's processing server. Based on the service type information and service demand information, the processing server creates the service instance cluster1 corresponding to the ClickHouse database service, creates the zookeeper component set1 and the clickhouse component set2 under cluster1, creates the pod required by the customer under set1, and creates the pod required by the customer under set2.
[0161] Furthermore, database service components typically have a startup dependency order. For example, the ClickHouse database service consists of two components: Zookeeper and ClickHouse. The Zookeeper component must be started successfully before the ClickHouse component, which depends on Zookeeper, can start. The database instance records the startup dependency order of database components. This application method uses the K8s readinessProbe probe to detect the component that starts first. When all pods under that component detect that they are running normally, the next component is started in sequence.
[0162] In addition, there are differentiated configurations between the components of the database service. Multiple components of the database service have specific configurations, and different pods within each component may have different configurations. After creating the pod, the method of this application generates the configuration file required by the pod and quickly sends the configuration file to the pod to achieve differentiated configuration for the pod.
[0163] Furthermore, databases require dynamic scaling. As the volume of the upper-layer services supported by the database service fluctuates, the underlying database service must support dynamic scaling of the number of replicas without disrupting the normal operation of the upper-layer services. Databases also require vertical upgrades and downgrades. Database services not only require scaling of the number of replicas but may also vertically upgrade or downgrade existing pod specifications (such as CPU / Memory / Disk), such as upgrading CPU / Memory from 4C / 8G to 8C / 16G, without disrupting the normal operation of upper-layer services. If dynamic scaling or vertical upgrades of the database are required, this can be achieved by modifying the database instance. If updates to the database instance are detected, they are synchronized to enable dynamic scaling or vertical upgrades. During dynamic scaling or vertical upgrades, the network traffic of the relevant pods is preemptively removed. After the dynamic scaling or vertical upgrade is complete, the relevant pods are re-connected to the business traffic, ensuring smooth operations without disrupting the business.
[0164] In addition, the database needs to be backed up and restored. In order to ensure the security and reliability of the data, the database service needs to take snapshots regularly during normal operation, such as a full database snapshot backup every hour; automatic snapshot backup is also required when the database service is destroyed, so that the database instance with complete data can be quickly restored based on the backup when needed. The present application method can back up the database instance on demand and back up the business data stored in the database process pod. It can be understood that the database components and database process pod are created based on the database instance. Only the database instance needs to be backed up to quickly restore the database components and database process pod, but the business data stored in the database process pod needs to be restored separately. The generated snapshot backup can support a variety of back-end storage, such as COS object storage, NFS, cloud snapshots, etc. Its cost is much lower than that of ordinary cloud hard disks, so it can bring significant cost reduction and efficiency improvement effects to the business.
[0165] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0166] Based on the same inventive concept, embodiments of the present application also provide a business service establishment device for implementing the aforementioned business service establishment method. The implementation solution provided by this device is similar to the implementation solution described in the aforementioned method. Therefore, the specific limitations in one or more business service establishment device embodiments provided below can be found in the above-mentioned limitations on the business service establishment method and will not be repeated here.
[0167] In one embodiment, as shown in FIG12 , a business service establishment device is provided, including: a data acquisition module 1202 , an instance creation module 1204 , a component creation module 1206 , a container creation module 1208 , and a model determination module 1210 , wherein:
[0168] The data acquisition module 1202 is used to acquire service demand information for the target business service and acquire an instance template preset for the target business service as a target instance template.
[0169] The instance creation module 1204 is configured to create a service instance corresponding to the target business service based on the service requirement information and the target instance template.
[0170] The component creation module 1206 is used to create service components based on the component declaration information contained in the service instance to obtain various service components corresponding to the target business service; the component declaration information is used to instruct the creation of service components that match various component types specified by the target instance template.
[0171] The container creation module 1208 is used to create a container group set corresponding to the service component based on the container group declaration information contained in the service component, and obtain the container group set corresponding to each service component; the container group declaration information contained in the service component is obtained from the service instance.
[0172] The model determination module 1210 is used to obtain the service model corresponding to the target business service based on the service instance, each service component, and the container group set corresponding to each service component; the service model is used to provide the target business service to the demander corresponding to the service demand information.
[0173] In one embodiment, the instance creation module 1204 is further configured to:
[0174] Fill the service requirement information into the target instance template to obtain the service instance corresponding to the target business service; the target instance template includes a component declaration area and a container group declaration area; the component declaration area is used to indicate component declaration information, and the container group declaration area is used to indicate container group declaration information.
[0175] In one embodiment, the component creation module 1206 is further configured to:
[0176] Based on the component declaration information contained in the service instance, determine the component types required for the target business service and the component configuration information corresponding to each component type; based on each component configuration information, create service components that match the corresponding component type to obtain the service components corresponding to the target business service.
[0177] In one embodiment, the container creation module 1208 is further configured to:
[0178] For any service component in each service component, based on the container group declaration information contained in the service component, determine the number of container groups required by the service component, and create each container group to be configured that matches the number of container groups; based on the container group declaration information contained in the service component, determine the container group configuration information corresponding to each container group to be configured; based on the container group configuration information, initialize the corresponding container group to be configured to obtain a configured container group; based on each configured container group, obtain the container group set corresponding to the service component.
[0179] In one embodiment, the container creation module 1208 is further configured to:
[0180] For any container group to be configured, the container group runtime identification information corresponding to the container group to be configured is obtained through the container group configuration component, and the personalized requirement information and the container group runtime identification information in the container group configuration information corresponding to the container group to be configured are rendered to obtain the container group personalized configuration information corresponding to the container group to be configured; the container group configuration component is used to obtain the container group configuration file template corresponding to the target business service, and the container group personalized configuration information and the container group configuration file template are rendered to obtain the target configuration file corresponding to the container group to be configured; the container group configuration component is used to send the target configuration file to the container to be configured to obtain the configured container group initialized on the configuration file.
[0181] In one embodiment, the container creation module 1208 is further configured to:
[0182] The container group configuration component obtains a template index of a container group configuration file template for the target business service from the container group declaration information. Based on the template index, the container group configuration file template is retrieved from a preset storage area. The container group configuration file template is submitted to the preset storage area for storage using a template unification tool. The template unification tool is used to unify the formats of container group configuration file templates provided by multiple business developers corresponding to the business type of the target business service.
[0183] In one embodiment, the container creation module 1208 is further configured to:
[0184] Create a target persistent volume declaration that matches the storage specifications in the container group configuration information; generate the target persistent volume content based on the target persistent volume template contained in the target persistent volume declaration, and associate the target persistent volume content with the hard disk that matches the storage specifications in the container group configuration information; bind the target persistent volume content and the target persistent volume declaration, and write the target persistent volume declaration to the container group to be configured to obtain a configured container group initialized on the storage specifications; the data in the configured container group initialized on the storage specifications is used to write to the hard disk.
[0185] In one embodiment, the business service establishment device is further configured to:
[0186] Based on the service component startup dependency order provided by the component declaration information, each service component is started in order; the running status of each service component is monitored by the probe set for each service component, and after the probe set for the service component with a high startup priority monitors that each container group in the container group set managed by the service component has been successfully started, the startup of the service component with the next startup priority is triggered; after each service component is successfully started, the creation success message corresponding to the target business service is returned to the demander.
[0187] In one embodiment, the business service establishment device is further configured to:
[0188] Obtain a container group adjustment request for a target business service; the container group adjustment request carries container group adjustment parameters; update the container group declaration information contained in the service instance based on the container group adjustment parameters; based on the updated container group declaration information, update the corresponding service component and the corresponding container group set.
[0189] In one embodiment, the business service establishment device is further configured to:
[0190] When the destruction of the service instance is triggered, the service instance is backed up to obtain a backup instance; the container groups in the container group set corresponding to each service component are respectively used as the first container group; based on the persistent volume declaration corresponding to the first container group, a persistent volume snapshot declaration corresponding to the first container group is created; based on the persistent volume content corresponding to the first container group, the persistent volume snapshot content corresponding to the first container group is created; the persistent volume snapshot declaration and the persistent volume snapshot content corresponding to the first container group are bound; based on the bound persistent volume snapshot declaration and the persistent volume snapshot content corresponding to the first container group, a data snapshot corresponding to the first container group is generated; the container group operation identification information corresponding to the first container group and the data snapshot are associated and stored; the data snapshots corresponding to each container group in the backup instance and the container group set corresponding to each service component are associated and stored.
[0191] In one embodiment, the business service establishment device is further configured to:
[0192] When triggering recovery of a service instance, a backup instance is obtained; a service component is created based on the component declaration information contained in the backup instance to obtain each recovery component; a container group set corresponding to the recovery component is created based on the container group declaration information contained in the recovery component to obtain a container group set corresponding to each recovery component; the container groups in the container group set corresponding to each recovery component are respectively used as second container groups; based on the container group operation identification information corresponding to the second container group, a corresponding data snapshot is obtained, a persistent volume snapshot declaration and persistent volume snapshot content corresponding to the second container group are generated based on the data snapshot corresponding to the second container group, a persistent volume content corresponding to the second container group is generated based on the persistent volume snapshot content corresponding to the second container group, a persistent volume declaration corresponding to the second container group is generated based on the persistent volume snapshot declaration corresponding to the second container group, the persistent volume content and persistent volume declaration corresponding to the second container group are bound, and the persistent volume declaration corresponding to the second container group is applied to the second container group.
[0193] In one embodiment, the target business service is a target database service. The service instance is used to indicate metadata required to establish the target database service. Each service component is responsible for implementing each function of the target database service. Each container group belonging to the same container group set is used to cooperate to implement the functions provided by the corresponding service component.
[0194] The business service establishment device pre-configures instance templates corresponding to various business services to quickly establish the corresponding business services. For a target business service, the personalized service requirement information of the target business service is combined with the instance template corresponding to the target business service to obtain a service instance corresponding to the target business service. Based on the component declaration information contained in the service instance, each service component corresponding to the target business service is created. Based on the container group declaration information contained in the service component, a container group set corresponding to the service component is created. A service model for providing the target business service is constructed by combining the service instance corresponding to the target business service, each service component, and each container group set corresponding to each service component. The business service is abstracted into a three-layer model, comprising service instances, service components, and container group sets corresponding to the service components. The service instance manages and creates relevant information about the service components and container group sets, while each component manages and creates relevant information about its own container group set, enabling orderly business service establishment. Various business services can be abstracted into a three-layer model, which is highly versatile, ensuring the versatility of business service establishment and improving the efficiency of business service establishment. Based on this three-layer model, business services are containerized and implemented in a cloud-native manner.
[0195] Each module in the business service establishment device described above may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0196] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in Figure 13. The computer device includes a processor, a memory, an input / output interface (I / O), and a communication interface. The processor, memory, and I / O interface are connected via a system bus, and the communication interface is connected to the system bus via the I / O interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer-readable instructions, and a database. The internal memory provides an environment for the operation of the operating system and computer-readable instructions in the non-volatile storage medium. The database of the computer device is used to store data such as instance templates and configuration file templates. The I / O interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals via a network connection. When the computer-readable instructions are executed by the processor, a method for establishing a business service is implemented.
[0197] Those skilled in the art will understand that the structure shown in FIG13 is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0198] In one embodiment, a computer device is further provided, including a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps in the above-mentioned method embodiments when executing the computer-readable instructions.
[0199] In one embodiment, a computer-readable storage medium is provided, which stores computer-readable instructions. When the computer-readable instructions are executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0200] In one embodiment, a computer program product is provided. The computer program product includes computer-readable instructions. When the computer-readable instructions are executed by a processor, the steps in the above method embodiments are implemented.
[0201] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions.
[0202] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through computer-readable instructions. The computer-readable instructions can be stored in a non-volatile computer-readable storage medium. When the computer-readable instructions are executed, they can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.
[0203] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0204] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A method for establishing a business service, characterized in that: Executed by a computer device, the method includes: Acquire service demand information for a target business service, and acquire an instance template preset for the target business service as a target instance template; Creating a service instance corresponding to the target business service based on the service demand information and the target instance template; Creating a service component based on component declaration information included in the service instance to obtain each service component corresponding to the target business service, wherein the component declaration information is used to instruct the creation of service components that match each component type specified by the target instance template; Creating a container group set corresponding to the service component based on the container group declaration information included in the service component, and obtaining a container group set corresponding to each of the service components, wherein the container group declaration information included in the service component is obtained from the service instance; and Based on the service instance, the service components, and the container group sets corresponding to the service components, a service model corresponding to the target business service is obtained, and the service model is used to provide the target business service to the demander corresponding to the service demand information.
2. The method according to claim 1, characterized in that: The creating a service instance corresponding to the target business service based on the service requirement information and the target instance template includes: The service requirement information is filled into the target instance template to obtain a service instance corresponding to the target business service, wherein the target instance template includes a component declaration area and a container group declaration area, wherein the component declaration area is used to indicate component declaration information, and the container group declaration area is used to indicate container group declaration information.
3. The method according to claim 1 or 2, characterized in that: The creating a service component based on the component declaration information included in the service instance to obtain each service component corresponding to the target business service includes: Based on the component declaration information included in the service instance, determining each component type required by the target business service and component configuration information corresponding to each component type; and Based on the configuration information of each component, service components matching the corresponding component types are created respectively to obtain service components corresponding to the target business service.
4. The method according to any one of claims 1 to 3, characterized in that The step of creating a container group set corresponding to the service component based on the container group declaration information contained in the service component to obtain a container group set corresponding to each service component includes: For any one of the service components, based on the container group declaration information included in the service component, determine the number of container groups required by the service component, and create each container group to be configured that matches the number of container groups; Based on the container group declaration information included in the service component, determine the container group configuration information corresponding to each container group to be configured, and initialize the corresponding container group to be configured based on the container group configuration information to obtain a configured container group; and Based on each configured container group, the container group set corresponding to the service component is obtained.
5. The method according to claim 4, characterized in that Initializing the corresponding container group to be configured based on the container group configuration information to obtain the configured container group includes: For any container group to be configured, the container group runtime identification information corresponding to the container group to be configured is obtained through the container group configuration component, and the personalized requirement information and the container group runtime identification information in the container group configuration information corresponding to the container group to be configured are rendered to obtain the container group personalized configuration information corresponding to the container group to be configured; Obtaining, through the container group configuration component, a container group configuration file template corresponding to the target business service, rendering the container group personalized configuration information and the container group configuration file template to obtain a target configuration file corresponding to the container group to be configured; and The target configuration file is sent to the container to be configured through the container group configuration component, and a configured container group initialized on the configuration file is obtained.
6. The method according to claim 5, characterized in that The obtaining, through the container group configuration component, a container group configuration file template corresponding to the target business service includes: The container group configuration component obtains a template index of a container group configuration file template for the target business service from the container group declaration information, and obtains the container group configuration file template from a preset storage area based on the template index, wherein the container group configuration file template is submitted to the preset storage area for storage by a template unification tool, and the template unification tool is used to unify the formats of container group configuration file templates respectively provided by multiple business developers corresponding to the business type to which the target business service belongs.
7. The method according to claim 4, characterized in that Initializing the corresponding container group to be configured based on the container group configuration information to obtain the configured container group includes: Creating a target persistent volume declaration that matches the storage specification in the container group configuration information; Generate target persistent volume content based on the target persistent volume template included in the target persistent volume declaration, and associate the target persistent volume content with a hard disk that matches the storage specification in the container group configuration information; and Bind the target persistent volume content and the target persistent volume declaration, write the target persistent volume declaration into the container group to be configured, obtain the configured container group initialized on the storage specification, and use the data in the configured container group initialized on the storage specification to write into the hard disk.
8. The method according to any one of claims 1 to 7, characterized in that The method further comprises: Based on the service component startup dependency sequence provided by the component declaration information, start the service components in order; Monitor the running status of each service component by using probes respectively set for each service component, and trigger the startup of the service component with the next startup priority after the probe set for the service component with a high startup priority monitors that each container group in the container group set managed by the service component is successfully started; and After each of the service components is successfully started, a creation success message corresponding to the target business service is returned to the demander.
9. The method according to any one of claims 1 to 8, characterized in that The method further comprises: Acquire a container group adjustment request for the target business service; the container group adjustment request carries a container group adjustment parameter; updating the container group declaration information included in the service instance based on the container group adjustment parameter; and Based on the updated container group declaration information, the corresponding service component and the corresponding container group set are updated.
10. The method according to any one of claims 1 to 9, characterized in that The method further comprises: When the destruction of the service instance is triggered, backing up the service instance to obtain a backup instance; Using the container groups in the container group sets corresponding to the respective service components as first container groups respectively; creating a persistent volume snapshot declaration corresponding to the first container group based on the persistent volume declaration corresponding to the first container group, creating persistent volume snapshot content corresponding to the first container group based on the persistent volume content corresponding to the first container group, binding the persistent volume snapshot declaration and the persistent volume snapshot content corresponding to the first container group, generating a data snapshot corresponding to the first container group based on the bound persistent volume snapshot declaration and the persistent volume snapshot content corresponding to the first container group, and associating and storing the container group operation identification information corresponding to the first container group with the data snapshot; and The data snapshots corresponding to the backup instance and each container group in the container group set corresponding to each service component are associated and stored.
11. The method according to claim 10, characterized in that The method further comprises: When recovery of the service instance is triggered, obtaining the backup instance; Creating a service component based on the component declaration information included in the backup instance to obtain various recovery components; Creating a container group set corresponding to the recovery component based on the container group declaration information included in the recovery component, and obtaining a container group set corresponding to each recovery component; Using the container groups in the container group sets corresponding to the respective recovery components as second container groups respectively; and Based on the container group running identification information corresponding to the second container group, a corresponding data snapshot is obtained; based on the data snapshot corresponding to the second container group, a persistent volume snapshot declaration and persistent volume snapshot content corresponding to the second container group are generated; based on the persistent volume snapshot content corresponding to the second container group, a persistent volume content corresponding to the second container group is generated; based on the persistent volume snapshot declaration corresponding to the second container group, a persistent volume declaration corresponding to the second container group is generated; and the first persistent volume snapshot declaration corresponding to the second container group is bound to the first persistent volume snapshot. The persistent volume content and persistent volume declaration corresponding to the second container group, and applying the persistent volume declaration corresponding to the second container group to the second container group.
12. The method according to any one of claims 1 to 11, characterized in that The target business service is a target database service, the service instance is used to indicate metadata required to establish the target database service, the various service components are used to be responsible for implementing the various functions of the target database service, and the various container groups belonging to the same container group set are used to cooperate to implement the functions provided by the corresponding service components.
13. A business service establishment device, characterized in that: The device comprises: A data acquisition module, used to acquire service demand information for a target business service, and acquire an instance template preset for the target business service as a target instance template; An instance creation module, used to create a service instance corresponding to the target business service based on the service demand information and the target instance template; A component creation module, used to create a service component based on the component declaration information contained in the service instance, and obtain each service component corresponding to the target business service, wherein the component declaration information is used to instruct the creation of service components that match each component type specified by the target instance template; a container creation module, configured to create a container group set corresponding to the service component based on the container group declaration information contained in the service component, and obtain the container group set corresponding to each of the service components, wherein the container group declaration information contained in the service component is obtained from the service instance; and The model determination module is used to obtain the service model corresponding to the target business service based on the service instance, the various service components, and the container group set corresponding to each service component. The service model is used to provide the target business service to the demander corresponding to the service demand information.
14. The device according to claim 13, characterized in that The instance creation module is also used to: The service requirement information is filled into the target instance template to obtain a service instance corresponding to the target business service, wherein the target instance template includes a component declaration area and a container group declaration area, wherein the component declaration area is used to indicate component declaration information, and the container group declaration area is used to indicate container group declaration information.
15. The device according to claim 13 or 14, characterized in that The component creation module is also used to: Based on the component declaration information included in the service instance, determining each component type required by the target business service and component configuration information corresponding to each component type; and Based on the configuration information of each component, service components matching the corresponding component types are created respectively to obtain service components corresponding to the target business service.
16. The device according to any one of claims 13 to 15, characterized in that The container creation module is also used to: For any one of the service components, based on the container group declaration information included in the service component, determine the number of container groups required by the service component, and create each container group to be configured that matches the number of container groups; Based on the container group declaration information included in the service component, determine the container group configuration information corresponding to each container group to be configured, and initialize the corresponding container group to be configured based on the container group configuration information to obtain a configured container group; and Based on each configured container group, the container group set corresponding to the service component is obtained.
17. The device according to claim 16, characterized in that The container creation module is also used to: For any container group to be configured, the container group runtime identification information corresponding to the container group to be configured is obtained through the container group configuration component, and the personalized requirement information in the container group configuration information and the container group runtime identification information are rendered to obtain the container group personalized configuration information corresponding to the container group to be configured; Obtaining a container group configuration file template corresponding to the target business service through the container group configuration component, rendering the container group personalized configuration information and the container group configuration file template, and obtaining a target configuration file corresponding to the container group to be configured; and The target configuration file is sent to the container to be configured through the container group configuration component, and a configured container group initialized on the configuration file is obtained.
18. The device according to claim 17, characterized in that The container creation module is also used to: The container group configuration component obtains a template index of a container group configuration file template for the target business service from the container group declaration information, and obtains the container group configuration file template from a preset storage area based on the template index, wherein the container group configuration file template is submitted to the preset storage area for storage by a template unification tool, and the template unification tool is used to unify the formats of container group configuration file templates respectively provided by multiple business developers corresponding to the business type to which the target business service belongs.
19. The device according to claim 16, characterized in that The container creation module is also used to: Creating a target persistent volume declaration that matches the storage specification in the container group configuration information; Generate target persistent volume content based on the target persistent volume template included in the target persistent volume declaration, and associate the target persistent volume content with a hard disk that matches the storage specification in the container group configuration information; and Bind the target persistent volume content and the target persistent volume declaration, write the target persistent volume declaration into the container group to be configured, obtain the configured container group initialized on the storage specification, and use the data in the configured container group initialized on the storage specification to write into the hard disk.
20. The device according to any one of claims 13 to 19, characterized in that The device is also used for: Based on the service component startup dependency sequence provided by the component declaration information, start the service components in order; The running status of each service component is monitored by the probes respectively set for each service component, and after the probes set for the service components with high startup priority detect that each container group in the container group set managed by the service component is successfully started, the service component with the next startup priority is triggered to start; and After each of the service components is successfully started, a creation success message corresponding to the target business service is returned to the demander.
21. The device according to any one of claims 13 to 20, characterized in that The device is also used for: Acquire a container group adjustment request for the target business service; the container group adjustment request carries a container group adjustment parameter; updating the container group declaration information included in the service instance based on the container group adjustment parameter; and Based on the updated container group declaration information, the corresponding service component and the corresponding container group set are updated.
22. The device according to any one of claims 13 to 21, characterized in that The device is also used for: When the destruction of the service instance is triggered, backing up the service instance to obtain a backup instance; Using the container groups in the container group sets corresponding to the respective service components as first container groups respectively; creating a persistent volume snapshot declaration corresponding to the first container group based on the persistent volume declaration corresponding to the first container group, creating persistent volume snapshot content corresponding to the first container group based on the persistent volume content corresponding to the first container group, binding the persistent volume snapshot declaration and the persistent volume snapshot content corresponding to the first container group, generating a data snapshot corresponding to the first container group based on the bound persistent volume snapshot declaration and the persistent volume snapshot content corresponding to the first container group, and associating and storing the container group operation identification information corresponding to the first container group with the data snapshot; and The data snapshots corresponding to the backup instance and each container group in the container group set corresponding to each service component are associated and stored.
23. The device according to claim 22, characterized in that The device is also used for: When recovery of the service instance is triggered, obtaining the backup instance; Creating a service component based on the component declaration information included in the backup instance to obtain various recovery components; Creating a container group set corresponding to the recovery component based on the container group declaration information included in the recovery component, and obtaining a container group set corresponding to each recovery component; Using the container groups in the container group sets corresponding to the respective recovery components as second container groups respectively; and Based on the container group operation identification information corresponding to the second container group, the corresponding data snapshot is obtained; based on the data snapshot corresponding to the second container group, a persistent volume snapshot declaration and persistent volume snapshot content corresponding to the second container group are generated; based on the persistent volume snapshot content corresponding to the second container group, a persistent volume content corresponding to the second container group is generated; based on the persistent volume snapshot declaration corresponding to the second container group, a persistent volume declaration corresponding to the second container group is generated; the persistent volume content and persistent volume declaration corresponding to the second container group are bound; and the persistent volume declaration corresponding to the second container group is applied to the The second container group.
24. The device according to any one of claims 13 to 23, characterized in that The target business service is a target database service, the service instance is used to indicate metadata required to establish the target database service, the various service components are used to be responsible for implementing the various functions of the target database service, and the various container groups belonging to the same container group set are used to cooperate to implement the functions provided by the corresponding service components.
25. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, characterized in that: When the processor executes the computer-readable instructions, the steps of the method according to any one of claims 1 to 12 are implemented.
26. A computer-readable storage medium having computer-readable instructions stored thereon, characterized in that: When the computer readable instructions are executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
27. A computer program product comprising computer readable instructions, characterized in that: When the computer readable instructions are executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Application development system, operation method, equipment and storage medium
CN111831269A
Method and device for creating persistent data volume and server
CN114253459A
Instance starting method and device based on cloud platform
CN114489956A
Method and system for automatically creating instances of containerized servers
US20220398070A1
